PID Graph GraphQL Example Longitudinal Data

User story

As a longitudinal study, I want to be able to deduplicate the metrics/impact for our data, so that I can see the impact of our study’s data as a whole.

Query strategy

We start with a single dataset that has multiple parts, and then find all parts. We fetch the views, downloads and citations for the whole dataset, and for each part.

Why GraphQL

Aggregation for metrics/impact is a typical use case for GraphQL, as it allows the combination of three steps into one API call:

  • start with the PID for the resource you want to aggregate by, e.g. person, organization, funder but also dataset with multiple parts, e.g. one subset per year
  • collect all research outputs associated with this PID
  • collect metrics (e.g. citations, views and downloads) for each research output

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

{
  dataset(id: "https://doi.org/10.14291/tccon.ggg2014") {
    id
    titles {
      title
    }
    citationCount
    viewCount
    downloadCount
    partCount
    parts {
      nodes {
        id
        titles {
          title
        }
        citationCount
        viewCount
        downloadCount
      }
    }
  }
}

Related GitHub issues from 2018 FREYA workshop: