Skip to content

ckanext-dcat

Tests Code Coverage

Ckanext-dcat is a CKAN extension that helps data publishers expose and consume metadata as serialized RDF documents using DCAT, as well as other metadata formats like Croissant ML or Schema.org.

This extension is currently supported in CKAN 2.10 and CKAN 2.11.

{
    "id": "425e361b-bad9-4a8f-8cc4-2e147c4e8c18",
    "name": "my-ckan-dataset",
    "title": "An example CKAN dataset",
    "description": "Some notes about the data",
    "temporal_coverage": [
        {
            "start": "2024-01-01",
            "end": "2024-12-31"
        }
    ],
    "resources": [
        {
            "id": "df0fc449-fddf-41af-910a-f972b458956c",
            "name": "Some data in CSV format",
            "url": "http://my-ckan-site.org/dataset/425e361b-bad9-4a8f-8cc4-2e147c4e8c18/resource/df0fc449-fddf-41af-910a-f972b458956c/download/data.csv",
            "format": "CSV"
        }
    ]
}
@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .

<http://my-ckan-site.org/dataset/425e361b-bad9-4a8f-8cc4-2e147c4e8c18> a dcat:Dataset ;
    dct:identifier "425e361b-bad9-4a8f-8cc4-2e147c4e8c18" ;
    dct:temporal [ a dct:PeriodOfTime ;
            dcat:endDate "2024-12-31"^^xsd:date ;
            dcat:startDate "2024-01-01"^^xsd:date ] ;
    dct:title "An example CKAN dataset" ;
    dcat:distribution <http://my-ckan-site.org/dataset/425e361b-bad9-4a8f-8cc4-2e147c4e8c18/resource/df0fc449-fddf-41af-910a-f972b458956c> .

<http://my-ckan-site.org/dataset/425e361b-bad9-4a8f-8cc4-2e147c4e8c18/resource/df0fc449-fddf-41af-910a-f972b458956c> a dcat:Distribution ;
    dct:format "CSV" ;
    dct:title "Some data in CSV format" ;
    dcat:accessURL <http://my-ckan-site.org/dataset/425e361b-bad9-4a8f-8cc4-2e147c4e8c18/resource/df0fc449-fddf-41af-910a-f972b458956c/download/data.csv> .
{
  "@context": {
    "dcat": "http://www.w3.org/ns/dcat#",
    "dct": "http://purl.org/dc/terms/",
    "xsd": "http://www.w3.org/2001/XMLSchema#"
  },
  "@graph": [
    {
      "@id": "http://my-ckan-site.org/dataset/425e361b-bad9-4a8f-8cc4-2e147c4e8c18",
      "@type": "dcat:Dataset",
      "dcat:distribution": {
        "@id": "http://my-ckan-site.org/dataset/425e361b-bad9-4a8f-8cc4-2e147c4e8c18/resource/df0fc449-fddf-41af-910a-f972b458956c"
      },
      "dct:identifier": "425e361b-bad9-4a8f-8cc4-2e147c4e8c18",
      "dct:temporal": {
        "@id": "_:N1c32ba52ad1641d086101a4a4bcbe8a5"
      },
      "dct:title": "An example CKAN dataset"
    },
    {
      "@id": "_:N1c32ba52ad1641d086101a4a4bcbe8a5",
      "@type": "dct:PeriodOfTime",
      "dcat:endDate": {
        "@type": "xsd:date",
        "@value": "2024-12-31"
      },
      "dcat:startDate": {
        "@type": "xsd:date",
        "@value": "2024-01-01"
      }
    },
    {
      "@id": "http://my-ckan-site.org/dataset/425e361b-bad9-4a8f-8cc4-2e147c4e8c18/resource/df0fc449-fddf-41af-910a-f972b458956c",
      "@type": "dcat:Distribution",
      "dcat:accessURL": {
        "@id": "http://my-ckan-site.org/dataset/425e361b-bad9-4a8f-8cc4-2e147c4e8c18/resource/df0fc449-fddf-41af-910a-f972b458956c/download/data.csv"
      },
      "dct:format": "CSV",
      "dct:title": "Some data in CSV format"
    }
  ]
}

In terms of CKAN features, this extension offers:

  • Pre-built CKAN schemas for common Application Profiles that can be adapted to each site requirements to provide out-of-the-box DCAT support in data portals, including tailored form fields, validation etc. (currently supporting DCAT-AP v1.1, v2.1 and v3 and DCAT-US v3).

  • DCAT Endpoints that expose the catalog datasets in different RDF serializations (dcat plugin).

  • An RDF Harvester that allows importing RDF serializations from other catalogs to create CKAN datasets (dcat_rdf_harvester plugin).

  • Other features like Command Line Interface, support for indexing in Google Dataset Search or endpoints for exposing dataets in the Croissant ML format.

These are implemented internally using:

  • A base mapping between DCAT and CKAN datasets and viceversa (compatible with DCAT-AP v1.1, v2.1 and v3 and DCAT-US v3).

  • An RDF Parser that allows to read RDF serializations in different formats and extract CKAN dataset dicts, using customizable profiles.

  • An RDF Serializer that allows to transform CKAN datasets metadata to different semantic formats, also allowing customizable profiles.

  • URI Customization Interface that allows plugins to customize how URIs are generated for catalogs, datasets, resources, and publishers in RDF serializations.