Concept collection to RDF library¶
A small Python library for mapping a concept collection to rdf
The library contains helper classes for the following Skos classes:
Other relevant classes are also supported, such as:
Contact (vcard:Kind)
The library will map to the Norwegian Application Profile of the DCAT standard.
Installation¶
To install the concepttordf package, run this command in your terminal:
$ pip install concepttordf
Usage¶
This package can be used like this:
from concepttordf.catalog import Catalog, Dataset
# Create catalog object
catalog = Catalog()
catalog.identifier = "http://example.com/catalogs/1"
catalog.title = {"en": "A dataset catalog"}
catalog.publisher = "https://example.com/publishers/1"
# Create a dataset:
dataset = Dataset()
dataset.identifier = "http://example.com/datasets/1"
dataset.title = {"nb": "inntektsAPI", "en": "incomeAPI"}
#
# Add concept to catalog:
catalog.datasets.append(dataset)
# get rdf representation in turtle (default)
rdf = catalog.to_rdf()
print(rdf)