sparql-examples

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

View the Project on GitHub BiGCAT-UM/sparql-examples

078

rq turtle/ttl

Counts the distinct metabolite identifiers per data source. ChEBI, HMDB and LIPID MAPS are the main data sources for metabolite identifiers.

Use at

PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX wp: <http://vocabularies.wikipathways.org/wp#>

SELECT (str(?datasource) as ?source) (count(distinct ?identifier) as ?count)
WHERE {
  ?mb a wp:Metabolite ;
    dc:source ?datasource ;
    dc:identifier ?identifier .
}
GROUP BY ?datasource
ORDER BY DESC(?count)
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v6("?count")
  v3("?datasource"):::projected 
  v4("?identifier"):::projected 
  v2("?mb")
  v5("?source")
  c2(["wp:Metabolite"]):::iri 
  v2 --"a"-->  c2
  v2 --"dc:source"-->  v3
  v2 --"dc:identifier"-->  v4
  bind1[/"str(?datasource)"/]
  v3 --o bind1
  bind1 --as--o v5
  bind2[/"count(?identifier)"/]
  v4 --o bind2
  bind2 --as--o v6