sparql-examples

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

View the Project on GitHub sib-swiss/sparql-examples

004

For features from Melochia umbellata in positive ionization mode with SIRIUS annotations, get the ones for which a feature in negative ionization mode with the same retention time (± 3 sec) has the same SIRIUS annotation (2D InChIKey).

Use at

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX emi: <https://purl.org/emi#>
PREFIX sosa: <http://www.w3.org/ns/sosa/>

SELECT DISTINCT ?feature ?feature_opp ?ik2d ?rt ?rt_opp
WHERE {
    VALUES ?rt_tol {
        "0.05"^^xsd:decimal # RT tolerance (minute)
    }
    ?sample a emi:ExtractSample ;
        sosa:isSampleOf* ?organe .
    ?organe emi:inTaxon ?taxon .
    ?taxon rdfs:label "melochia umbellata" .
    ?sample sosa:isFeatureOfInterestOf ?lcms .
    ?lcms a emi:LCMSAnalysisPos ;
        sosa:hasResult ?feature_list .
    ?feature_list emi:hasLCMSFeature ?feature .
    ?feature emi:hasRetentionTime ?rt ;
        emi:hasAnnotation ?sirius .
    ?sirius a emi:StructuralAnnotation ;
        prov:wasGeneratedBy ?activity .
    ?activity prov:wasAssociatedWith <https://bio.informatik.uni-jena.de/software/sirius> .
    ?sirius emi:hasChemicalStructure ?ik2d .
    ?sample sosa:isFeatureOfInterestOf ?lcms_opp .
    ?lcms_opp a emi:LCMSAnalysisNeg ;
        sosa:hasResult ?feature_list_opp .
    ?feature_list_opp emi:hasLCMSFeature ?feature_opp .
    ?feature_opp emi:hasRetentionTime ?rt_opp ;
        emi:hasAnnotation ?sirius_opp .
    ?sirius_opp a emi:StructuralAnnotation ;
        prov:wasGeneratedBy ?activity_opp ;
        emi:hasChemicalStructure ?ik2d .
    ?activity_opp prov:wasAssociatedWith <https://bio.informatik.uni-jena.de/software/sirius> .
    FILTER(((?rt - ?rt_tol) < ?rt_opp) && ((?rt + ?rt_tol) > ?rt_opp))
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v11("?activity")
  v17("?activity_opp")
  v9("?feature"):::projected 
  v8("?feature_list")
  v14("?feature_list_opp")
  v15("?feature_opp"):::projected 
  v12("?ik2d"):::projected 
  v7("?lcms")
  v13("?lcms_opp")
  v5("?organe")
  v1("?rt"):::projected 
  v3("?rt_opp"):::projected 
  v4("?rt_tol")
  v4("?sample")
  v10("?sirius")
  v16("?sirius_opp")
  v6("?taxon")
  c6(["melochia umbellata"]):::literal 
  c16([https://bio.informatik.uni-jena.de/software/sirius]):::iri 
  c2(["emi:ExtractSample"]):::iri 
  c13(["emi:StructuralAnnotation"]):::iri 
  c18(["emi:LCMSAnalysisNeg"]):::iri 
  c8(["emi:LCMSAnalysisPos"]):::iri 
  f0[["?rt - ?rt_tol < ?rt_opp?rt + ?rt_tol > ?rt_opp"]]
  f0 --> v1
  f0 --> v4
  f0 --> v3
  bind1[/VALUES ?rt_tol/]
  bind1-->v4
  bind10(["0.05^^xsd:decimal"])
  bind10 --> bind1
  v4 --"a"-->  c2
  v4 --"sosa:isSampleOf"-->  v5
  v5 --"emi:inTaxon"-->  v6
  v6 --"rdfs:label"-->  c6
  v4 --"sosa:isFeatureOfInterestOf"-->  v7
  v7 --"a"-->  c8
  v7 --"sosa:hasResult"-->  v8
  v8 --"emi:hasLCMSFeature"-->  v9
  v9 --"emi:hasRetentionTime"-->  v1
  v9 --"emi:hasAnnotation"-->  v10
  v10 --"a"-->  c13
  v10 --http://www.w3.org/ns/prov#wasGeneratedBy-->  v11
  v11 --http://www.w3.org/ns/prov#wasAssociatedWith-->  c16
  v10 --"emi:hasChemicalStructure"-->  v12
  v4 --"sosa:isFeatureOfInterestOf"-->  v13
  v13 --"a"-->  c18
  v13 --"sosa:hasResult"-->  v14
  v14 --"emi:hasLCMSFeature"-->  v15
  v15 --"emi:hasRetentionTime"-->  v3
  v15 --"emi:hasAnnotation"-->  v16
  v16 --"a"-->  c13
  v16 --http://www.w3.org/ns/prov#wasGeneratedBy-->  v17
  v16 --"emi:hasChemicalStructure"-->  v12
  v17 --http://www.w3.org/ns/prov#wasAssociatedWith-->  c16