sparql-examples

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

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

13

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> { 
    VALUES (?taxid) { (taxon:83333) }
    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 .
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v5("?accession"):::projected 
  v6("?equation"):::projected 
  v3("?mnemo"):::projected 
  v4("?rhea"):::projected 
  v1("?taxid")
  v2("?uniprot"):::projected 
  a1((" "))
  a2((" "))
  c3(["true^^xsd:boolean"]):::literal 
  subgraph s1["https://sparql.uniprot.org/sparql"]
    style s1 stroke-width:4px;
    bind0[/VALUES ?taxid/]
    bind0-->v1
    bind00(["taxon:83333"])
    bind00 --> bind0
    v2 --"up:reviewed"-->  c3
    v2 --"up:mnemonic"-->  v3
    v2 --"up:organism"-->  v1
    v2 --"up:annotation"-->  a1
    a1 --"up:catalyticActivity"-->  a2
    a2 --"up:catalyzedReaction"-->  v4
  end
  v4 --"rh:accession"-->  v5
  v4 --"rh:equation"-->  v6