SPARQL examples for the EMI
View the Project on GitHub earth-metabolome-initiative/sparql-examples
Count the number of features with the same ISDB and SIRIUS annotations
PREFIX enpkg: <https://enpkg.commons-lab.org/kg/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT (COUNT(?feature) AS ?count)
WHERE
{
?lcms enpkg:has_massive_doi ?massive_doi .
# FILTER(regex(str(?massive_doi), "MSV000087728")) # MassIVE id filter, MSV000087728 is pf1600, MSV000093464 is 337 Korean medicinal plants, if you want to query both you can pipe "MSV000087728|MSV000093464". You can apply or not these filters by ucommenting/commenting this line.
?lcms enpkg:has_lcms_feature_list ?feature_list .
?feature_list enpkg:has_lcms_feature ?feature .
?feature enpkg:has_sirius_annotation ?sirius_annotation .
?sirius_annotation rdf:type enpkg:SiriusStructureAnnotation .
?sirius_annotation enpkg:has_InChIkey2D ?sirius_ik2d .
?feature enpkg:has_isdb_annotation ?isdb_annotation .
?isdb_annotation rdf:type enpkg:IsdbAnnotation .
?isdb_annotation enpkg:has_InChIkey2D ?isdb_ik2d .
FILTER(?isdb_ik2d = ?sirius_ik2d) .
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v9("?count")
v6("?feature"):::projected
v5("?feature_list")
v8("?isdb_annotation")
v1("?isdb_ik2d")
v3("?lcms")
v4("?massive_doi")
v7("?sirius_annotation")
v2("?sirius_ik2d")
c6(["enpkg:SiriusStructureAnnotation"]):::iri
c9(["enpkg:IsdbAnnotation"]):::iri
f0[["?isdb_ik2d = ?sirius_ik2d"]]
f0 --> v1
f0 --> v2
v3 --"enpkg:has_massive_doi"--> v4
v3 --"enpkg:has_lcms_feature_list"--> v5
v5 --"enpkg:has_lcms_feature"--> v6
v6 --"enpkg:has_sirius_annotation"--> v7
v7 --"a"--> c6
v7 --"enpkg:has_InChIkey2D"--> v2
v6 --"enpkg:has_isdb_annotation"--> v8
v8 --"a"--> c9
v8 --"enpkg:has_InChIkey2D"--> v1
bind2[/"count(?feature)"/]
v6 --o bind2
bind2 --as--o v9