PID Graph GraphQL Example Query by Funder

User story

As a funder, I want to search all research outputs (including publications, datasets and software) funded by us, so that I can find relevant work that we funded.

Query strategy

We use the Crossref Funder ID to filter all research outputs for work funded by a particular funder (the German Research Foundation in this example). We then do a standard query, in this case using the name of a German research vessel.

Why GraphQL

The example shows that GraphQL also supports the kinds of standard queries typically done with REST APIs. The example shows two powerful feature of GraphQL: nested queries (rather than queries only supported on the top level), and selection of the facets and fields we want to see in the results.

Use the following query in the GraphQL client at https://api.datacite.org/graphql

{
  funder(id: "https://doi.org/10.13039/501100001659") {
    id
    name
    works(query: "polarstern") {
      totalCount
      years {
        title
        count
      }
      resourceTypes {
        title
        count
      }
      nodes {
        id
        type
        titles {
          title
        }
        creators {
          id
          name
        }
        publicationYear
        publisher
      }
    }
  }
}

I took this query and put it into a jupyter notebook to show also taking results and looking at some of the data. See: https://github.com/datacite/notebooks/tree/master/pid-graph/py-find-works-by-funder

My example uses the European Commission funder ID and also looks for anything related to “Freya” by using the awardNumber as part of a custom query. Displays the related works and also the numbers by resourceType.