User:Iwan.Aucamp/fixes

From Wikidata
Jump to navigation Jump to search

Make items with schema:description "hazardous chemical exposure" that is subclass of chemical hazard (Q21167512) subclasses of hazardous chemical exposure (Q68182219)[edit]

Items that will be updated:

SELECT ?condition ?conditionLabel ?conditionDescrption WHERE {
  ?condition wdt:P279+ wd:Q21167512.
  ?condition schema:description ?conditionDescrption.
  FILTER(LANG(?conditionDescrption) = "en").
  FILTER(STRSTARTS(?conditionDescrption, "hazardous chemical exposure"))
  OPTIONAL { ?condition rdfs:label ?conditionLabel FILTER(LANG(?conditionLabel) = "en") }
}
Try it!


curl -H 'Accept:text/csv' https://query.wikidata.org/sparql --data-urlencode query='SELECT ?condition ?conditionLabel ?conditionDescrption WHERE {
  ?condition wdt:P279+ wd:Q21167512.
  ?condition schema:description ?conditionDescrption.
  FILTER(LANG(?conditionDescrption) = "en").
  FILTER(STRSTARTS(?conditionDescrption, "hazardous chemical exposure"))
  OPTIONAL { ?condition rdfs:label ?conditionLabel FILTER(LANG(?conditionLabel) = "en") }
}' | gawk -F, '{ print gensub("^.+/", "", "g", $1) }' | xargs -I{} echo wd add-claim {} P279 Q68182219