lotus-sparql-examples

A set of SPARQL examples that are used in LOTUS

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

wd_nps_bioactivity_grouped_scholarly_subgraph

rq turtle/ttl

Bioactive compounds isolated from Actinomycetes (Q62606918), between 2014 and 2019, with related taxa and references (grouped).

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 rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdsubgraph: <https://query.wikidata.org/subgraph/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
#title: Bioactive compounds isolated from Actinomycetes (Q62606918), between 2014 and 2019, with related taxa and references (grouped).
SELECT ?taxon ?taxon_name ?compound ?compound_smiles (GROUP_CONCAT(DISTINCT ?meshLabel; SEPARATOR = "|") AS ?bioactivities) ?isolation_reference ?reference_title WHERE {
    ?taxon (wdt:P171*) wd:Q62606918;
    wdt:P225 ?taxon_name.
    ?compound wdt:P235 ?compound_id;
    wdt:P233 ?compound_smiles;
    p:P703 ?statement;
    (wdt:P2868/wdt:P486) ?meshId.
    ?mesh wdt:P486 ?meshId;
    rdfs:label ?meshLabel.
    FILTER(LANGMATCHES(LANG(?meshLabel), "EN"))
    ?statement ps:P703 ?taxon;
    prov:wasDerivedFrom ?ref.
    ?ref pr:P248 ?isolation_reference.
    SERVICE wdsubgraph:scholarly_articles {
      ?isolation_reference wdt:P1476 ?reference_title;
      wdt:P577 ?reference_date.
    }
    FILTER(((YEAR(?reference_date)) >= 2014 ) && ((YEAR(?reference_date)) <= 2019 ))
}
GROUP BY ?taxon ?taxon_name ?compound ?compound_smiles ?isolation_reference ?reference_title
LIMIT 10000

graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v14("?bioactivities")
  v5("?compound"):::projected 
  v6("?compound_id")
  v7("?compound_smiles"):::projected 
  v12("?isolation_reference"):::projected 
  v10("?mesh")
  v9("?meshId")
  v2("?meshLabel"):::projected 
  v11("?ref")
  v1("?reference_date")
  v13("?reference_title"):::projected 
  v8("?statement")
  v3("?taxon"):::projected 
  v4("?taxon_name"):::projected 
  a1((" "))
  c5(["wd:Q62606918"]):::iri 
  f0[["year-from-dateTime(?reference_date) >= '2014^^xsd:integer'year-from-dateTime(?reference_date) <= '2019^^xsd:integer'"]]
  f0 --> v1
  f1[["langmatch(?meshLabel,'EN')"]]
  f1 --> v2
  v3 --"p:direct/P171"-->  c5
  v3 --"p:direct/P225"-->  v4
  v5 --"p:direct/P235"-->  v6
  v5 --"p:direct/P233"-->  v7
  v5 --"p:P703"-->  v8
  v5 --"p:direct/P2868"-->  a1
  a1 --"p:direct/P486"-->  v9
  v10 --"p:direct/P486"-->  v9
  v10 --"rdfs:label"-->  v2
  v8 --"p:statement/P703"-->  v3
  v8 --"prov:wasDerivedFrom"-->  v11
  v11 --"p:reference/P248"-->  v12
  subgraph s1["https://query.wikidata.org/subgraph/scholarly_articles"]
    style s1 stroke-width:4px;
    v12 --"p:direct/P1476"-->  v13
    v12 --"p:direct/P577"-->  v1
  end
  bind3[/"?meshLabel"/]
  v2 --o bind3
  bind3 --as--o v14