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] |
It requires a Python version of 3.7, 3.8 or 3.9.
The fairdatapoint-client is available on PyPI, you can install it using:
pip install fairdatapoint-client
You can also install from the latest source code, but note that the in-development version might be unstable:
git clone https://github.com/fair-data/fairdatapoint-client.git
cd fairdatapoint-client
pip install .
To run tests (including coverage):
pip install '.[tests]'
pytest
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')
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')
If you have questions or find a bug, please report the issue in the Github issue channel.
If you want to contribute to the development of fairdatapoint-client, have a look at the contribution guidelines.