IPCC-Queries

dpsir.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 DISTINCT ?driver ?driverLabel ?pressure ?pressureLabel ?state ?stateLabel ?impact ?impactLabel ?response ?responseLabel WITH {
  SELECT DISTINCT ?driver ?pressure ?state ?impact ?response WHERE {
    ?fact ^p:P3 / wdt:P1 wd:Q18 .
    OPTIONAL { ?fact pq:P18 ?driver ; pq:P19 ?pressure }
    OPTIONAL { ?fact pq:P19 ?pressure ; pq:P20 ?state }
    OPTIONAL { ?fact pq:P20 ?state ; pq:P10 ?impact }
    OPTIONAL { ?fact pq:P10 ?impact ; pq:P21 ?response }
  }
} AS %PARAGRAPHS WHERE {
  INCLUDE %PARAGRAPHS
  BIND (COALESCE(?driver, ?pressure, ?state, ?impact, ?response) AS ?someDPSIR)
  FILTER (BOUND(?someDPSIR))
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

run or edit

Output

driver pressure state impact response
volcanic aerosol emissions global surface temperature
volcanic greenhouse gas emission global surface temperature
solar aerosol emissions global surface temperature
solar greenhouse gas emission global surface temperature
human driver greenhouse gas emission
human activities greenhouse gas emission
human activities CO₂ emission
human activities aerosol emissions global surface temperature
human activities greenhouse gas emission concentrations of well-mixed GHG
human activities greenhouse gas emission global surface temperature
human activities CO₂ emission global surface temperature
human activities methane emission global surface temperature

Code examples

curl

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

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

This SPARQL query is available under CCZero.