query-a7f02f67473c3f2e537aed922b07ef90

rq turtle/ttl

title: Which organisms are known to contain stereoisomers of Beta-Sitosterol (Q121802)? SELECT ?taxon_name ?compound ?InChIKey WITH { SELECT ?queryKey ?srsearch ?filter WHERE { VALUES ?queryKey { "KZJWDPNRJALLNS-VJSFXXLFSA-N" # beta-sitosterol } BIND (CONCAT(substr($queryKey,1,14), " haswbstatement:P235") AS ?srsearch) BIND (CONCAT("^", substr($queryKey,1,14)) AS ?filter) } } AS %comps WITH { SELECT ?compound ?InChIKey WHERE { INCLUDE %comps SERVICE wikibase:mwapi { bd:serviceParam wikibase:endpoint "www.wikidata.org"; wikibase:api "Search"; mwapi:srsearch ?srsearch; mwapi:srlimit "max". ?compound wikibase:apiOutputItem mwapi:title. } ?compound wdt:P235 ?InChIKey . FILTER (REGEX(STR(?InChIKey), ?filter)) FILTER (?InChIKey != ?queryKey) } } AS %compounds WHERE { INCLUDE %compounds ?compound (wdt:P703/wdt:P225) ?taxon_name. } LIMIT 10000 title: Which organisms are known to contain stereoisomers of Beta-Sitosterol (Q121802)? SELECT ?taxon_name ?compound ?InChIKey WITH { SELECT ?queryKey ?srsearch ?filter WHERE { VALUES ?queryKey { "KZJWDPNRJALLNS-VJSFXXLFSA-N" # beta-sitosterol } BIND (CONCAT(substr($queryKey,1,14), " haswbstatement:P235") AS ?srsearch) BIND (CONCAT("^", substr($queryKey,1,14)) AS ?filter) } } AS %comps WITH { SELECT ?compound ?InChIKey WHERE { INCLUDE %comps SERVICE wikibase:mwapi { bd:serviceParam wikibase:endpoint "www.wikidata.org"; wikibase:api "Search"; mwapi:srsearch ?srsearch; mwapi:srlimit "max". ?compound wikibase:apiOutputItem mwapi:title. } ?compound wdt:P235 ?InChIKey . FILTER (REGEX(STR(?InChIKey), ?filter)) FILTER (?InChIKey != ?queryKey) } } AS %compounds WHERE { INCLUDE %compounds ?compound (wdt:P703/wdt:P225) ?taxon_name. } LIMIT 10000 title: Which organisms are known to contain stereoisomers of Beta-Sitosterol (Q121802)? SELECT ?taxon_name ?compound ?InChIKey WITH { SELECT ?queryKey ?srsearch ?filter WHERE { VALUES ?queryKey { "KZJWDPNRJALLNS-VJSFXXLFSA-N" # beta-sitosterol } BIND (CONCAT(substr($queryKey,1,14), " haswbstatement:P235") AS ?srsearch) BIND (CONCAT("^", substr($queryKey,1,14)) AS ?filter) } } AS %comps WITH { SELECT ?compound ?InChIKey WHERE { INCLUDE %comps SERVICE wikibase:mwapi { bd:serviceParam wikibase:endpoint "www.wikidata.org"; wikibase:api "Search"; mwapi:srsearch ?srsearch; mwapi:srlimit "max". ?compound wikibase:apiOutputItem mwapi:title. } ?compound wdt:P235 ?InChIKey . FILTER (REGEX(STR(?InChIKey), ?filter)) FILTER (?InChIKey != ?queryKey) } } AS %compounds WHERE { INCLUDE %compounds ?compound (wdt:P703/wdt:P225) ?taxon_name. } LIMIT 10000 title: Which organisms are known to contain stereoisomers of Beta-Sitosterol (Q121802)? SELECT ?taxon_name ?compound ?InChIKey WITH { SELECT ?queryKey ?srsearch ?filter WHERE { VALUES ?queryKey { "KZJWDPNRJALLNS-VJSFXXLFSA-N" # beta-sitosterol } BIND (CONCAT(substr($queryKey,1,14), " haswbstatement:P235") AS ?srsearch) BIND (CONCAT("^", substr($queryKey,1,14)) AS ?filter) } } AS %comps WITH { SELECT ?compound ?InChIKey WHERE { INCLUDE %comps SERVICE wikibase:mwapi { bd:serviceParam wikibase:endpoint "www.wikidata.org"; wikibase:api "Search"; mwapi:srsearch ?srsearch; mwapi:srlimit "max". ?compound wikibase:apiOutputItem mwapi:title. } ?compound wdt:P235 ?InChIKey . FILTER (REGEX(STR(?InChIKey), ?filter)) FILTER (?InChIKey != ?queryKey) } } AS %compounds WHERE { INCLUDE %compounds ?compound (wdt:P703/wdt:P225) ?taxon_name. } LIMIT 10000 title: Which organisms are known to contain stereoisomers of Beta-Sitosterol (Q121802)? SELECT ?taxon_name ?compound ?InChIKey WITH { SELECT ?queryKey ?srsearch ?filter WHERE { VALUES ?queryKey { "KZJWDPNRJALLNS-VJSFXXLFSA-N" # beta-sitosterol } BIND (CONCAT(substr($queryKey,1,14), " haswbstatement:P235") AS ?srsearch) BIND (CONCAT("^", substr($queryKey,1,14)) AS ?filter) } } AS %comps WITH { SELECT ?compound ?InChIKey WHERE { INCLUDE %comps SERVICE wikibase:mwapi { bd:serviceParam wikibase:endpoint "www.wikidata.org"; wikibase:api "Search"; mwapi:srsearch ?srsearch; mwapi:srlimit "max". ?compound wikibase:apiOutputItem mwapi:title. } ?compound wdt:P235 ?InChIKey . FILTER (REGEX(STR(?InChIKey), ?filter)) FILTER (?InChIKey != ?queryKey) } } AS %compounds WHERE { INCLUDE %compounds ?compound (wdt:P703/wdt:P225) ?taxon_name. } LIMIT 10000 title: Which organisms are known to contain stereoisomers of Beta-Sitosterol (Q121802)? SELECT ?taxon_name ?compound ?InChIKey WITH { SELECT ?queryKey ?srsearch ?filter WHERE { VALUES ?queryKey { "KZJWDPNRJALLNS-VJSFXXLFSA-N" # beta-sitosterol } BIND (CONCAT(substr($queryKey,1,14), " haswbstatement:P235") AS ?srsearch) BIND (CONCAT("^", substr($queryKey,1,14)) AS ?filter) } } AS %comps WITH { SELECT ?compound ?InChIKey WHERE { INCLUDE %comps SERVICE wikibase:mwapi { bd:serviceParam wikibase:endpoint "www.wikidata.org"; wikibase:api "Search"; mwapi:srsearch ?srsearch; mwapi:srlimit "max". ?compound wikibase:apiOutputItem mwapi:title. } ?compound wdt:P235 ?InChIKey . FILTER (REGEX(STR(?InChIKey), ?filter)) FILTER (?InChIKey != ?queryKey) } } AS %compounds WHERE { INCLUDE %compounds ?compound (wdt:P703/wdt:P225) ?taxon_name. } LIMIT 10000

Use at

PREFIX mwapi: <http://wikiba.se/ontology#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title: Which organisms are known to contain stereoisomers of Beta-Sitosterol (Q121802)?
SELECT ?taxon_name ?compound ?InChIKey WHERE {
   {
  SELECT ?compound ?InChIKey WHERE {
     {
  SELECT ?queryKey ?srsearch ?filter WHERE {
    VALUES ?queryKey {
      "KZJWDPNRJALLNS-VJSFXXLFSA-N" # beta-sitosterol
    }
    BIND (CONCAT(substr($queryKey,1,14), " haswbstatement:P235") AS ?srsearch)
    BIND (CONCAT("^", substr($queryKey,1,14)) AS ?filter)
  }
}            SERVICE wikibase:mwapi {
              bd:serviceParam wikibase:endpoint "www.wikidata.org";
                              wikibase:api "Search";
                              mwapi:srsearch ?srsearch;
                              mwapi:srlimit "max".
              ?compound wikibase:apiOutputItem mwapi:title.
            }
    ?compound wdt:P235 ?InChIKey .
    FILTER (REGEX(STR(?InChIKey), ?filter))
    FILTER (?InChIKey != ?queryKey)
  }
}          ?compound (wdt:P703/wdt:P225) ?taxon_name.
}
LIMIT 10000

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?InChIKey"):::projected v5("?compound"):::projected v5("?filter") v4("?queryKey") v4("?srsearch") v6("?taxon_name"):::projected a1((" ")) c4(["www.wikidata.org"]):::literal c9(["max"]):::literal c2(["bd:serviceParam"]):::iri c6(["Search"]):::literal c11(["mwapi:title"]):::iri f0[["?InChIKey != ?queryKey"]] f0 --> v1 f0 --> v4 f1[["regex(str(?InChIKey),?filter)"]] f1 --> v1 f1 --> v5 bind2[/VALUES ?queryKey/] bind2-->v4 bind20(["KZJWDPNRJALLNS-VJSFXXLFSA-N"]) bind20 --> bind2 bind3[/"concat(substring(?queryKey,'1^^xsd:integer','14^^xsd:integer'),' haswbstatement:P235')"/] v4 --o bind3 bind3 --as--o v4 bind4[/"concat('^',substring(?queryKey,'1^^xsd:integer','14^^xsd:integer'))"/] v4 --o bind4 bind4 --as--o v5 subgraph s1["http://wikiba.se/ontology#mwapi"] style s1 stroke-width:4px; c2 --"mwapi:endpoint"--> c4 c2 --"mwapi:api"--> c6 c2 --"mwapi:srsearch"--> v4 c2 --"mwapi:srlimit"--> c9 v5 --"mwapi:apiOutputItem"--> c11 end v5 --"wdt:P235"--> v1 v5 --"wdt:P703"--> a1 a1 --"wdt:P225"--> v6