Working With Metadata
The catalogue has a very simple data structure:
- On the highest level you have catalogues
- Each catalogue can contain datasets
- Each dataset holds distributions
- A distribution represents the actual data - aka hold a reference to the data
About RDF
The catalogue is based upon the Resource Description Framework. So you need to pass your payload always in a RDF format. The catalogue supports a variety of these formats, but we will focus on Turtle and JSON-LD. It is recommend that you make yourself familiar with RDF before using the catalogue API.
Access Control
Currently the API is protected with a simple API key. You can obtain it via contacting Fraunhofer FOKUS. You pass it in the header field X-API-Key. There is no fine-grained access control yet. So be careful and only work with your own data.
Managing Catalogues
First you need to create a catalogue.
Creating or Updating a Catalogue
PUT https://develop.pistis-market.eu/srv/repo/catalogues/<catalog-id>
Content-Type: text/turtle
X-API-Key: <api-key>
@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<https://piveau.io/id/catalogue/data-company>
a dcat:Catalog;
dct:creator <https://piveau.eu/def/creator>;
dct:description "The Data Company specializes in curated datasets for the education and public sectors."@en;
dct:issued "2023-01-18T06:33:36Z"^^<http://www.w3.org/2001/XMLSchema#dateTime>;
dct:modified "2023-01-18T06:33:36Z"^^<http://www.w3.org/2001/XMLSchema#dateTime>;
dct:language <http://publications.europa.eu/resource/authority/language/ENG>;
dct:spatial <http://publications.europa.eu/resource/authority/country/GRC>;
dct:title "The Data Company"@en;
dct:type "dcat-ap";
foaf:homepage <https://www.the-data-company.eu/> .
<https://piveau.eu/def/creator>
a foaf:Agent;
foaf:name "The Data Company" .
You will find your catalogue the here: https://develop.pistis-market.eu/srv/catalog/catalogues/<catalog-id>
Deleting a Catalogue
DELETE https://develop.pistis-market.eu/srv/repo/catalogues/<catalog-id>
X-API-Key: <api-key>
Managing Datasets
Creating a Dataset
If you have created a catalogue you can easily add datasets to it.
POST https://develop.pistis-market.eu/srv/repo/catalogues/<catalog-id>/datasets
Content-Type: text/turtle
X-API-Key: <api-key>
@prefix dcat: <http://www.w3.org/ns/dcat#> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix odrl: <http://www.w3.org/ns/odrl/2/> .
@prefix vcard: <http://www.w3.org/2006/vcard/ns#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
<https://piveau.io/set/data/test-dataset>
a dcat:Dataset ;
dct:description "Description of a Dataset"@en ;
dct:title "Title of a Dataset"@en ;
dcat:keyword "Engagement"@en, "Volunteerism"@en, "Stakeholders"@en, "Universities"@en, "Trends"@en ;
dct:publisher [ a foaf:Organization ;
foaf:mbox <mailto:email@publisher.eu> ;
foaf:name "Publisher Limited" ; ] ;
dcat:theme <http://publications.europa.eu/resource/authority/data-theme/EDUC> ;
dct:language <http://publications.europa.eu/resource/authority/language/ENG> ;
dct:issued "2023-05-25T00:00:00"^^xsd:dateTime ;
dct:modified "2023-05-25T00:00:00"^^xsd:dateTime ;
dcat:distribution <https://piveau.io/set/distribution/1> .
<https://piveau.io/set/distribution/1>
a dcat:Distribution ;
dct:title "Name of the actual File" ;
dct:license [
dct:identifier "SUB-LI" ;
dct:title "Subscription License" ;
skos:prefLabel "Subscription License" ;
skos:exactMatch <https://subscriptionlicense.com>
] ;
dct:format <http://publications.europa.eu/resource/authority/file-type/CSV> ;
dcat:byteSize "1288490189"^^xsd:nonNegativeInteger ;
dcat:accessURL <http://factory-storage/test-document_company2> .
The request will return you the UUID of your dataset, which you need for follow-up requests.
{
"id": "f1da9a7d-4f44-4511-8f8e-ff7b50ed0f5e"
}
Creating a Streaming Dataset
For streaming data, the access mechanism should be defined using a dcat:DataService within the distribution. Example:
POST https://develop.pistis-market.eu/srv/repo/catalogues/<catalog-id>/datasets
Content-Type: text/turtle
X-API-Key: <api-key>
<your-prefixes>
<your-dcat:Dataset>
<https://piveau.io/set/distribution/1>
a dcat:Distribution ;
dct:title "Kafka Stream Distribution" ;
dct:format <http://publications.europa.eu/resource/authority/file-type/CSV> ;
dcat:accessService [ rdf:type dcat:DataService;
dct:title "Kafka Stream"@en;
dcat:endpointDescription <https://example.com>;
dcat:endpointURL <https://develop.pistis-market.eu/srv/data-connector/api/provider/kafka/this-is-an-id-1234>
] .
Note that dcat:endpointDescription is a description of the services available via the end-points, including their operations, parameters etc. and it may be expressed in a machine‑readable form. If no such description exists, you may omit this property from your metadata. See: https://www.w3.org/TR/vocab-dcat-2/#Property:data_service_endpoint_description. More informations and examples about Data Services can be found here: https://www.w3.org/TR/vocab-dcat-3/#examples-data-service
Setting the Correct Format
The property dct:format MUST be set with the concept URI of the EU File Type Vocabulary. Some examples relevant for PISTIS:
- CSV: http://publications.europa.eu/resource/authority/file-type/CSV
- Database: http://publications.europa.eu/resource/authority/file-type/SQL
- Excel: http://publications.europa.eu/resource/authority/file-type/XLSX
Reading a Dataset
You get read your dataset with a simple GET request.
GET https://develop.pistis-market.eu/srv/repo/datasets/<dataset-id>
Accept: text/turtle
Updating a Dataset
You can update a dataset by performing a PUT request and adding the payload in the body.
PUT https://develop.pistis-market.eu/srv/repo/datasets/<dataset-id>
Content-Type: text/turtle
X-API-Key: <api-key>
<your-payload>
Deleting a Dataset
DELETE https://develop.pistis-market.eu/srv/repo/datasets/<dataset-id>
X-API-Key: <api-key>
Searching
Use the following endpoint to search for datasets: https://{factoryName}.pistis-market.eu/srv/search/
And please refer to this documentation for more information on searching for datasets.
