From ceb4af691a4cbda76d42b56a38f4c9b8dea3a6f5 Mon Sep 17 00:00:00 2001 From: kovalch Date: Mon, 13 Nov 2023 09:08:02 +0100 Subject: [PATCH] feat: Import and export distribution field temporal_resolution --- ckanext/dcatapchharvest/profiles.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ckanext/dcatapchharvest/profiles.py b/ckanext/dcatapchharvest/profiles.py index 80d4bfe..1f381f1 100644 --- a/ckanext/dcatapchharvest/profiles.py +++ b/ckanext/dcatapchharvest/profiles.py @@ -583,6 +583,14 @@ def parse_dataset(self, dataset_dict, dataset_ref): # noqa distribution, DCAT.accessService ) + # Temporal resolution + + temporal_resolution = self._object_value_list(distribution, DCAT.temporalResolution) + log.debug("temporal_resolution : %s" % (temporal_resolution)) + # Check if the value corresponds to XSD.duration + if temporal_resolution == XSD.duration: + resource_dict['temporal_resolution'] = temporal_resolution + # Timestamp fields for key, predicate in ( ('issued', DCT.issued), @@ -912,6 +920,14 @@ def graph_from_dataset(self, dataset_dict, dataset_ref): # noqa ref = URIRef(uri) g.add((distribution, DCAT.accessService, ref)) + # Temporal Resolution + if resource_dict.get('temporal_resolution'): + g.add(( + distribution, + DCAT.temporalResolution, + Literal(resource_dict['temporal_resolution'], datatype=XSD.duration) + )) + # Mime-Type if resource_dict.get('mimetype'): g.add((