sparql-examples

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

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

10

Select all Rhea reactions linked to an enzyme classification (sub)-class

Use at

PREFIX ec: <http://purl.uniprot.org/enzyme/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rh: <http://rdf.rhea-db.org/>

# Query 10
# Select all Rhea reactions mapped to 
# 
# This query corresponds to the Rhea website query:
# https://www.rhea-db.org/rhea?query=ec:1.*
# https://www.rhea-db.org/rhea?query=ec:1.1.*
# https://www.rhea-db.org/rhea?query=ec:1.1.1.*
#
SELECT ?ec ?ecNumber ?rhea ?accession ?equation
WHERE {
  ?rhea rdfs:subClassOf rh:Reaction .
  ?rhea rh:accession ?accession .
  ?rhea rh:ec ?ec .
  BIND(strafter(str(?ec),str(ec:)) as ?ecNumber)
  # class (e.g EC 1.-.-.-)
  FILTER (regex(?ecNumber,'^1\\.')) 
  # sub-class  (e.g EC 1.1.-.-)
  #FILTER (regex(?ecNumber,'^1\\.1\\.')) 
  # sub-sub-class (e.g EC 1.1.1.-)
  #FILTER (regex(?ecNumber,'^1\\.1\\.1\\.')) 
  ?rhea rh:equation ?equation .
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v3("?accession"):::projected 
  v4("?ec"):::projected 
  v5("?ecNumber"):::projected 
  v5("?equation"):::projected 
  v2("?rhea"):::projected 
  c3(["rh:Reaction"]):::iri 
  f0[["regex(?ecNumber,'^1\.')"]]
  f0 --> v5
  v2 --"rdfs:subClassOf"-->  c3
  v2 --"rh:accession"-->  v3
  v2 --"rh:ec"-->  v4
  bind1[/"substring-after(str(?ec),str('ec:'))"/]
  v4 --o bind1
  bind1 --as--o v5
  v2 --"rh:equation"-->  v5