lotus-sparql-examples

A set of SPARQL examples that are used in LOTUS

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

wd_maintenance_chemicals_smiles_canonical_no_formula

rq turtle/ttl

Chemicals with canonical SMILES but no formula.

Use at


PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
#title: Chemicals with canonical SMILES but no formula
SELECT ?structure ?smiles WHERE {
    VALUES ?classes {
        wd:Q113145171
        wd:Q59199015
    }
    ?structure wdt:P233 ?smiles.
    ?structure wdt:P31 ?classes.
    OPTIONAL { ?structure wdt:P274 ?formula. }
    FILTER(!(BOUND(?formula)))
}

graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v2("?classes")
  v1("?formula")
  v4("?smiles"):::projected 
  v3("?structure"):::projected 
  f0[["not bound(?formula)"]]
  f0 --> v1
  bind1[/VALUES ?classes/]
  bind1-->v2
  bind10(["wd:Q113145171"])
  bind10 --> bind1
  bind11(["wd:Q59199015"])
  bind11 --> bind1
  v3 --"wdt:P233"-->  v4
  v3 --"wdt:P31"-->  v2
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v3 -."wdt:P274".->  v1
  end