A set of SPARQL examples that are used in LOTUS
Chemicals with malformed chemical formula.
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
#title: Chemicals with malformed chemical formula
SELECT DISTINCT ?structure ?formula ?smiles WHERE {
    VALUES ?classes {
        wd:Q113145171
        wd:Q59199015
    }
    ?structure wdt:P274 ?formula.
    ?structure wdt:P233 ?smiles.
    ?structure wdt:P31 ?classes.
    wd:P274 wdt:P1793 ?constraint.
    FILTER(REPLACE(?formula, ?constraint, "") != "")
}
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v3("?classes")
  v2("?constraint")
  v1("?formula"):::projected 
  v5("?smiles"):::projected 
  v4("?structure"):::projected 
  c5(["wd:P274"]):::iri 
  f0[["replace(?formula,?constraint,'') != ''"]]
  f0 --> v1
  f0 --> v2
  bind1[/VALUES ?classes/]
  bind1-->v3
  bind10(["wd:Q113145171"])
  bind10 --> bind1
  bind11(["wd:Q59199015"])
  bind11 --> bind1
  v4 --"wdt:P274"-->  v1
  v4 --"wdt:P233"-->  v5
  v4 --"wdt:P31"-->  v3
  c5 --"wdt:P1793"-->  v2