lotus-sparql-examples

A set of SPARQL examples that are used in LOTUS

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

wd_taxa_from_stereoisomers_qid

rq turtle/ttl

Taxa containing stereoisomers of Beta-Sitosterol (Q121802).

Use at


PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
#title: Taxa containing stereoisomers of Beta-Sitosterol (Q121802).
SELECT ?taxon_name ?compound ?InChIKey WHERE {
    VALUES ?target {
        wd:Q121802
    }
    ?target wdt:P235 ?queryKey.
    ?compound wdt:P235 ?InChIKey.
    FILTER (REGEX(STR(?InChIKey), CONCAT("^", SUBSTR($queryKey,1,14), "-")))
    FILTER (?InChIKey != ?queryKey)
    ?compound (wdt:P703/wdt:P225) ?taxon_name.
}
LIMIT 10000
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?InChIKey"):::projected 
  v4("?compound"):::projected 
  v2("?queryKey")
  v3("?target")
  v5("?taxon_name"):::projected 
  a1((" "))
  f0[["?InChIKey != ?queryKey"]]
  f0 --> v1
  f0 --> v2
  f1[["regex(str(?InChIKey),concat('^',substring(?queryKey,'1^^xsd:integer','14^^xsd:integer'),'-'))"]]
  f1 --> v1
  f1 --> v2
  bind2[/VALUES ?target/]
  bind2-->v3
  bind20(["wd:Q121802"])
  bind20 --> bind2
  v3 --"wdt:P235"-->  v2
  v4 --"wdt:P235"-->  v1
  v4 --"wdt:P703"-->  a1
  a1 --"wdt:P225"-->  v5