A set of SPARQL examples that are used in different TGX resources
Finds data nodes with a data source annotation that are not classified as metabolites, grouped by data source with counts sorted descending.
PREFIX dc: <http://purl.org/dc/elements/1.1/>
prefix wp: <http://vocabularies.wikipathways.org/wp#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix dcterms: <http://purl.org/dc/terms/>
select (str(?datasourceLit) as ?datasource) (count(?identifier) as ?count)
where {
?mb dc:source ?datasourceLit ;
dcterms:identifier ?identifier .
FILTER NOT EXISTS { ?mb a wp:Metabolite }
} group by ?datasourceLit
order by desc(?count)
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?count")
v5("?datasource")
v3("?datasourceLit"):::projected
v4("?identifier"):::projected
v2("?mb")
c2(["wp:Metabolite"]):::iri
f0[["not "]]
subgraph f0e0["Exists Clause"]
e0v1 --"a"--> e0c2
e0v1("?mb"):::projected
e0c2(["wp:Metabolite"]):::iri
end
f0--EXISTS--> f0e0
f0 --> v2
f0 --> c1
f0 --> c2
v2 --"a"--> c2
v2 --"dc:source"--> v3
v2 --"dcterms:identifier"--> v4
bind2[/"str(?datasourceLit)"/]
v3 --o bind2
bind2 --as--o v5
bind3[/"count(?identifier)"/]
v4 --o bind3
bind3 --as--o v6