RDF and CKAN
From CKAN
This page is outdated and needs to be rewritten. Please use ckanext-rdf to support RDF export in CKAN.
Background: Describing Data/Content Packages
There are various vocabularies that can be used for describing data and content packages (aka datasets ...):
- Dublin core: these are the most well-known and basic. Dublin core terms includes the class dct:Dataset.
- DCAT - vocabulary for catalogues of datasets
- VoID - vocabulary of interlinked datasets. Specifically designed for describing rdf datasets. Perfect except for the fact that it is focused on RDF
- SCOVO: this is more oriented to statistical datasets but has a scovo:Dataset class.
At the present CKAN uses mostly DCAT and Dublin Core.
What CKAN.net does
All CKAN.net dataset metadata is converted regularly to RDF and stored in a dedicated triple store at http://semantic.ckan.net/
In addition we provide pointers into http://semantic.ckan.net/ from http://ckan.net/ via a rel=alternative redirect and 303 on the Accept header, e.g try out:
curl -L -H "Accept: application/rdf+xml" http://thedatahub.org/dataset/2000-us-census-rdf curl -L -H "Accept: text/n3" http://thedatahub.org/dataset/2000-us-census-rdf
As an example of the RDF, the RDF for the CKAN dataset http://thedatahub.org/dataset/2000-us-census-rdf/ is provided below. You can also view a human-readable version here: http://semantic.ckan.net/data/2000-us-census-rdf.
The python script that converts CKAN data to RDF can be found here: http://bitbucket.org/ww/ckanrdf
@prefix foaf: <http://xmlns.com/foaf/spec/> .
@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix rev: <http://purl.org/stuff/rev#> .
@prefix dc: <http://purl.org/dc/terms/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://semantic.ckan.net/data/2000-us-census-rdf> a <http://www.w3.org/ns/dcat#CatalogRecord>;
dc:modified "2010-05-21T22:27:30.858368"^^xsd:dateTime;
dc:publisher <http://ckan.net/>;
rdfs:comment "Generated with ckanrdf hg-24-ef1dbbd85a21";
dcat:dataset <http://thedatahub.org/dataset/2000-us-census-rdf> .
<http://semantic.ckan.net/data/2000-us-census-rdf#author> rdfs:comment "TODO: proper URI for author";
foaf:name "http://razor.occams.info/" .
<http://thedatahub.org/dataset/2000-us-census-rdf> a <http://www.w3.org/ns/dcat#Dataset>;
rdfs:label "The 2000 US Census: 1 Billion RDF Triples";
dc:creator <http://semantic.ckan.net/data/2000-us-census-rdf#author>;
dc:description """2000 U.S. Census converted into over a billion RDF triples.
Population statistics at various geographic levels, from the U.S. as a whole, down through states, counties, sub-counties (roughly, cities and incorporated towns)
Notes: also found in the of SPARQL Endpoints.
From home page:
> * For the detailed Census statistics, you'll have to download the raw Census data files from the Census Bureau, my Perl script and the patch file below and run it yourself because the files are too big for me to offer as a download!
>
> * The data and scripts can be reused under Creative Commons Attribution-NonCommercial-ShareAlike.""";
dc:identifier "2000-us-census-rdf";
dc:title "The 2000 US Census: 1 Billion RDF Triples";
rev:rating 4.33333333333;
= <urn:uuid:551ec435-f198-4d52-9b56-ec0b0be6aec9>;
dcat:distribution <http://www.rdfabout.com/demo/census/>;
dcat:keyword "census",
"data",
"demographics",
"format-rdf",
"linkeddata",
"lod",
"population",
"rdf",
"statistics",
"us";
foaf:homepage <http://www.rdfabout.com/demo/census/> .
RDF in the CKAN software
Getting an RDF export of your own CKAN installation requires either (1) hacking something similar to the above, using the ckanrdf script referenced above; or (2) (a more basic RDF representation, but less work) installing the ckanext-rdf extension from https://github.com/okfn/ckanext-rdf .