Skip to content

Commit 6d7e2f0

Browse files
committed
bugfix HVD metadata mapping
1 parent 980f26c commit 6d7e2f0

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

ckanext/hro_dcatapde/profile.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,14 @@ def graph_from_dataset(self, dataset_dict, dataset_ref):
108108
g.add((dataset_ref, DCAT.landingPage, URIRef(dataset_ref)))
109109

110110
# dcatap:hvdCategory and dcatap:applicableLegislation
111+
hvd_category = None
111112
extras = self._get_dataset_value(dataset_dict, 'extras')
112-
hvd_category = next((d['value'] for d in extras if d['key'] == 'hvd_category'), None)
113-
if hvd_category is not None:
114-
g.add((dataset_ref, DCATAP.hvdCategory, URIRef(hvd_category)))
115-
g.add((dataset_ref, DCATAP.applicableLegislation, URIRef('http://data.europa.eu/eli/reg_impl/2023/138/oj')))
113+
extras_hvd_category = next((d['value'] for d in extras if d['key'] == 'hvd_category'), None)
114+
if extras_hvd_category is not None:
115+
hvd_category = self.hvd_category_mapping.get(extras_hvd_category, None)
116+
if hvd_category is not None:
117+
g.add((dataset_ref, DCATAP.hvdCategory, URIRef(hvd_category)))
118+
g.add((dataset_ref, DCATAP.applicableLegislation, URIRef('http://data.europa.eu/eli/reg_impl/2023/138/oj')))
116119

117120
for prefix, namespace in namespaces.items():
118121
g.bind(prefix, namespace)

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# Versions should comply with PEP440. For a discussion on single-sourcing
1616
# the version across setup.py and the project code, see
1717
# http://packaging.python.org/en/latest/tutorial.html#version
18-
version='2.2.1',
18+
version='2.2.2',
1919

2020
description='''A custom implementation of DCAT-AP.de for OpenData.HRO, the open data portal of the municipality of Rostock''',
2121
long_description=long_description,

0 commit comments

Comments
 (0)