sparql-examples

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

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

112_Total_number_of_reaction_ec_protein_links

rq turtle/ttl

Total number of links

Use at

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

SELECT
  (count(?reaction) as ?reactionEcProteinLinkCount)
WHERE {
  ?reaction rdfs:subClassOf rh:Reaction .
  ?reaction rh:ec ?enzyme
  SERVICE <http://sparql.uniprot.org/sparql> {
    ?protein up:reviewed true .
    ?protein up:enzyme ?enzyme.
  }
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v2("?enzyme")
  v3("?protein")
  v1("?reaction"):::projected 
  v4("?reactionEcProteinLinkCount")
  c6(["true^^xsd:boolean"]):::literal 
  c2(["rh:Reaction"]):::iri 
  v1 --"rdfs:subClassOf"-->  c2
  v1 --"rh:ec"-->  v2
  subgraph s1["http://sparql.uniprot.org/sparql"]
    style s1 stroke-width:4px;
    v3 --"up:reviewed"-->  c6
    v3 --"up:enzyme"-->  v2
  end
  bind1[/"count(?reaction)"/]
  v1 --o bind1
  bind1 --as--o v4