Skip to content

SPARQL Queries

Lewis John McGibbney edited this page Apr 13, 2020 · 2 revisions

Introduction

This wiki page contains example SPARQL Queries for interacting with the COVID-19 Knowledge Graph.

If you have some additional queries you want to add, please add them here.

Find all research objects (preprint papers)

PREFIX owl: <http://www.w3.org/2002/07/owl#>
prefix schema: <http://schema.org/>

SELECT DISTINCT ?s
WHERE {
  ?s a schema:ScholarlyArticle, owl:NamedIndividual .
}

Find scholarly information associated with the top 50 research objects

prefix covid: <http://knowledge.jpl.nasa.gov/COVID-19/>
prefix obj: <http://knowledge.jpl.nasa.gov/COVID-19/000b7d1517ceebb34e1e3e817695b6de03e2fa78>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix schema: <http://schema.org/>

SELECT DISTINCT *
WHERE {
  ?s a schema:ScholarlyArticle, owl:NamedIndividual .
  ?s covid:doi_x ?doi_x .
  ?s covid:doi_y ?doi_y .
  ?s covid:has_full_text ?has_full_text .
  ?s covid:journal ?journal .
  ?s covid:source_x ?source_x .
  ?s schema:headline ?headline .
}
LIMIT 50

Find top 50 all authors who have published research on CHEBI protein complexes.

prefix covid: <http://knowledge.jpl.nasa.gov/COVID-19/>
prefix obj: <http://knowledge.jpl.nasa.gov/COVID-19/000b7d1517ceebb34e1e3e817695b6de03e2fa78>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix schema: <http://schema.org/>

SELECT ?author ?given_name ?family_name
WHERE {
  covid:00352a58c8766861effed18a4b079d1683fec2ec a schema:ScholarlyArticle, owl:NamedIndividual .
  covid:00352a58c8766861effed18a4b079d1683fec2ec covid:CHEBI ?o FILTER regex(?o, "^protein complexes", "i") .
  covid:00352a58c8766861effed18a4b079d1683fec2ec covid:hasAuthorsGroup ?authors_group .
  ?authors_group schema:author ?author .
  ?author schema:givenName ?given_name .
  ?author schema:familyName ?family_name .
}
LIMIT 50