IPCC-Queries

chemicals.rq

Code examples: curl

SPARQL

PREFIX wdt: <https://kg-ipclimatec-reports.wikibase.cloud/prop/direct/>
PREFIX wd:  <https://kg-ipclimatec-reports.wikibase.cloud/entity/>
PREFIX p:   <https://kg-ipclimatec-reports.wikibase.cloud/prop/>
PREFIX pq:  <https://kg-ipclimatec-reports.wikibase.cloud/prop/qualifier/>

SELECT ?chemical ?chemicalLabel (COUNT(DISTINCT ?statement) AS ?count) WHERE {
  ?paragraph p:P3 ?statement .
  { ?statement pq:P12 ?chemical }
  UNION
  { ?statement pq:P19 ?pressure . ?pressure p:P6 / pq:P22 ?chemical . }
  ?chemical wdt:P1 wd:Q68 .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} GROUP BY ?chemical ?chemicalLabel
  ORDER BY DESC(?count)

run or edit

Output

chemical count
greenhouse gas 9
CO₂ 6
methane 5
aerosol 2
ozone 2
nitrous oxide 2
halogenated gas 1
fluorinated gas 1
hydrofluorocarbon 1

Code examples

curl

curl -s https://raw.githubusercontent.com/egonw/IPCC-Queries/master/sparql/chemicals.rq \
  | sed 's+<lang/>+en+' > chemicals.rq

curl -H "Accept: text/tab-separated-values" \
  -G https://kg-ipclimatec-reports.wikibase.cloud/query/sparql \
  --data-urlencode query@chemicals.rq

This SPARQL query is available under CCZero.