Skip to main content

A library for mapping a concept collection to rdf

Project description

Tests codecov PyPI Read the Docs


A small Python library for mapping a concept collection to the skos-ap-no specification.



% pip install -i concepttordf

Getting started

To create a SKOS-AP-NO concept collection:

from concepttordf import Collection, Concept, Definition

# Create collection object
collection = Collection()
collection.identifier = "" = {"en": "A concept collection"} = {"nb": "En begrepssamling"}
collection.publisher = ""

# Create a concept:
c = Concept()
c.identifier = ""
c.term = {"name": {"nb": "inntekt", "en": "income"}}
definition = Definition()
definition.text = {"nb": "ting man skulle hatt mer av",
                   "en": "something you want more of"}
c.definition = definition

# Add concept to collection:

# get rdf representation in turtle (default)
rdf = collection.to_rdf()

Will print the concept according to the specification:

@prefix dcat: <> .
@prefix dct: <> .
@prefix ns1: <> .
@prefix rdf: <> .
@prefix rdfs: <> .
@prefix skos: <> .
@prefix skosno: <> .
@prefix skosxl: <> .
@prefix vcard: <> .
@prefix xml: <> .
@prefix xsd: <> .

<> a skos:Collection ;
    rdfs:label "En begrepssamling"@nb ;
    dct:publisher <> ;
    skos:member <> .

<> a skos:Concept ;
    ns1:betydningsbeskrivelse [ a ns1:Definisjon ;
            rdfs:label "something you want more of"@en,
                "ting man skulle hatt mer av"@nb ] ;
    skosxl:prefLabel [ a skosxl:Label ;
            skosxl:literalForm "income"@en,
                "inntekt"@nb ] .




% git clone
% cd concepttordf
% pyenv install 3.8.2
% pyenv install 3.7.6
% pyenv local 3.8.2 3.7.6
% poetry install

Run all tests

% nox

Run all tests with coverage reporting

% nox -rs tests


You can enter into Pdb by passing --pdb to pytest:

nox -rs tests -- --pdb

You can set breakpoints directly in code by using the function breakpoint().

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for concepttordf, version 1.0.0rc7
Filename, size File type Python version Upload date Hashes
Filename, size concepttordf-1.0.0rc7-py3-none-any.whl (20.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size concepttordf-1.0.0rc7.tar.gz (15.6 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page