From 42754a4f7402aa2365e2ff48d3a68ee47eb00c47 Mon Sep 17 00:00:00 2001 From: Koen Van Daele Date: Fri, 19 Dec 2014 14:18:31 +0100 Subject: [PATCH 1/5] Update requirements.txt Update skosprovider to 0.5.0. Fix requests to 2.5.0 for testing purposes. --- requirements.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index f2002e4..0fe28d2 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -requests==2.4.1 -#skosprovider==0.5.0 --e git+https://github.com/koenedaele/skosprovider.git#egg=skosprovider +requests==2.5.0 +skosprovider==0.5.0 +#-e git+https://github.com/koenedaele/skosprovider.git#egg=skosprovider rdflib==4.1.2 From d0f6ab8c4db9de6f5d8c59bdb0c19baa2e758b50 Mon Sep 17 00:00:00 2001 From: Koen Van Daele Date: Fri, 19 Dec 2014 14:19:51 +0100 Subject: [PATCH 2/5] Set the min version of skosprovider to 0.5.0 Skosprovider 0.5.0 is required because of the ProviderUnavailableException. --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 0ef78fb..cfaf9c5 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ ] requires = [ - 'skosprovider', + 'skosprovider>=0.5.0', 'requests', 'rdflib' ] From b7e94b366fe1c9a43acfc6e2de98d7f6911e13c4 Mon Sep 17 00:00:00 2001 From: Koen Van Daele Date: Fri, 19 Dec 2014 14:36:43 +0100 Subject: [PATCH 3/5] Doc updates. --- docs/source/conf.py | 3 ++- docs/source/index.rst | 2 +- skosprovider_heritagedata/providers.py | 8 ++++++-- skosprovider_heritagedata/utils.py | 26 ++++++++++++++++++++------ 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index d8a3192..8dae404 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -267,5 +267,6 @@ # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = { 'python': ('http://docs.python.org/', None), - 'skosprovider': ('http://skosprovider.readthedocs.org/en/latest', None) + 'skosprovider': ('http://skosprovider.readthedocs.org/en/latest', None), + 'rdflib': ('http://rdflib.readthedocs.org/en/latest', None) } diff --git a/docs/source/index.rst b/docs/source/index.rst index 21a0b15..49fb13c 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -4,7 +4,7 @@ contain the root `toctree` directive. Welcome to skosprovider_heritagedata's documentation! -============================================== +===================================================== .. toctree:: :maxdepth: 2 diff --git a/skosprovider_heritagedata/providers.py b/skosprovider_heritagedata/providers.py index dee0473..e6e7253 100644 --- a/skosprovider_heritagedata/providers.py +++ b/skosprovider_heritagedata/providers.py @@ -5,14 +5,18 @@ ''' import requests +from requests.exceptions import ConnectionError + import warnings import logging -from requests.exceptions import ConnectionError log = logging.getLogger(__name__) + from language_tags import tags from rdflib.namespace import SKOS + from skosprovider.exceptions import ProviderUnavailableException from skosprovider.providers import VocabularyProvider + from skosprovider_heritagedata.utils import ( _split_uri, uri_to_graph, @@ -281,4 +285,4 @@ def _get_items(self, service, params): d[uri] = item elif tags.tag(item['lang']).format == 'en': d[uri] = item - return list(d.values()) \ No newline at end of file + return list(d.values()) diff --git a/skosprovider_heritagedata/utils.py b/skosprovider_heritagedata/utils.py index 77657d1..e839b33 100644 --- a/skosprovider_heritagedata/utils.py +++ b/skosprovider_heritagedata/utils.py @@ -3,22 +3,22 @@ Utility functions for :mod:`skosprovider_heritagedata`. ''' -import rdflib -from rdflib.term import URIRef +import sys + try: from urllib2 import URLError except ImportError: from urllib.error import URLError + from skosprovider.skos import ( Concept, Label, Note, ConceptScheme) - from skosprovider.exceptions import ProviderUnavailableException import logging -import sys +log = logging.getLogger(__name__) PY3 = sys.version_info[0] == 3 @@ -27,13 +27,19 @@ else: # pragma: no cover binary_type = str -log = logging.getLogger(__name__) - +import rdflib +from rdflib.term import URIRef from rdflib.namespace import RDF, SKOS, DC, RDFS PROV = rdflib.Namespace('http://www.w3.org/ns/prov#') def conceptscheme_from_uri(conceptscheme_uri): + ''' + Read a SKOS Conceptscheme from a :term:`URI` + + :param string conceptscheme_uri: URI of the conceptscheme. + :rtype: skosprovider.skos.ConceptScheme + ''' graph = uri_to_graph('%s.rdf' % (conceptscheme_uri)) # get the conceptscheme @@ -48,6 +54,14 @@ def conceptscheme_from_uri(conceptscheme_uri): def things_from_graph(graph, concept_scheme): + ''' + Read concepts and collections from a graph. + + :param rdflib.Graph graph: Graph to read from. + :param skosprovider.skos.ConceptScheme concept_scheme: Conceptscheme the + concepts and collections belong to. + :rtype: :class:`list` + ''' clist = [] for sub, pred, obj in graph.triples((None, RDF.type, SKOS.Concept)): uri = str(sub) From 62ea28043985495960d553969633b757e98bea2e Mon Sep 17 00:00:00 2001 From: Koen Van Daele Date: Fri, 19 Dec 2014 16:52:27 +0100 Subject: [PATCH 4/5] Prepare for release. --- CHANGES.rst | 3 +-- setup.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 6edc960..afb8152 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,8 +1,7 @@ -0.2.0 (2014-12-??) +0.2.0 (2014-12-19) ------------------ - Compatibile with `SkosProvider 0.5.0 `_. -- Not backwards compatible with `SkosProvider 0.3.0 `_. - Each Concept or Collection now also provides information on the ConceptScheme it's part of. - Fix some issues with UTF-8 encoding. diff --git a/setup.py b/setup.py index cfaf9c5..debe69d 100644 --- a/setup.py +++ b/setup.py @@ -40,6 +40,6 @@ author='Flanders Heritage Agency', author_email='ict@onroerenderfgoed.be', url='https://github.com/OnroerendErfgoed/skosprovider_heritagedata', - keywords='heritagedata.org skos skosprovider', + keywords='heritagedata.org skos skosprovider thesauri vocabularies', test_suite='nose.collector' ) From 101b8a905e465111f62fb0a62603ceebb532002f Mon Sep 17 00:00:00 2001 From: Koen Van Daele Date: Fri, 19 Dec 2014 16:56:38 +0100 Subject: [PATCH 5/5] Fix wrong link. --- CHANGES.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index afb8152..d66ec8c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,7 +1,7 @@ 0.2.0 (2014-12-19) ------------------ -- Compatibile with `SkosProvider 0.5.0 `_. +- Compatibile with `SkosProvider 0.5.0 `_. - Each Concept or Collection now also provides information on the ConceptScheme it's part of. - Fix some issues with UTF-8 encoding.