Skip to content

Latest commit

 

History

History
57 lines (43 loc) · 2.11 KB

intro.rst

File metadata and controls

57 lines (43 loc) · 2.11 KB

Introduction

Installation

To be able to use this library you need to have a modern version of Python installed.

This easiest way to install this library is through pip or easy install:

$ pip install skosprovider_rdf

This will download and install skosprovider_rdf and a few libraries it depends on.

Usage

This library offers an implementation of the skosprovider.providers.VocabularyProvider interface that uses an rdflib.graph.Graph as input. This provider can be used to add a SKOS vocabulary contained in an RDF file to your application. The provider itself does not read the SKOS file, but expects to be passed a ~rdflib.graph.Graph. So any type of RDF serialisation that can be read by rdflib, can be used with this provider.

/../examples/load_skos.py

Out of the box skosprovider_rdf assumes your RDF file contains exactly one conceptscheme. If no conceptscheme is found in the file and you did not pass one to the provider through the concept_scheme parameter, a new conceptscheme is automatically created. If more than one conceptscheme is present in the file, you can again specify the conceptscheme through the concept_scheme parameter (passing a skosprovider.skos.ConceptScheme) or you can pass the uri of one of the conceptschemes present in the concept_scheme_uri parameter. When you specify a conceptscheme like this, only the concepts linked to this scheme through skos:inScheme statements will be loaded.

/../examples/load_specific_scheme.py

It also provides a utility function to dump any implementation of skosprovider.providers.VocabularyProvider to a rdflib.graph.Graph. Again, since the provider only deals with the ~rdflib.graph.Graph object, it's possible to serialise a VocabularyProvider to whatever RDF serialisations rdflib allows.

/../examples/dump.py