query-1d8ca6d65be06cb1c5c5661b3ee5680f

rq turtle/ttl

SPARQL query parsing values of string propertyCurrently we use 2 systems to describe element composition of chemicals, the chemical formula and the element composition based on several statements using "has part" property. Some contributors propose to use the chemical formula to derive the element composition. The question is then: is it possible ? 21:57, 19 October 2017 (UTC)) talk (Snipre statement and 2) then to parse the value of this statement to look for the "Cl" substring. But how can we write that ?(P274)chemical formula For example how can we extract the items of chemicals having a chlorine atom based on the chemical formula property ? Thanks for your help ? This require to 1) extract all items of chemicals having a

Use at

PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
SELECT ?compound ?formula WHERE {
  ?compound wdt:P31 wd:Q11173 ;
            wdt:P274 ?formula.
  FILTER(CONTAINS(?formula, "Cl")).
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?compound"):::projected v1("?formula"):::projected c3(["wd:Q11173"]):::iri f0[["contains(?formula,'Cl')"]] f0 --> v1 v2 --"wdt:P31"--> c3 v2 --"wdt:P274"--> v1