lotus-sparql-examples

A set of SPARQL examples that are used in LOTUS

View the Project on GitHub lotusnprod/lotus-sparql-examples

wd_chemical_classes_nps_years

rq turtle/ttl

Compounds labelled as terpenoid (Q426694) found in Aspergillus (Q335130) spp., between 2010 and 2020, with related references.

Use at


PREFIX p: <http://www.wikidata.org/prop/>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
#title: Compounds labelled as terpenoid (Q426694) found in Aspergillus (Q335130) spp., between 2010 and 2020, with related references.
SELECT ?compound ?compound_inchi (GROUP_CONCAT(DISTINCT ?isolation_reference; SEPARATOR = "|") AS ?isolation_references) (GROUP_CONCAT(DISTINCT ?reference_title; SEPARATOR = "|") AS ?references_titles) WHERE {
    VALUES ?taxon {
        wd:Q335130
    }
    VALUES ?chemical_class {
        wd:Q426694
    }
    ?compound wdt:P234 ?compound_inchi;
    ((wdt:P31|wdt:P279)/(wdt:P279*)) ?compound_class;
    p:P703 ?statement.
    ?statement ps:P703/(wdt:P171*) ?taxon;
    (prov:wasDerivedFrom/pr:P248) ?isolation_reference.
    ?isolation_reference wdt:P1476 ?reference_title;
    wdt:P577 ?reference_date.
    FILTER(((YEAR(?reference_date)) >= 2010 ) && ((YEAR(?reference_date)) <= 2020 ))
    FILTER(?compound_class = ?chemical_class)
}
GROUP BY ?compound ?compound_inchi

graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v5("?chemical_class")
  v5("?compound"):::projected 
  v1("?compound_class")
  v6("?compound_inchi"):::projected 
  v8("?isolation_reference"):::projected 
  v10("?isolation_references")
  v3("?reference_date")
  v9("?reference_title"):::projected 
  v11("?references_titles")
  v7("?statement")
  v4("?taxon")
  a1((" "))
  a2((" "))
  a3((" "))
  f0[["?compound_class = ?chemical_class"]]
  f0 --> v1
  f0 --> v5
  f1[["year-from-dateTime(?reference_date) >= '2010^^xsd:integer'year-from-dateTime(?reference_date) <= '2020^^xsd:integer'"]]
  f1 --> v3
  bind2[/VALUES ?taxon/]
  bind2-->v4
  bind20(["wd:Q335130"])
  bind20 --> bind2
  bind3[/VALUES ?chemical_class/]
  bind3-->v5
  bind30(["wd:Q426694"])
  bind30 --> bind3
  v5 --"p:direct/P234"-->  v6
  subgraph union0[" Union "]
  subgraph union0l[" "]
    style union0l fill:#abf,stroke-dasharray: 3 3;
    v5 --"p:direct/P279"-->  a1
  end
  subgraph union0r[" "]
    style union0r fill:#abf,stroke-dasharray: 3 3;
    v5 --"p:direct/P31"-->  a1
  end
  union0r <== or ==> union0l
  end
  a1 --"p:direct/P279"-->  v1
  v5 --"p:P703"-->  v7
  v7 --"p:statement/P703"-->  a2
  a2 --"p:direct/P171"-->  v4
  v7 --"prov:wasDerivedFrom"-->  a3
  a3 --"p:reference/P248"-->  v8
  v8 --"p:direct/P1476"-->  v9
  v8 --"p:direct/P577"-->  v3
  bind6[/"?isolation_reference"/]
  v8 --o bind6
  bind6 --as--o v10
  bind7[/"?reference_title"/]
  v9 --o bind7
  bind7 --as--o v11