Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  Add orcid for BG
  Update docs.
  Add an example for ULAN.
  Remove sudo key.
  Prepare for release.
  Add local copies of conceptschemes (#100)
  Update README
  Fix RTD config
  Reconfigure docs.
  Fix warning
  Updat dependencies and drop python 3.8 support
  • Loading branch information
koenedaele committed Nov 8, 2023
2 parents fab85f8 + 94dd17b commit c1095ae
Show file tree
Hide file tree
Showing 16 changed files with 240 additions and 109 deletions.
22 changes: 22 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: docs/source/conf.py

# We recommend specifying your dependencies to enable reproducible builds:
# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: requirements-dev.txt
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
sudo: false
language: python
os: linux
dist: focal
python:
- 3.8
- 3.9
- 3.10
- 3.11
install:
- pip install -U setuptools
- pip install -r requirements.txt #fix versions
- pip install -r requirements-dev.txt #fix versions
- python setup.py develop
- pip install pytest pytest-cov coveralls #install test deps
script:
- py.test --cov skosprovider_getty --cov-report term-missing tests
after_success:
Expand Down
7 changes: 7 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
1.2.0 (2023-11-08)
------------------

- Include the three Getty Conceptschemes in the code to make instantiating
the providers less dependent on the Getty services being up and running. (#86)
- Drop support for Python 3.8 and add support for 3.11

1.1.0 (2022-08-17)
------------------

Expand Down
5 changes: 3 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ authors:
- given-names: Bram
family-names: Goessens
affiliation: Agentschap Onroerend Erfgoed
orcid: 'https://orcid.org/0000-0001-6693-0866'
- given-names: Wim
family-names: De Clercq
- given-names: Tinne
Expand Down Expand Up @@ -46,5 +47,5 @@ keywords:
- tgn
- ulan
license: MIT
version: 1.0.0
date-released: '2021-12-17'
version: 1.2.0
date-released: '2023-11-08'
31 changes: 20 additions & 11 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,21 +1,30 @@
skosprovider_getty
==================

.. image:: https://img.shields.io/pypi/v/skosprovider_getty.svg
:target: https://pypi.python.org/pypi/skosprovider_getty
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.7003715.svg
:target: https://doi.org/10.5281/zenodo.7003715
.. image:: https://app.travis-ci.com/OnroerendErfgoed/skosprovider_getty.svg?branch=develop
:target: https://app.travis-ci.com/OnroerendErfgoed/skosprovider_getty
.. image:: https://coveralls.io/repos/github/OnroerendErfgoed/skosprovider_getty/badge.svg?branch=develop
:target: https://coveralls.io/github/OnroerendErfgoed/skosprovider_getty?branch=develop

----

.. image:: https://readthedocs.org/projects/skosprovider_getty/badge/?version=latest
:target: http://skosprovider-getty.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status
.. image:: https://joss.theoj.org/papers/10.21105/joss.05040/status.svg
:target: https://doi.org/10.21105/joss.05040

`Skosprovider <http://skosprovider.readthedocs.org>`_ implementation of the
`Getty Vocabularies <http://vocab.getty.edu>`_.
`Getty Vocabularies <http://vocab.getty.edu>`_, can be used in conjunction with the
`Atramhasis SKOS editor <https://github.com/OnroerendErfgoed/atramhasis>`_ to allow
linking your own vocabularies to the Getty thesauri and importing from them.

Supported Getty thesauri:

* `Art & Architecture Thesaurus (AAT) <http://vocab.getty.edu/aat>`_
* `The Getty Thesaurus of Geographic Names (TGN) <http://vocab.getty.edu/tgn>`_
* `Union List of Artist Names (ULAN) <http://vocab.getty.edu/ulan>`_

.. image:: https://travis-ci.org/OnroerendErfgoed/skosprovider_getty.png?branch=master
:target: https://travis-ci.org/OnroerendErfgoed/skosprovider_getty
.. image:: https://coveralls.io/repos/OnroerendErfgoed/skosprovider_getty/badge.png?branch=master
:target: https://coveralls.io/r/OnroerendErfgoed/skosprovider_getty

.. image:: https://readthedocs.org/projects/skosprovider-getty/badge/?version=latest
:target: https://readthedocs.org/projects/skosprovider-getty/?badge=latest
.. image:: https://badge.fury.io/py/skosprovider_getty.png
:target: http://badge.fury.io/py/skosprovider_getty
6 changes: 3 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@

# General information about the project.
project = 'skosprovider_getty'
copyright = '2014-2022, Flanders Heritage Agency'
copyright = '2014-2023, Flanders Heritage Agency'

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
version = '1.1'
version = '1.2'
# The full version, including alpha/beta/rc tags.
release = '1.1.0'
release = '1.2.0'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
24 changes: 20 additions & 4 deletions docs/source/general.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ Installation
============

To be able to use this library you need to have a modern version of Python
installed. Currently we're supporting versions 2.7, 3.3 and 3.4 of Python.
installed.

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

.. code-block:: bash
Expand All @@ -36,11 +36,17 @@ depends on.
Using the providers
===================

A provider provides access to a single thesaurus or conceptscheme. You can
use the :class:`skosprovider_getty.providers.GettyProvider` directly
by passing it a set of configuration options. Or you can use the more specific
subclasses that come pre-configured with some of the configuration. For most
users, this is the preferred method.

Using AATProvider
-----------------

The :class:`~skosprovider_getty.providers.AATProvider` is a provider for
the :term:`AAT`. It's use is identical to all other SKOSProviders.
the :term:`AAT`. Its use is identical to all other SKOSProviders.

.. literalinclude:: ../../examples/churches.py
:language: python
Expand All @@ -49,11 +55,21 @@ Using TGNProvider
-----------------

The :class:`~skosprovider_getty.providers.TGNProvider` is a provider for
the :term:`TGN`. It's use is identical to all other SKOSProviders.
the :term:`TGN`. Its use is identical to all other SKOSProviders.

.. literalinclude:: ../../examples/flanders.py
:language: python

Using ULANProvider
------------------

The :class:`~skosprovider_getty.providers.ULANProvider` is a provider for
the :term:`ULAN`. Its use is identical to all other SKOSProviders.

.. literalinclude:: ../../examples/tolkien.py
:language: python


Finding concepts or collections
-------------------------------

Expand Down
8 changes: 6 additions & 2 deletions docs/source/glossary.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,13 @@ Glossary
More information: http://www.getty.edu

AAT
`The Art & Architecture Thesaurus <http://vocab.getty.edu/aat>`__.
`The Art & Architecture Thesaurus <http://vocab.getty.edu/aat>/`__.
A vocabulary provided by the :term:`Getty`.

TGN
`The Getty Thesaurus of Geographic Names <http://vocab.getty.edu/tgn>`__.
`The Getty Thesaurus of Geographic Names <http://vocab.getty.edu/tgn/>`__.
A vocabulary provided by the :term:`Getty`.

ULAN
`The Union List of Artist Names <http://vocab.getty.edu/ulan/>`__.
A vocabulary provided by the :term:`Getty`.
24 changes: 24 additions & 0 deletions examples/tolkien.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/python
'''
This script demonstrates using the ULANProvider to get the concept of
J.R.R. Tolkien.
'''

from skosprovider_getty.providers import ULANProvider

ulan = ULANProvider(metadata={'id': 'ULAN'})

tolkien = ulan.get_by_id(500112201)

langs = ['en', 'nl', 'und']

print('Label per language')
print('------------------')
for lang in langs:
label = tolkien.label(lang)
print(lang + ' --> ' + label.language + ': ' + label.label + ' [' + label.type + ']')

print('Labels')
print('------')
for lang in tolkien.labels:
print(lang.language + ': ' + lang.label + ' [' + lang.type + ']')
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
requests==2.26.0
requests==2.31.0
skosprovider==1.2.0
rdflib==6.2.0
rdflib==6.3.2
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

setup(
name='skosprovider_getty',
version='1.1.0',
version='1.2.0',
description='Skosprovider implementation of the Getty Vocabularies',
long_description=README + '\n\n' + CHANGES,
long_description_content_type='text/x-rst',
Expand All @@ -32,9 +32,9 @@
'Natural Language :: English',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
],
author='Flanders Heritage Agency',
author_email='[email protected]',
Expand Down
28 changes: 27 additions & 1 deletion skosprovider_getty/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
import requests
from language_tags import tags
from skosprovider.providers import VocabularyProvider
from skosprovider.skos import ConceptScheme
from skosprovider.skos import Label

from skosprovider_getty.utils import GVP
from skosprovider_getty.utils import SubClassCollector
Expand Down Expand Up @@ -63,7 +65,10 @@ def __init__(self, metadata, **kwargs):
'allowed_instance_scopes',
['single', 'threaded_thread']
)
self._conceptscheme = None
if 'concept_scheme' in kwargs:
self._conceptscheme = kwargs.get('concept_scheme')
else:
self._conceptscheme = None

@property
def concept_scheme(self):
Expand Down Expand Up @@ -434,6 +439,13 @@ def __init__(self, metadata, **kwargs):
metadata,
base_url='http://vocab.getty.edu/',
vocab_id='aat',
concept_scheme = ConceptScheme(
uri='http://vocab.getty.edu/aat/',
labels=[
Label('Art and Architecture Thesaurus', 'prefLabel', 'en'),
Label('AAT', 'altLabel', 'en'),
]
),
**kwargs
)

Expand All @@ -452,6 +464,13 @@ def __init__(self, metadata, **kwargs):
metadata,
base_url='http://vocab.getty.edu/',
vocab_id='tgn',
concept_scheme = ConceptScheme(
uri='http://vocab.getty.edu/tgn/',
labels=[
Label('Thesaurus of Geographic Names', 'prefLabel', 'en'),
Label('AAT', 'altLabel', 'en'),
]
),
**kwargs
)

Expand All @@ -471,5 +490,12 @@ def __init__(self, metadata, **kwargs):
metadata,
base_url='http://vocab.getty.edu/',
vocab_id='ulan',
concept_scheme = ConceptScheme(
uri='http://vocab.getty.edu/ulan/',
labels=[
Label('Union List of Artist Names', 'prefLabel', 'en'),
Label('ULAN', 'altLabel', 'en'),
]
),
**kwargs
)
2 changes: 1 addition & 1 deletion skosprovider_getty/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ def _create_label(literal, type):
try:
lang = Label(literal.toPython(), type, language)
except ValueError:
log.warn('Received a label with an invalid language tag: %s.', language)
log.warning('Received a label with an invalid language tag: %s.', language)
lang = Label(literal.toPython(), type, 'und')
return lang

Expand Down
Loading

0 comments on commit c1095ae

Please sign in to comment.