diff --git a/atramhasis/scripts/initializedb.py b/atramhasis/scripts/initializedb.py index f00a5294..442ee91a 100644 --- a/atramhasis/scripts/initializedb.py +++ b/atramhasis/scripts/initializedb.py @@ -26,6 +26,7 @@ def main(argv=sys.argv): from fixtures.heritagetypes import heritagetypes from fixtures.periods import periods from fixtures.species import species + from fixtures.bluebirds import bluebirds if len(argv) < 2: usage(argv) config_uri = argv[1] @@ -130,6 +131,18 @@ def main(argv=sys.argv): ), db_session ) + import_provider( + bluebirds, + ConceptScheme( + id=9, + uri='https://id.bluebirds.org', + labels=[ + Label('Blauwe vogels', 'prefLabel', 'nl'), + Label('Blue birds', 'prefLabel', 'en') + ] + ), + db_session + ) db_session.commit() db_session.close() print('--atramhasis-db-initialized--') diff --git a/atramhasis/skos/__init__.py b/atramhasis/skos/__init__.py index 31afc696..719c2867 100644 --- a/atramhasis/skos/__init__.py +++ b/atramhasis/skos/__init__.py @@ -147,6 +147,16 @@ def create_registry(request): uri_generator=UriPatternGenerator('https://id.erfgoed.net/thesauri/soorten/%s') ) + bluebirds = SQLAlchemyProvider( + { + 'id': 'BLUEBIRDS', + 'conceptscheme_id': 9, + 'atramhasis.id_generation_strategy': IDGenerationStrategy.MANUAL + }, + request.db, + uri_generator=UriPatternGenerator('https://id.bluebirds.org/%s') + ) + # use 'subject': ['external'] for read only external providers # (only available in REST service) @@ -170,6 +180,7 @@ def create_registry(request): registry.register_provider(heritagetypes) registry.register_provider(periods) registry.register_provider(species) + registry.register_provider(bluebirds) registry.register_provider(aat) registry.register_provider(tgn) return registry diff --git a/fixtures/LICENSE.rst b/fixtures/LICENSE.rst index c5909b14..17a4627a 100644 --- a/fixtures/LICENSE.rst +++ b/fixtures/LICENSE.rst @@ -3,3 +3,8 @@ The data in this folder can be used according to either the `CC BY 4.0 license Open Data Licentie `_ used by the Flemish Government. + +Please beware that this is not the most current and up to date version of these +thesauri. The data is only fit for demonstrating and developing Atramhasis. If +you are looking for the most recent Flanders Heritage thesauri, please consult +`the Flanders Heritage thesaurus `_. diff --git a/fixtures/bluebirds.py b/fixtures/bluebirds.py new file mode 100644 index 00000000..f34adc3c --- /dev/null +++ b/fixtures/bluebirds.py @@ -0,0 +1,14 @@ +""" +Testdata containing blue birds such as the famous Norwegian Blue + +.. versionadded:: 2.0.0 +""" + + +from skosprovider.providers import DictionaryProvider +from .bluebirds_data import BLUEBIRDSDATA + +bluebirds = DictionaryProvider( + {'id': 'BLUEBIRDS'}, + BLUEBIRDSDATA +) diff --git a/fixtures/bluebirds_data.py b/fixtures/bluebirds_data.py new file mode 100644 index 00000000..ff3d23fb --- /dev/null +++ b/fixtures/bluebirds_data.py @@ -0,0 +1,72 @@ +BLUEBIRDSDATA = [ + { + 'id': 'http://id.bluebirds.org/bird', + 'uri': 'http://id.bluebirds.org/bird', + 'type': 'concept', + 'labels': [{'label': 'Bird', 'type': 'prefLabel', 'language': 'en'}, {'label': 'Vogel', 'type': 'prefLabel', 'language': 'nl'}], + 'notes': [], + 'sources': [], + 'narrower': ['parrot', '579A439C-1A7A-476A-92C3-8A74ABD6B3DB'], + 'broader': [], + 'related': [], + 'member_of': [], + 'subordinate_arrays': [], + 'matches': {'close': [], 'exact': [], 'related': [], 'broad': [], 'narrow': []} + }, + { + + 'id': 'parrot', + 'uri': 'http://id.bluebirds.org/parrot', + 'type': 'concept', + 'labels': [{'label': 'Parrot', 'type': 'prefLabel', 'language': 'en'}, {'label': 'Papegaai', 'type': 'prefLabel', 'language': 'nl'}], + 'notes': [], + 'sources': [], + 'narrower': ['norwegianblue'], + 'broader': [], + 'related': [], + 'member_of': [], + 'subordinate_arrays': [], 'matches': {'close': [], 'exact': [], 'related': [], 'broad': [], 'narrow': []} + }, + { + 'id': 'norwegianblue', + 'uri': 'http://id.bluebirds.org/norwegianblue', + 'type': 'concept', + 'labels': [{'label': 'Norwegian Blue', 'type': 'prefLabel', 'language': 'en'}, {'label': 'Noorse Blauwe', 'type': 'prefLabel', 'language': 'nl'}], + 'notes': [], + 'sources': [], + 'narrower': [], + 'broader': ['parrot'], + 'related': [], + 'member_of': [], + 'subordinate_arrays': [], + 'matches': {'close': [], 'exact': [], 'related': ['http://id.slugs.org/slug'], 'broad': [], 'narrow': []} + }, + { + 'id': '579A439C-1A7A-476A-92C3-8A74ABD6B3DB', + 'uri': 'http://id.bluebirds.org/579A439C-1A7A-476A-92C3-8A74ABD6B3DB', + 'type': 'concept', + 'labels': [{'label': 'Heron', 'type': 'prefLabel', 'language': 'en'}, {'label': 'Héron', 'type': 'prefLabel', 'language': 'fr'}, {'label': 'Reiger', 'type': 'prefLabel', 'language': 'nl'}], + 'notes': [], + 'sources': [], + 'narrower': ['blauwereiger'], + 'broader': [], + 'related': [], + 'member_of': [], + 'subordinate_arrays': [], + 'matches': {'close': [], 'exact': [], 'related': [], 'broad': [], 'narrow': []} + }, + { + 'id': 'blauwereiger', + 'uri': 'http://id.bluebirds.org/blauwereiger', + 'type': 'concept', + 'labels': [{'label': 'Grey heron', 'type': 'prefLabel', 'language': 'en'}, {'label': 'Héron cendré', 'type': 'prefLabel', 'language': 'fr'}, {'label': 'Blauwe reiger', 'type': 'prefLabel', 'language': 'nl'}, {'label': 'Ardea cinerea', 'type': 'prefLabel', 'language': 'la'}], + 'notes': [], + 'sources': [], + 'narrower': [], + 'broader': [], + 'related': [], + 'member_of': [], + 'subordinate_arrays': [], + 'matches': {'close': [], 'exact': [], 'related': [], 'broad': [], 'narrow': []} + } +]