lotus-sparql-examples

A set of SPARQL examples that are used in LOTUS

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

wd_nps_source_marine

rq turtle/ttl

Compounds found in marine taxa and their references.

Use at


PREFIX hint: <http://www.bigdata.com/queryHints#>
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 found in marine taxa and their references.
SELECT DISTINCT ?compound ?compound_smiles ?reference ?reference_title ?reference_doi WHERE {
    {
        SELECT ?child WHERE {
            { ?child (wdt:P171*) wd:Q152. }    # fishes
            UNION
            { ?child (wdt:P171*) wd:Q93315. }  # cyanobacteria
            UNION
            { ?child (wdt:P171*) wd:Q103169. } # red algae
            UNION
            { ?child (wdt:P171*) wd:Q264543. } # chlorohyta
            UNION
            { ?child (wdt:P171*) wd:Q18960. }  # sponges
            UNION
            { ?child (wdt:P171*) wd:Q28524. }  # corals
        }
    }
    hint:Prior hint:runFirst true.
    ?compound wdt:P233 ?compound_smiles;
    p:P703[
    ps:P703 ?child;
    (prov:wasDerivedFrom/pr:P248) ?reference ].
    ?reference wdt:P356 ?reference_doi;
    wdt:P1476 ?reference_title.
}

graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?child")
  v2("?compound"):::projected 
  v3("?compound_smiles"):::projected 
  v4("?reference"):::projected 
  v5("?reference_doi"):::projected 
  v6("?reference_title"):::projected 
  a1((" "))
  a2((" "))
  c7(["wd:Q28524"]):::iri 
  c8([http://www.bigdata.com/queryHints#Prior]):::iri 
  c4(["wd:Q103169"]):::iri 
  c2(["wd:Q152"]):::iri 
  c6(["wd:Q18960"]):::iri 
  c10(["true^^xsd:boolean"]):::literal 
  c3(["wd:Q93315"]):::iri 
  c5(["wd:Q264543"]):::iri 
  subgraph union0[" Union "]
  subgraph union0l[" "]
    style union0l fill:#abf,stroke-dasharray: 3 3;
    subgraph union1[" Union "]
    subgraph union1l[" "]
      style union1l fill:#abf,stroke-dasharray: 3 3;
      subgraph union2[" Union "]
      subgraph union2l[" "]
        style union2l fill:#abf,stroke-dasharray: 3 3;
        subgraph union3[" Union "]
        subgraph union3l[" "]
          style union3l fill:#abf,stroke-dasharray: 3 3;
          subgraph union4[" Union "]
          subgraph union4l[" "]
            style union4l fill:#abf,stroke-dasharray: 3 3;
            v1 --"p:direct/P171"-->  c7
          end
          subgraph union4r[" "]
            style union4r fill:#abf,stroke-dasharray: 3 3;
            v1 --"p:direct/P171"-->  c6
          end
          union4r <== or ==> union4l
          end
        end
        subgraph union3r[" "]
          style union3r fill:#abf,stroke-dasharray: 3 3;
          v1 --"p:direct/P171"-->  c5
        end
        union3r <== or ==> union3l
        end
      end
      subgraph union2r[" "]
        style union2r fill:#abf,stroke-dasharray: 3 3;
        v1 --"p:direct/P171"-->  c4
      end
      union2r <== or ==> union2l
      end
    end
    subgraph union1r[" "]
      style union1r fill:#abf,stroke-dasharray: 3 3;
      v1 --"p:direct/P171"-->  c3
    end
    union1r <== or ==> union1l
    end
  end
  subgraph union0r[" "]
    style union0r fill:#abf,stroke-dasharray: 3 3;
    v1 --"p:direct/P171"-->  c2
  end
  union0r <== or ==> union0l
  end
  c8 --http://www.bigdata.com/queryHints#runFirst-->  c10
  v2 --"p:direct/P233"-->  v3
  a1 --"p:statement/P703"-->  v1
  a1 --"prov:wasDerivedFrom"-->  a2
  a2 --"p:reference/P248"-->  v4
  v2 --"p:P703"-->  a1
  v4 --"p:direct/P356"-->  v5
  v4 --"p:direct/P1476"-->  v6