Skip to content

Commit

Permalink
fixed merge
Browse files Browse the repository at this point in the history
  • Loading branch information
dieuska committed Dec 23, 2014
2 parents dddcebe + 101b8a9 commit 874dedf
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 18 deletions.
5 changes: 2 additions & 3 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
0.2.0 (2014-12-??)
0.2.0 (2014-12-19)
------------------

- Compatibile with `SkosProvider 0.5.0 <http://skosprovider.readthedocs.org/en/0.4.0>`_.
- Not backwards compatible with `SkosProvider 0.3.0 <http://skosprovider.readthedocs.org/en/0.3.0>`_.
- Compatibile with `SkosProvider 0.5.0 <http://skosprovider.readthedocs.org/en/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.
Expand Down
3 changes: 2 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
contain the root `toctree` directive.
Welcome to skosprovider_heritagedata's documentation!
==============================================
=====================================================

.. toctree::
:maxdepth: 2
Expand Down
6 changes: 3 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
]

requires = [
'skosprovider',
'skosprovider>=0.5.0',
'requests',
'rdflib'
]
Expand All @@ -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'
)
8 changes: 6 additions & 2 deletions skosprovider_heritagedata/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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())
return list(d.values())
24 changes: 18 additions & 6 deletions skosprovider_heritagedata/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,39 @@
Utility functions for :mod:`skosprovider_heritagedata`.
'''

import rdflib
from rdflib.term import URIRef
import requests

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

if PY3: # pragma: no cover
binary_type = bytes
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
Expand All @@ -46,6 +50,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)
Expand Down

0 comments on commit 874dedf

Please sign in to comment.