sparql-examples

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

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

118_Number_of_approved_reactions_missing_citations

rq turtle/ttl

Number of approved reactions missing citations

Use at

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rh: <http://rdf.rhea-db.org/>
SELECT
  (count(?reaction) as ?eactionMissingCitationCount)
WHERE
{
  ?reaction rdfs:subClassOf rh:Reaction .
  ?reaction rh:status rh:Approved .
  OPTIONAL {?reaction rh:citation ?citation .}
  FILTER (NOT EXISTS {?reaction rh:citation ?citation .})
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v2("?citation")
  v3("?eactionMissingCitationCount")
  v1("?reaction"):::projected 
  c5(["rh:Approved"]):::iri 
  c3(["rh:Reaction"]):::iri 
  f0[["not  "]]
  subgraph f0e0["Exists Clause"]
    e0v1 --"rh:citation"-->  e0v2
    e0v2("?citation"):::projected 
    e0v1("?reaction"):::projected 
  end
  f0--EXISTS--> f0e0
  f0 --> v1
  f0 --> c1
  f0 --> v2
  v1 --"rh:citation"-->  v2
  v1 --"rdfs:subClassOf"-->  c3
  v1 --"rh:status"-->  c5
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v1 -."rh:citation".->  v2
  end
  bind2[/"count(?reaction)"/]
  v1 --o bind2
  bind2 --as--o v3