sparql-examples

A set of SPARQL examples that are used in different SIB resources

View the Project on GitHub sib-swiss/sparql-examples

13

rq turtle/ttl

Select all Rhea reactions used in UniProtKB/Swiss-Prot for a given organism (NCBI taxonomy ID).

Use at

PREFIX rh: <http://rdf.rhea-db.org/>
PREFIX taxon: <http://purl.uniprot.org/taxonomy/>
PREFIX up: <http://purl.uniprot.org/core/>

# Query 13
# Select all Rhea reactions used to annotate Escherichia coli (taxid=83333) in UniProtKB/Swiss-Prot
# return the number of UniProtKB entries
# 
# Federated query using a service to UniProt SPARQL endpoint
#
# This query cannot be performed using the Rhea search website
SELECT ?uniprot ?mnemo ?rhea ?accession ?equation 
WHERE {
  SERVICE <https://sparql.uniprot.org/sparql> { 
    BIND (taxon:83333 AS ?taxid)
    GRAPH <http://sparql.uniprot.org/uniprot> {
      ?uniprot up:reviewed true . 
      ?uniprot up:mnemonic ?mnemo . 
      ?uniprot up:organism ?taxid .
      ?uniprot up:annotation/up:catalyticActivity/up:catalyzedReaction ?rhea . 
    }
  }
  ?rhea rh:accession ?accession .
  ?rhea rh:equation ?equation .
}
https://sparql.uniprot.org/sparql
as
up:reviewed
up:mnemonic
up:organism
up:annotation
up:catalyticActivity
up:catalyzedReaction
rh:accession
rh:equation
'taxon:83333'
?taxid
true^^xsd:boolean
?uniprot
?mnemo
?rhea
?accession
?equation