Skip to content
Snippets Groups Projects
Commit 1d32eb58 authored by Thorge Petersen's avatar Thorge Petersen
Browse files

Updated profile to parse multiple appl. legilation or hvd values in a single...

Updated profile to parse multiple appl. legilation or hvd values in a single extra field according custom curly brace format
parent b765ba83
No related branches found
No related tags found
1 merge request!52Added applicableLegislation and hvdCategory support
...@@ -65,17 +65,44 @@ class ODSHDCATdeProfile(DCATdeProfile): ...@@ -65,17 +65,44 @@ class ODSHDCATdeProfile(DCATdeProfile):
if value: if value:
ds_utils.insert_new_extras_field(dataset_dict, 'reference', value) ds_utils.insert_new_extras_field(dataset_dict, 'reference', value)
def _parse_metadata_list(self, dataset_dict, dataset_ref, field_name, rdf_predicate):
value = ""
for obj in self.g.objects(dataset_ref, rdf_predicate):
if value:
value += "," + str(obj)
else:
value = str(obj)
if value:
ds_utils.insert_new_extras_field(
dataset_dict, field_name, "{" + value + "}")
def _parse_applicable_legislation(self, dataset_dict, dataset_ref): def _parse_applicable_legislation(self, dataset_dict, dataset_ref):
value = self._object(dataset_ref, DCT.applicableLegislation) self._parse_metadata_list(dataset_dict, dataset_ref, 'applicableLegislation', DCATAP.applicableLegislation)
def _parse_hvd_category(self, dataset_dict, dataset_ref):
self._parse_metadata_list(dataset_dict, dataset_ref, 'hvdCategory', DCATAP.hvdCategory)
def _parse_applicable_legislation(self, dataset_dict, dataset_ref):
value = ""
for applicable_legislation in self.g.objects(dataset_ref, DCATAP.applicableLegislation):
if value:
value += "," + applicable_legislation
else:
value = applicable_legislation
if value: if value:
ds_utils.insert_new_extras_field( ds_utils.insert_new_extras_field(
dataset_dict, 'applicableLegislation', value) dataset_dict, 'applicableLegislation', "{" + value + "}")
def _parse_hvd_category(self, dataset_dict, dataset_ref): def _parse_hvd_category(self, dataset_dict, dataset_ref):
value = self._object(dataset_ref, DCT.hvdCategory) value = ""
for hvdCategory in self.g.objects(dataset_ref, DCATAP.hvdCategory):
if value:
value += "," + hvdCategory
else:
value = hvdCategory
if value: if value:
ds_utils.insert_new_extras_field( ds_utils.insert_new_extras_field(
dataset_dict, 'hvdCategory', value) dataset_dict, 'hvdCategory', "{" + value + "}")
def _belongs_to_collection(self, dataset_dict, dataset_ref): def _belongs_to_collection(self, dataset_dict, dataset_ref):
dct_is_version_of = self._object(dataset_ref, DCT.isVersionOf) dct_is_version_of = self._object(dataset_ref, DCT.isVersionOf)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment