sparql-examples

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

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

12

Select all Rhea reactions linked to protein sequences (enzymes and transporters) in UniProtKB

Use at

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

# Query 12
# Select all Rhea reactions used to annotate enzyme sequences in UniProtKB
# return the number of UniProtKB entries
# Federated query using a service to UniProt SPARQL endpoint
#
# This query corresponds to the Rhea website query:
# https://www.rhea-db.org/rhea?query=uniprot:*
#
SELECT ?uniprotCount ?rhea ?accession ?equation 
WHERE {
  SERVICE <https://sparql.uniprot.org/sparql> { 
  	SELECT ?rhea (count(?uniprot) as ?uniprotCount) {
      ?uniprot up:annotation/up:catalyticActivity/up:catalyzedReaction ?rhea . 
  	}
  	GROUP BY ?rhea
  }
  ?rhea rh:accession ?accession .
  ?rhea rh:equation ?equation .
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v4("?accession"):::projected 
  v5("?equation"):::projected 
  v2("?rhea"):::projected 
  v1("?uniprot")
  v3("?uniprotCount"):::projected 
  a1((" "))
  a2((" "))
  subgraph s1["https://sparql.uniprot.org/sparql"]
    style s1 stroke-width:4px;
    v1 --"up:annotation"-->  a1
    a1 --"up:catalyticActivity"-->  a2
    a2 --"up:catalyzedReaction"-->  v2
    bind1[/"count(?uniprot)"/]
    v1 --o bind1
    bind1 --as--o v3
  end
  v2 --"rh:accession"-->  v4
  v2 --"rh:equation"-->  v5