FAIR Data Point API Client

fairdatapoint-client is a simple and elegant library to interact with FAIR Data Point resources from Python, e.g. read and write catalogs, datasets and distributions in an FDP server.

The supported APIs are listed below:

FDP Layers

Path Endpoint

Specific Resource Endpoint

fdp

[baseURL] or [baseURL]/fdp

catalog

[baseURL]/catalog

[baseURL]/catalog/[catalogID]

dataset

[baseURL]/dataset

[baseURL]/dataset/[datasetID]

distribution

[baseURL]/distribution

[baseURL]/distribution/[distributionID]

Quick Start

Using Client

from fdpclient.client import Client

# create a client with base URL
client = Client('http://example.org')

# create metadata
with open('catalog01.ttl') as f:
    data = f.read()
client.create_catalog(data)

# let's assume the catalogID was assigned as 'catalog01'
# read metadata, return a RDF graph
r = client.read_catalog('catalog01')
print(r.serialize(format="turtle").decode("utf-8"))

# update metadata
with open('catalog01_update.ttl') as f:
    data_update = f.read()
client.update_catalog('catalog01', data_update)

# delete metadata
client.delete_catalog('catalog01')

Using operation functions

from fdpclient import operations

# create metadata
with open('catalog01.ttl') as f:
data = f.read()
operations.create('http://example.org/catalog', data)

# read metadata, return a RDF graph
r = operations.read('http://example.org/catalog/catalog01')
print(r.serialize(format="turtle").decode("utf-8"))

# update metadata
with open('catalog01_update.ttl') as f:
    data_update = f.read()
operations.update('http://example.org/catalog/catalog01', data_update)

# delete metadata
operations.delete('http://example.org/catalog/catalog01')

List of Methods/Functions

Client methods

You can use fdpclient.client.Client class and its methods to process FDP metadata.

create_fdp(data[, format])

Create fdp metadata.

create_catalog(data[, format])

Create a new catalog metadata.

create_dataset(data[, format])

Create a new dataset metadata.

create_distribution(data[, format])

Create a new distribution metadata.

read_fdp([format])

Read the fdp metadata.

read_catalog(id[, format])

Read a catalog metadata.

read_dataset(id[, format])

Read a dataset metadata.

read_distribution(id[, format])

Read a distribution metadata.

update_fdp(data[, format])

Update the fdp metadata.

update_catalog(id, data[, format])

Update a catalog metadata.

update_dataset(id, data[, format])

Update a dataset metadata.

update_distribution(id, data[, format])

Update a distribution metadata.

delete_catalog(id, **kwargs)

Delete a catalog metadata.

delete_dataset(id, **kwargs)

Delete a dataset metadata.

delete_distribution(id, **kwargs)

Delete a distribution metadata.

Operation functions

You can also use fdpclient.operations functions to process FDP metadata.

create(url, data[, format])

Send a create request.

read(url[, format])

Send a read request.

update(url, data[, format])

Send an update request.

delete(url, **kwargs)

Send a delete request.

Indices and tables