sparql-examples

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

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

002

Among the structural annotations from Tabernaemontana coffeoides (Apocynaceae) seeds extract, which ones contain an aspidospermidine substructure?

Use at

PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX enpkg: <https://enpkg.commons-lab.org/kg/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX sachem: <http://bioinfo.uochb.cas.cz/rdf/v1.0/sachem#>
PREFIX emi: <https://purl.org/emi#>
PREFIX sosa: <http://www.w3.org/ns/sosa/>

SELECT DISTINCT ?ik2d ?smiles
WHERE {
    ?extract a emi:ExtractSample ;
        sosa:isSampleOf* ?organe .
    ?organe emi:inTaxon ?taxon .
    ?taxon rdfs:label "tabernaemontana coffeoides" .
    ?extract sosa:isFeatureOfInterestOf ?lcms .
    ?lcms sosa:hasResult ?feature_list .
    ?feature_list emi:hasLCMSFeature ?feature .
    ?feature emi:hasAnnotation ?annotation .
    ?annotation emi:hasChemicalStructure ?ik2d .
    ?ik2d a emi:InChIKey2D ;
        emi:hasSMILES ?smiles ;
        emi:isInChIKey2DOf ?ik .
    ?ik emi:isInChIKeyOf ?wd_id .
    SERVICE <https://idsm.elixir-czech.cz/sparql/endpoint/wikidata> {
        SELECT * WHERE {
            ?wd_id sachem:substructureSearch [
                sachem:query "CCC12CCCN3C1C4(CC3)C(CC2)NC5=CC=CC=C45" # Aspidospermidine scaffold
            ] .
        }
    }
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v7("?annotation")
  v1("?extract")
  v6("?feature")
  v5("?feature_list")
  v10("?ik")
  v8("?ik2d"):::projected 
  v4("?lcms")
  v2("?organe")
  v9("?smiles"):::projected 
  v3("?taxon")
  v11("?wd_id")
  a1((" "))
  c18(["CCC12CCCN3C1C4(CC3)C(CC2)NC5=CC=CC=C45"]):::literal 
  c6(["tabernaemontana coffeoides"]):::literal 
  c12(["emi:InChIKey2D"]):::iri 
  c2(["emi:ExtractSample"]):::iri 
  v1 --"a"-->  c2
  v1 --"sosa:isSampleOf"-->  v2
  v2 --"emi:inTaxon"-->  v3
  v3 --"rdfs:label"-->  c6
  v1 --"sosa:isFeatureOfInterestOf"-->  v4
  v4 --"sosa:hasResult"-->  v5
  v5 --"emi:hasLCMSFeature"-->  v6
  v6 --"emi:hasAnnotation"-->  v7
  v7 --"emi:hasChemicalStructure"-->  v8
  v8 --"a"-->  c12
  v8 --"emi:hasSMILES"-->  v9
  v8 --"emi:isInChIKey2DOf"-->  v10
  v10 --"emi:isInChIKeyOf"-->  v11
  subgraph s1["https://idsm.elixir-czech.cz/sparql/endpoint/wikidata"]
    style s1 stroke-width:4px;
    a1 --"sachem:query"-->  c18
    v11 --"sachem:substructureSearch"-->  a1
  end