Managing Distributions

Distributions constitute the connection the actual data stored in the Data Storage.

Adding a Distribution

Any modified, enriched or updated version of the data should be represented as an additional distribution. You can easily add one via a simple API call. The following is an example of a POST request to do it:

Turtle
PUT https://develop.pistis-market.eu/srv/repo/datasets/<dataset-id>/distributions
Content-Type: text/turtle
X-API-Key: <api-key>

@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix dcterms: <http://purl.org/dc/terms/> .

<https://piveau.io/set/new-distribution/>
    a dcat:Distribution ;
    dcterms:format <http://publications.europa.eu/resource/authority/file-type/CSV> ;
    dcterms:title "Name of the Additional Distribution" ;
    dcat:accessURL <http://factory-storage/anonymized-data.csv> .
JSON-LD
PUT https://develop.pistis-market.eu/srv/repo/datasets/<dataset-id>/distributions
Content-Type: application/ld+json
X-API-Key: <api-key>

{
  "@context": {
    "dcat": "http://www.w3.org/ns/dcat#",
    "dcterms": "http://purl.org/dc/terms/"
  },
  "@graph": [
    {
      "@id": "https://piveau.io/set/new-distribution/",
      "@type": "dcat:Distribution",
      "dcterms:format": {
        "@id": "http://publications.europa.eu/resource/authority/file-type/CSV"
      },
      "dcterms:title": "Name of the Additional Distribution",
      "dcat:accessURL": {
        "@id": "http://factory-storage/anonymized-data.csv"
      }
    }
  ]
}

You need to put the link to the Data Storage in dcat:accessURL. The format must be specified with dcterms:format, using the concept URI of the EU File Type Vocabulary. In dcterms:title you should give your file a nice and expressive title. More available properties can be found here: https://semiceu.github.io/DCAT-AP/releases/3.0.0/#Distribution

The URI of the Distribution <https://piveau.io/set/new-distribution/> has no meaning and can be freely chosen. It will automatically be transformed into the correct format.

You get check the result with getting the dataset or by browsing the catalog UI.

Turtle
GET https://develop.pistis-market.eu/srv/repo/datasets/<dataset-id>
Accept: text/turtle
JSON-LD
GET https://develop.pistis-market.eu/srv/repo/datasets/<dataset-id>
Accept: application/ld+json

Processing a Distribution

A distribution may be transformed, encrypted, and/or anonymized as needed. In such cases, it should be updated to include the relevant properties that reflect these changes. The following PUT request example updates a distribution and mark it as anonymized:

Turtle
PUT https://develop.pistis-market.eu/srv/repo/distributions/<distribution-id>
Content-Type: application/ld+json
X-API-Key: <api-key>

@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix dcterms: <http://purl.org/dc/terms/> .
@prefix pst: <https://www.pistis-project.eu/ns/voc#> .

<https://piveau.io/set/new-distribution/>
    a dcat:Distribution ;
    dcterms:format <http://publications.europa.eu/resource/authority/file-type/CSV> ;
    dcterms:title "Name of the Additional Distribution" ;
    dcat:accessURL <http://factory-storage/anonymized-data.csv> ;
    pst:isAnonymized true .
JSON-LD
PUT https://develop.pistis-market.eu/srv/repo/distributions/<distribution-id>
Content-Type: application/ld+json
X-API-Key: <api-key>

{
  "@context": {
    "dcat": "http://www.w3.org/ns/dcat#",
    "dcterms": "http://purl.org/dc/terms/",
    "pst": "https://www.pistis-project.eu/ns/voc#"
  },
  "@graph": [
    {
      "@id": "https://piveau.io/set/new-distribution/",
      "@type": "dcat:Distribution",
      "dcterms:format": {
        "@id": "http://publications.europa.eu/resource/authority/file-type/CSV"
      },
      "dcterms:title": "Name of the Additional Distribution",
      "dcat:accessURL": {
        "@id": "http://factory-storage/anonymized-data.csv"
      },
      "pst:isAnonymized": {
        "@type": "http://www.w3.org/2001/XMLSchema#boolean",
        "@value": "true"
      }
    }
  ]
}

Use

  • pst:isTransformed to indicate that a distribution has been transformed
  • pst:isEncrypted to denote encryption
  • pst:isAnonymized to denote anonymization

All properties are boolean and should be set to true or false to reflect the status. If they are omitted, the value is implicitly treated as false.