A set of SPARQL examples that are used in different SIB resources
Show chemical structures in Melochia umbellata extracts with structural annotations where the cosmic score is greater than 0.5 and the zodiac score is less than 0.8. For ISDB annotations, consider taxon scores less than 6
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX emi: <https://purl.org/emi#>
PREFIX sosa: <http://www.w3.org/ns/sosa/>
SELECT DISTINCT ?ik ?wd_id ?taxon ?taxon_name
WHERE {
SERVICE <https://query.wikidata.org/sparql> {
?wd_id wdt:P31 wd:Q113145171 ;
wdt:P703 ?taxon .
?taxon wdt:P225 ?taxon_name .
}
{
SELECT DISTINCT ?ik ?chemblid ?name ?type ?value ?wd_id
WHERE {
?sample a emi:ExtractSample ;
sosa:isSampleOf* ?organe ;
sosa:isFeatureOfInterestOf ?lcms .
?organe emi:inTaxon ?taxon .
?taxon rdfs:label "melochia umbellata" .
?lcms a emi:LCMSAnalysisPos ;
sosa:hasResult ?feature_list .
?feature_list emi:hasLCMSFeature ?feature .
{
?feature emi:hasAnnotation ?annotation .
?annotation a emi:StructuralAnnotation ;
prov:wasGeneratedBy ?activity .
?activity prov:wasAssociatedWith <https://bio.informatik.uni-jena.de/software/sirius> .
?annotation emi:hasCosmicScore ?cosmic ;
emi:hasZodiacScore ?zodiac .
FILTER((?cosmic > 0.5) && (?zodiac > 0.8))
} UNION {
?feature emi:hasAnnotation ?annotation .
?annotation emi:hasTaxoScore ?taxo .
FILTER(?taxo >= 6)
}
?annotation emi:hasChemicalStructure ?ik2d .
?ik2d emi:hasSMILES ?smiles ;
emi:isInChIKey2DOf ?ik .
?ik emi:isInChIKeyOf ?wd_id .
}
}
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v12("?activity")
v11("?annotation")
v9("?cosmic")
v8("?feature")
v7("?feature_list")
v16("?ik"):::projected
v14("?ik2d")
v6("?lcms")
v5("?organe")
v4("?sample")
v15("?smiles")
v13("?taxo")
v2("?taxon"):::projected
v3("?taxon_name"):::projected
v1("?wd_id"):::projected
v10("?zodiac")
c12(["melochia umbellata"]):::literal
c19(["emi:StructuralAnnotation"]):::iri
c13(["emi:LCMSAnalysisPos"]):::iri
c3(["wd:Q113145171"]):::iri
c22([https://bio.informatik.uni-jena.de/software/sirius]):::iri
c7(["emi:ExtractSample"]):::iri
subgraph s1["https://query.wikidata.org/sparql"]
style s1 stroke-width:4px;
v1 --"wdt:P31"--> c3
v1 --"wdt:P703"--> v2
v2 --"wdt:P225"--> v3
end
v4 --"a"--> c7
v4 --"sosa:isSampleOf"--> v5
v4 --"sosa:isFeatureOfInterestOf"--> v6
v5 --"emi:inTaxon"--> v2
v2 --"rdfs:label"--> c12
v6 --"a"--> c13
v6 --"sosa:hasResult"--> v7
v7 --"emi:hasLCMSFeature"--> v8
subgraph union0[" Union "]
subgraph union0l[" "]
style union0l fill:#abf,stroke-dasharray: 3 3;
f0[["?taxo >= '6^^xsd:integer'"]]
f0 --> v13
v8 --"emi:hasAnnotation"--> v11
v11 --"emi:hasTaxoScore"--> v13
end
subgraph union0r[" "]
style union0r fill:#abf,stroke-dasharray: 3 3;
f1[["?cosmic > '0.5^^xsd:decimal'?zodiac > '0.8^^xsd:decimal'"]]
f1 --> v9
f1 --> v10
v8 --"emi:hasAnnotation"--> v11
v11 --"a"--> c19
v11 --http://www.w3.org/ns/prov#wasGeneratedBy--> v12
v12 --http://www.w3.org/ns/prov#wasAssociatedWith--> c22
v11 --"emi:hasCosmicScore"--> v9
v11 --"emi:hasZodiacScore"--> v10
end
union0r <== or ==> union0l
end
v11 --"emi:hasChemicalStructure"--> v14
v14 --"emi:hasSMILES"--> v15
v14 --"emi:isInChIKey2DOf"--> v16
v16 --"emi:isInChIKeyOf"--> v1