Skip to content

Data cleaning steps and mappings used to transform data from different sources to RDF

License

Notifications You must be signed in to change notification settings

TEC-Toolkit/cfkg

Repository files navigation

Conversion factor Knowledge Graph

DOI

This repository contains the data cleaning steps and mappings of the conversion factor knowledge graph. At the moment, public data includes:

  • BEIS-UK, from years 2016-2022

    • Data is licensed under an Open Government license
    • Each data source used is linked in each conversion factor in the KG
  • Machine Learning impact calculator, from years 2002-2018

    • Data is licensed under a MIT license
    • Each data source used is linked in each conversion factor in the KG

Work in progress:

  • EPA

Query interface

A derreferenceable linked data browser is available at: https://query.cf.linkeddata.es/query, based on https://github.com/TEC-Toolkit/rdf_explorer.

To see information about a conversion factor, just click on its URL, e.g., https://w3id.org/ecfkg/i/UK/BEIS/2021/CF_1.

SPARQL endpoint

All data is loaded in https://sparql.cf.linkeddata.es/cf, in the cf dataset. To perform a query, just URL encode the query:

curl https://sparql.cf.linkeddata.es/cf -X POST --data 'query=YOUR_QUERY_URL_ENCODED' -H 'Accept: application/sparql-results+json,*/*;q=0.9'

For example, the following query retrieves the conversion factors that involve "Butane" (and their corresponding basic metadata)

SPARQL:

PREFIX ecfo: <https://w3id.org/ecfo#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT  ?cf ?source ?context ?target ?scope
WHERE {
    ?cf ecfo:hasTag/rdfs:label "Butane"@en.
    ?cf ecfo:hasEmissionTarget/rdfs:label ?target.
    ?cf ecfo:hasEmissionSource/rdfs:label ?source.
    ?cf ecfo:hasAdditionalContext ?context.
    ?cf ecfo:hasScope ?scope.
}

Corresponding curl command:

curl https://sparql.cf.linkeddata.es/cf -X POST --data 'query=PREFIX+ecfo%3A+%3Chttps%3A%2F%2Fw3id.org%2Fecfo%23%3E%0APREFIX+rdfs%3A+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%0A%0Aselect++%3Fcf+%3Fsource+%3Fcontext+%3Ftarget+%3Fscope+where%7B%0A++++%3Fcf+ecfo%3AhasTag%2Frdfs%3Alabel+%22Butane%22%40en.%0A++++%3Fcf+ecfo%3AhasEmissionTarget%2Frdfs%3Alabel+%3Ftarget.%0A++++%3Fcf+ecfo%3AhasEmissionSource%2Frdfs%3Alabel+%3Fsource.%0A++++%3Fcf+ecfo%3AhasAdditionalContext+%3Fcontext.%0A++++%3Fcf+ecfo%3AhasScope+%3Fscope.%0A%7D' -H 'Accept: application/sparql-results+json,*/*;q=0.9'

Tutorial

Have a look at our tutorial, showing how to plot the evolution of a conversion factor through the years, together with the corresponding SPARQL queries needed to adapt it to your own.

Contributing

Please read CONTRIBUTING.md for details on the process for submitting pull requests to this repository.