diff --git a/js/components/harvest/feature-field.vue b/js/components/harvest/feature-field.vue index 97e45de00e..779ef71b18 100644 --- a/js/components/harvest/feature-field.vue +++ b/js/components/harvest/feature-field.vue @@ -21,7 +21,11 @@ export default { }, computed: { checked() { - return this.key in this.features ? this.features[this.key] : this.feature.default; + if (this.key in this.features) + return this.features[this.key] + if (this.feature.default === "False") + return false + return this.feature.default }, features() { return this.config.features || {}; diff --git a/udata/harvest/backends/dcat.py b/udata/harvest/backends/dcat.py index aacb2928b4..329b01dea9 100644 --- a/udata/harvest/backends/dcat.py +++ b/udata/harvest/backends/dcat.py @@ -14,10 +14,11 @@ DCAT, DCT, HYDRA, SPDX, namespace_manager, guess_format, url_from_rdf ) from udata.core.dataset.rdf import dataset_from_rdf +from udata.i18n import gettext as _ from udata.storage.s3 import store_as_json, get_from_json from udata.harvest.models import HarvestItem -from .base import BaseBackend +from .base import BaseBackend, HarvestFeature log = logging.getLogger(__name__) @@ -190,12 +191,23 @@ def next_record_if_should_continue(self, start, search_results): class CswDcatBackend(DcatBackend): display_name = 'CSW-DCAT' - DCAT_SCHEMA = 'http://www.w3.org/ns/dcat#' + features = ( + HarvestFeature('geodcat_ap', _('Use GeoDCAT-AP schema (experimental)'), + _('If enabled, use GeoDCAT-AP schema instead of default.'), default=False), + ) + + DEFAULT_CSW_SCHEMA = 'http://www.w3.org/ns/dcat#' def walk_graph(self, url: str, fmt: str) -> Generator[tuple[int, Graph], None, None]: """ Yield all RDF pages as `Graph` from the source """ + + if self.has_feature('geodcat_ap'): + schema = 'http://data.europa.eu/930/' + else: + schema = self.DEFAULT_CSW_SCHEMA + body = ''' Generator[tuple[int, Graph], None, N page_number = 0 start = 1 - response = self.post(url, data=body.format(start=start, schema=self.DCAT_SCHEMA), + response = self.post(url, data=body.format(start=start, schema=schema), headers=headers) response.raise_for_status() content = response.content @@ -244,7 +256,7 @@ def walk_graph(self, url: str, fmt: str) -> Generator[tuple[int, Graph], None, N page_number += 1 tree = ET.fromstring( - self.post(url, data=body.format(start=start, schema=self.DCAT_SCHEMA), + self.post(url, data=body.format(start=start, schema=schema), headers=headers).content) diff --git a/udata/translations/udata.pot b/udata/translations/udata.pot index a4a6937a37..36f785c4b8 100644 --- a/udata/translations/udata.pot +++ b/udata/translations/udata.pot @@ -6,10 +6,10 @@ #, fuzzy msgid "" msgstr "" -"Project-Id-Version: udata 7.0.7.dev0\n" +"Project-Id-Version: udata 8.0.1.dev0\n" "Report-Msgid-Bugs-To: i18n@opendata.team\n" -"POT-Creation-Date: 2024-04-15 12:06+0200\n" -"PO-Revision-Date: 2024-04-15 12:06+0200\n" +"POT-Creation-Date: 2024-04-25 17:58+0200\n" +"PO-Revision-Date: 2024-04-25 17:58+0200\n" "Last-Translator: Open Data Team \n" "Language: en\n" "Language-Team: Open Data Team \n" @@ -132,17 +132,17 @@ msgstr "" msgid "Confirm change of email instructions" msgstr "" -#: udata/auth/views.py:72 +#: udata/auth/views.py:73 msgid "" "You did not confirm your change of email within {email_within}. New " "instructions to confirm your change of email have been sent to {new_email}." msgstr "" -#: udata/auth/views.py:82 +#: udata/auth/views.py:83 msgid "Thank you. Your change of email has been confirmed." msgstr "" -#: udata/auth/views.py:97 +#: udata/auth/views.py:98 msgid "" "Thank you. Confirmation instructions for changing your email have been sent " "to {new_email}." @@ -1162,6 +1162,14 @@ msgstr "" msgid "Archived" msgstr "" +#: udata/harvest/backends/dcat.py:212 +msgid "Use GeoDCAT-AP schema (experimental)" +msgstr "" + +#: udata/harvest/backends/dcat.py:213 +msgid "If enabled, use GeoDCAT-AP schema instead of default." +msgstr "" + #: udata/templates/admin.html:7 msgid "Admin" msgstr ""