query-71b9c5d132bb0e33d9dbe9a2d0e802cf

rq turtle/ttl

title: Which compounds labelled as terpenoid (Q426694) were 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:P235 ?compound_id; wdt:P234 ?compound_inchi; ((wdt:P31|wdt:P279)/(wdt:P279)) ?compound_class; p:P703 ?statement. ?statement wikibase:rank wikibase:NormalRank. ?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

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX prov: <http://www.w3.org/ns/prov#>
PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX p: <http://www.wikidata.org/prop/>
#title: Which compounds labelled as terpenoid (Q426694) were 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:P235 ?compound_id;
    wdt:P234 ?compound_inchi;
    ((wdt:P31|wdt:P279)/(wdt:P279*)) ?compound_class;
    p:P703 ?statement.
  ?statement wikibase:rank wikibase:NormalRank.
  ?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

Query found at

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_id") v7("?compound_inchi"):::projected v9("?isolation_reference"):::projected v11("?isolation_references") v3("?reference_date") v10("?reference_title"):::projected v12("?references_titles") v8("?statement") v4("?taxon") a1((" ")) a2((" ")) a3((" ")) c9(["wikibase:NormalRank"]):::iri 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/P235"--> v6 v5 --"p:direct/P234"--> v7 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"--> v8 v8 --"wikibase:rank"--> c9 v8 --"p:statement/P703"--> a2 a2 --"p:direct/P171"--> v4 v8 --"prov:wasDerivedFrom"--> a3 a3 --"p:reference/P248"--> v9 v9 --"p:direct/P1476"--> v10 v9 --"p:direct/P577"--> v3 bind6[/"?isolation_reference"/] v9 --o bind6 bind6 --as--o v11 bind7[/"?reference_title"/] v10 --o bind7 bind7 --as--o v12