From 2fcb4d6bfae0e0596ad5839af0ce657de23110e0 Mon Sep 17 00:00:00 2001 From: Sujay Patil Date: Thu, 6 Apr 2023 00:33:04 -0700 Subject: [PATCH] NEON API example graphql queries --- sample_annotator/clients/nmdc/graphql/README.md | 5 +++++ .../clients/nmdc/graphql/query1.graphql | 9 +++++++++ .../clients/nmdc/graphql/query2.graphql | 14 ++++++++++++++ .../clients/nmdc/graphql/query3.graphql | 11 +++++++++++ .../clients/nmdc/graphql/query4.graphql | 12 ++++++++++++ 5 files changed, 51 insertions(+) create mode 100644 sample_annotator/clients/nmdc/graphql/README.md create mode 100644 sample_annotator/clients/nmdc/graphql/query1.graphql create mode 100644 sample_annotator/clients/nmdc/graphql/query2.graphql create mode 100644 sample_annotator/clients/nmdc/graphql/query3.graphql create mode 100644 sample_annotator/clients/nmdc/graphql/query4.graphql diff --git a/sample_annotator/clients/nmdc/graphql/README.md b/sample_annotator/clients/nmdc/graphql/README.md new file mode 100644 index 0000000..7dab09d --- /dev/null +++ b/sample_annotator/clients/nmdc/graphql/README.md @@ -0,0 +1,5 @@ +This folder contains GraphQL queries written to explore the capabilities of the graphql endpoint provided by the NEON API. + +The queries are based on examples available here: https://data.neonscience.org/data-api/graphql/#examples + +A suitable sandbox to test the queries is here: https://data.neonscience.org/data-api/graphql/explorer/ \ No newline at end of file diff --git a/sample_annotator/clients/nmdc/graphql/query1.graphql b/sample_annotator/clients/nmdc/graphql/query1.graphql new file mode 100644 index 0000000..2f91290 --- /dev/null +++ b/sample_annotator/clients/nmdc/graphql/query1.graphql @@ -0,0 +1,9 @@ +# Get all products and include the product code, name, and description for each + +query Products { + products { + productCode + productName + productDescription + } +} \ No newline at end of file diff --git a/sample_annotator/clients/nmdc/graphql/query2.graphql b/sample_annotator/clients/nmdc/graphql/query2.graphql new file mode 100644 index 0000000..dccfea6 --- /dev/null +++ b/sample_annotator/clients/nmdc/graphql/query2.graphql @@ -0,0 +1,14 @@ +# Get data products based on the releaseTag value supplied in the query parameters + +query Products ($release: String!) { + products (release: $release) { + productCode + productName + productDescription + releases { + release + generationDate + url + } + } +} \ No newline at end of file diff --git a/sample_annotator/clients/nmdc/graphql/query3.graphql b/sample_annotator/clients/nmdc/graphql/query3.graphql new file mode 100644 index 0000000..1523fb7 --- /dev/null +++ b/sample_annotator/clients/nmdc/graphql/query3.graphql @@ -0,0 +1,11 @@ +# Get one or many data products with availability information. + +query Product ($productCode: String!) { + product (productCode: $productCode) { + productCode + productName + siteCodes { + siteCode + } + } +} \ No newline at end of file diff --git a/sample_annotator/clients/nmdc/graphql/query4.graphql b/sample_annotator/clients/nmdc/graphql/query4.graphql new file mode 100644 index 0000000..4a6dc96 --- /dev/null +++ b/sample_annotator/clients/nmdc/graphql/query4.graphql @@ -0,0 +1,12 @@ +# Get a data product and filter by availability + +query filterProducts ($filter: DataProductFilter!) { + products: filterProducts(filter: $filter) { + productCode + productName + productDescription + siteCodes { + siteCode + } + } +} \ No newline at end of file