sparql-examples

SPARQL examples for the EMI

View the Project on GitHub earth-metabolome-initiative/sparql-examples

metrics_3

rq turtle/ttl

Metrics for GloBI records (total number of interactions) for only those taxons that possess a Wikidata ID .

Use at

PREFIX emi: <https://w3id.org/emi#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT (COUNT(*) AS ?rowCount) 
WHERE {
  ?intxn emi:hasSource ?source ;
         emi:hasTarget ?target ;
         emi:isClassifiedWith ?intxnType .
  ?intxnType rdfs:label ?intxnLabel .
  ?source emi:inTaxon ?wdx_Source ;
          rdfs:label ?sourceName .
  ?target emi:inTaxon ?wdx_Target ;
          rdfs:label ?targetName .
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?intxn")
  v5("?intxnLabel")
  v4("?intxnType")
  v10("?rowCount")
  v2("?source")
  v7("?sourceName")
  v3("?target")
  v9("?targetName")
  v6("?wdx_Source")
  v8("?wdx_Target")
  v1 --"emi:hasSource"-->  v2
  v1 --"emi:hasTarget"-->  v3
  v1 --"emi:isClassifiedWith"-->  v4
  v4 --"rdfs:label"-->  v5
  v2 --"emi:inTaxon"-->  v6
  v2 --"rdfs:label"-->  v7
  v3 --"emi:inTaxon"-->  v8
  v3 --"rdfs:label"-->  v9
  bind1[/"count(*)"/]
  bind1 --as--o v10