Skip to content

Commit

Permalink
Update for #88
Browse files Browse the repository at this point in the history
  • Loading branch information
koenedaele committed Nov 6, 2023
1 parent d2a7a99 commit 062d2ab
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
------------------

- This library now requires skosprovider 1.1.0 (#86)
- All current (2023-11-06) conceptschemes defines by heritagedata.org are now included
as skosprovider_heritagedata.utils.CONCEPTSCHEMES. Reusing them avoids a call to the
webservice just to get the conceptscheme loaded (#88)
- Add support for Python 3.11

1.1.0 (2022-08-17)
Expand Down
36 changes: 36 additions & 0 deletions examples/period_cs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/usr/bin/python
'''
This script demonstrates using the HeritagedataProvider with the
eh_period conceptscheme already loaded.
'''

from skosprovider_heritagedata.providers import HeritagedataProvider
from skosprovider_heritagedata.utils import CONCEPTSCHEMES

cs_uri = 'http://purl.org/heritagedata/schemes/eh_period'

periodprovider = HeritagedataProvider(
{'id': 'Heritagedata'},
scheme_uri=cs_uri,
concept_scheme = CONCEPTSCHEMES[cs_uri]
)

cs = periodprovider.concept_scheme

print('Labels')
print('------')
for l in cs.labels:
print(l.language + ': ' + l.label + ' [' + l.type + ']')
print()

print('Notes')
print('-----')
for n in cs.notes:
print(n.language + ': ' + n.note + ' [' + n.type + ']')
print()

print('Sources')
print('-------')
for s in cs.sources:
print(s.citation)
print()
4 changes: 2 additions & 2 deletions skosprovider_heritagedata/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ def __init__(self, metadata, **kwargs):
:param kwargs: arguments defining the provider.
* Typical argument is `scheme_uri`.
The `scheme_uri` is a composition of the `base_scheme_uri` and `scheme_id`
* The :class:`skosprovider_Heritagedata.providers.HeritagedataProvider`
is the default :class:`skosprovider_Heritagedata.providers.HeritagedataProvider`
* session: a custom requests Sesssion
* concept_scheme: the scheme all concepts belong to, avoids a call to the webservice
"""
if not 'default_language' in metadata:
metadata['default_language'] = 'en'
Expand Down

0 comments on commit 062d2ab

Please sign in to comment.