FAIR Data Point API Client¶
Contents
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 metadata. |
|
Create a new catalog metadata. |
|
Create a new dataset metadata. |
|
Create a new distribution metadata. |
|
Read the fdp metadata. |
|
Read a catalog metadata. |
|
Read a dataset metadata. |
|
Read a distribution metadata. |
|
Update the fdp metadata. |
|
Update a catalog metadata. |
|
Update a dataset metadata. |
|
Update a distribution metadata. |
|
Delete a catalog metadata. |
|
Delete a dataset metadata. |
|
Delete a distribution metadata. |
Operation functions¶
You can also use fdpclient.operations
functions to process FDP metadata.
|
Send a create request. |
|
Send a read request. |
|
Send an update request. |
|
Send a delete request. |