lotus-sparql-examples

A set of SPARQL examples that are used in LOTUS

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

wd_chemicals_smiles_canonical_no_ref

rq turtle/ttl

Chemicals with canonical SMILES without ref.

Use at


# PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
# PREFIX pr: <http://www.wikidata.org/prop/reference/>
PREFIX prov: <http://www.w3.org/ns/prov#>
#title: Chemicals with canonical SMILES without ref
SELECT * WHERE {
    ?structure p:P233 ?stmt.
    OPTIONAL { ?stmt prov:wasDerivedFrom ?ref. }
    FILTER(!(BOUND(?ref)))
    ?stmt ps:P233 ?smiles_canonical.
}

# SELECT * WHERE {
#   ?structure p:P233 ?stmt.
#   ?stmt ps:P233 ?smiles.
#   ?stmt (prov:wasDerivedFrom/pr:P887) wd:Q123137214.
# }

graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
  v1("?ref"):::projected 
  v4("?smiles_canonical"):::projected 
  v3("?stmt"):::projected 
  v2("?structure"):::projected 
  f0[["not bound(?ref)"]]
  f0 --> v1
  v2 --"p:P233"-->  v3
  subgraph optional0["(optional)"]
  style optional0 fill:#bbf,stroke-dasharray: 5 5;
    v3 -."prov:wasDerivedFrom".->  v1
  end
  v3 --"p:statement/P233"-->  v4