From d880b524007391f22502e7f1f896cda82c97a4fb Mon Sep 17 00:00:00 2001 From: AlitaBernachot Date: Fri, 24 Jan 2025 11:30:02 +0100 Subject: [PATCH] test: add more ut for reuse metadata(writing) --- ...eo2france.iso19139.reuse+ongules_dummy.xml | 506 +++++++++++++ .../geo2france.records.reuse+roilaye.ts | 184 ++--- .../georhena.iso19139.reuse+solaire.xml | 665 ++++++++++++++++++ .../src/lib/fixtures/georhena.records.ts | 216 ++++++ .../lib/iso19139/iso19139.converter.spec.ts | 54 +- .../src/lib/iso19139/iso19139.converter.ts | 1 + 6 files changed, 1536 insertions(+), 90 deletions(-) create mode 100644 libs/api/metadata-converter/src/lib/fixtures/geo2france.iso19139.reuse+ongules_dummy.xml create mode 100644 libs/api/metadata-converter/src/lib/fixtures/georhena.iso19139.reuse+solaire.xml create mode 100644 libs/api/metadata-converter/src/lib/fixtures/georhena.records.ts diff --git a/libs/api/metadata-converter/src/lib/fixtures/geo2france.iso19139.reuse+ongules_dummy.xml b/libs/api/metadata-converter/src/lib/fixtures/geo2france.iso19139.reuse+ongules_dummy.xml new file mode 100644 index 0000000000..b5957cef3a --- /dev/null +++ b/libs/api/metadata-converter/src/lib/fixtures/geo2france.iso19139.reuse+ongules_dummy.xml @@ -0,0 +1,506 @@ + + + + 7eb795c2-d612-4b5e-b15e-d985b0f4e697 + + + + + + + + + + + Office français de la biodiversité + + + + + + + + + + cartotheque@ofb.gouv.fr + + + + + + + + + + + + 2024-09-26T13:34:25.803Z + + + + + + + Carte dynamique sur la répartition des ongulés sauvages en France + + + + + 2024-05-27 + + + + + + + + + + + + + ---------------------------- +Contexte & objectifs +---------------------------- + +Dans le cadre de ses missions, l’OFB (anciennement l’ONC puis l’ONCFS) réalise le suivi des populations de grands ongulés sauvages en France métropolitaine. +Pour réaliser cette tâche complexe un réseau de correspondants départementaux, l’actuel réseau « Ongulés sauvages OFB-FNC-FDC » a été créée en 1985, et fonctionne grâce à la collaboration entre l’OFB et les fédérations nationale (FNC) et départementales des chasseurs (FDC). + +Les données ont été compilées à partir des données fournies par les Interlocuteurs techniques des FDC du Réseau Ongulés sauvages OFB-FNC-FDC pour toutes les espèces d'ongulés sauvages présentes en France métropolitaine. + +---------------------------- +Les espèces concernées +---------------------------- + +Les espèces concernées sont les suivantes : +Bouquetin des Alpes (Capra ibex) +Bouquetin ibérique (Capra pyrenaica) +Cerf élaphe (Cervus elaphus) +Cerf sika (Cervus nippon) +Chamois (Rupicapra rupicapra) +Daim (Dama dama) +Isard (Rupicapra pyrenaica) +Mouflon de Corse (Ovis gmelinii musimon) +Mouflon méditerranéen (Ovis gmelini musimon x Ovis sp.) +Muntjac de Chine (Muntiacus reevesi) +et le Mouflon à manchettes (Ammotragus lervia). + +---------------------------- +Protocole et limites d'utilisations +---------------------------- +La méthode se basant sur des connaissances locales de la présence de populations établies par des professionnels connaissant bien leur territoire, la notion d’échantillonnage qualifiée d’"exhaustif" est crédible. +Le travail est réalisé par unité de population, c’est-à-dire par secteur occupé par au minimum un groupe d’individus adultes susceptibles de se rencontrer et d’établir entre eux des rapports sociaux et génétiques (reproduction). Il peut donc exister des individus isolés présents en dehors des zones délimitées par ce programme. +Pour des raisons administratives l’inventaire est fait par département. Ainsi pour une population à cheval sur plusieurs départements chaque portion départementale constitue une zone. Un département peut abriter plusieurs zones. +Les données sont vérifiées, harmonisées et validées par l’administrateur(rice) national(e) du réseau tous les 5 ans (avec un rythme différents selon les espèces). + +---------------------------- +Fréquence de mise à jour +---------------------------- + +périodique + +---------------------------- +Outils +---------------------------- + +Les données de chacune de ces espèces sont consultables sur la carte interactive de l'espèce. créées à partir de l'outil Lizmap. + + + + + + + + Réseau Ongulés sauvages OFB-FNC-FDC + + + + + + + reseau.ongules-sauvages@ofb.gouv.fr + + + + + + + + + + + + + + + + + Office France de la Biodiversité + + + + + + + reseau.ongules-sauvages@ofb.gouv.fr + + + + + + + + + + + + + + + + + Fédération Nationale de la Chasse + + + + + + + + + + + + + + + + + + + + + + + + Fédération Départementale de la Chasse + + + + + + + + + + + + + + + + + + + + + https://data.ofb.fr/catalogue/Donnees-geographiques-OFB/api/records/7eb795c2-d612-4b5e-b15e-d985b0f4e697/attachments/OFB.png + + + + + + + Tableaux de chasse + + + Ongulés + + + Départements + + + + + + + + + + réseaux + + + espèces + + + + + + + + Thématique OFB + + + + + 2023-07-03 + + + + + + + + + + geonetwork.thesaurus.external.theme.excel2skos-case-usage-thematique-2023-06-08 + + + + + + + + + + + France métropolitaine + + + + + + + + Thesaurus géographique + + + + + 2023-11-24 + + + + + + + + + + geonetwork.thesaurus.external.theme.excel2skos-case-usage-geographie-2023-11-24 + + + + + + + + + + + espèce animale + + + chasse + + + + + + + + GEMET + + + + + 2018-08-16 + + + + + + + + + + geonetwork.thesaurus.external.theme.gemet + + + + + + + + + + + Répartition des espèces + + + Unités administratives + + + + + + + + GEMET - INSPIRE themes, version 1.0 + + + + + 2008-06-01 + + + + + + + + + + geonetwork.thesaurus.external.theme.httpinspireeceuropaeutheme-theme + + + + + + + + + + + + + + + + -7.3131 + + + 11.9303 + + + 40.4671 + + + 51.7141 + + + + + + + + + + + + + + + + https://lizmap.ofb.fr/ofb/reseau_ongules/index.php/view/map?repository=repartition&project=reseau_cerf_lizmap + + + WWW:LINK-1.0-http--link + + + Carte dynamique de répartition du Cerf élaphe + + + + + + + https://lizmap.ofb.fr/ofb/reseau_ongules/index.php/view/map?repository=repartition&project=ongules_2022_MOM + + + WWW:LINK-1.0-http--link + + + Carte dynamique de répartition du Mouflon méditerranéen + + + + + + + https://lizmap.ofb.fr/ofb/reseau_ongules/index.php/view/map?repository=repartition&project=ongules_2022_MOC + + + WWW:LINK-1.0-http--link + + + Carte dynamique de répartition du Mouflon de Corse + + + + + + + https://lizmap.ofb.fr/ofb/reseau_ongules/index.php/view/map?repository=repartition&project=ongules_2022_ISA + + + WWW:LINK-1.0-http--link + + + Carte dynamique de répartition de l'ISARD + + + + + + + https://lizmap.ofb.fr/ofb/reseau_ongules/index.php/view/map?repository=repartition&project=ongules_2022_CHA + + + WWW:LINK-1.0-http--link + + + Carte dynamique de répartition du Chamois + + + + + + + https://lizmap.ofb.fr/ofb/reseau_ongules/index.php/view/map?repository=repartition&project=ongules_2022_BOQ + + + WWW:LINK-1.0-http--link + + + Carte dynamique de répartition du Bouquetin des Alpes + + + + + + + https://lizmap.ofb.fr/ofb/reseau_ongules/index.php/view/map?repository=repartition&project=ongules_2022_BOI + + + WWW:LINK-1.0-http--link + + + Carte dynamique de répartition du Bouquetin ibérique + + + + + + + + + + + + + + + + + diff --git a/libs/api/metadata-converter/src/lib/fixtures/geo2france.records.reuse+roilaye.ts b/libs/api/metadata-converter/src/lib/fixtures/geo2france.records.reuse+roilaye.ts index 3a7ee7ac1d..df719f2c57 100644 --- a/libs/api/metadata-converter/src/lib/fixtures/geo2france.records.reuse+roilaye.ts +++ b/libs/api/metadata-converter/src/lib/fixtures/geo2france.records.reuse+roilaye.ts @@ -1,91 +1,101 @@ import { ReuseRecord } from '@geonetwork-ui/common/domain/model/record' export const GEO2FRANCE_REUSE_ROILAYE_RECORD: ReuseRecord = { - uniqueIdentifier: '982b6e7d-61f5-43b3-983d-ebae8bc3892d', - kind: 'reuse', - otherLanguages: [], - defaultLanguage: 'fr', - recordUpdated: new Date('2022-12-08T15:06:54.000Z'), - resourceCreated: new Date('2019-12-30T23:00:00.000Z'), - title: 'Photographie aérienne 2021 sur la commune de Saint-Etienne-Roilaye', - abstract: - 'Orthophotoplan 2021 sur le territoire de la commune de Saint-Etienne-Roilaye.', - ownerOrganization: { name: null, translations: {} }, - contacts: [ - { - email: 'missing@missing.com', - role: 'unspecified', - organization: { name: null, translations: {} }, - }, - ], - contactsForResource: [ - { - email: 'missing@missing.com', - role: 'unspecified', - organization: { name: null, translations: {} }, - }, - ], - keywords: [ - { - thesaurus: { - id: 'geonetwork.thesaurus.external.theme.inspire-theme', - name: 'GEMET - INSPIRE themes, version 1.0', - url: new URL('http://geo.compiegnois.fr/geonetwork/srv/fre/thesaurus.download?ref=external.theme.inspire-theme'), - }, - label: 'Ortho-imagerie', - type: 'theme', - translations: {}, - }, - { - thesaurus: { - id: 'geonetwork.thesaurus.external.theme.gemet', - name: 'GEMET - Concepts, version 2.4', - url: new URL('http://geo.compiegnois.fr/geonetwork/srv/en/thesaurus.download?ref=external.theme.gemet'), - }, - label: 'photographie aérienne', - type: 'theme', - translations: {}, - }, - { label: 'ortho', type: 'theme', translations: {} }, - { - thesaurus: { - id: 'geonetwork.thesaurus.external.place.GeoCompiegnois', - name: 'Collectivités du Pays Compiégnois', - url: new URL('http://geo.compiegnois.fr/geonetwork/srv/en/thesaurus.download?ref=external.place.GeoCompiegnois'), - }, - label: 'Saint-Étienne-Roilaye*60572', - type: 'place', - translations: {}, - }, - ], - topics: ['imageryBaseMapsEarthCover'], - licenses: [], - legalConstraints: [], - securityConstraints: [], - otherConstraints: [ - { - text: 'Utilisation libre sous réserve de mentionner la source (a minima le nom du producteur) et la date de sa dernière mise à jour', - translations: {}, - }, - ], - overviews: [ - { - url: new URL('https://geo.compiegnois.fr/geonetwork/srv/api/records/982b6e7d-61f5-43b3-983d-ebae8bc3892d/attachments/Saint-Etienne-Roilaye_ortho_2021.jpg'), - }, - ], - spatialExtents: [ - { bbox: [2.987, 49.3372, 3.0286, 49.3783], translations: {} }, - ], - onlineResources: [ - { - type: 'link', - url: new URL('http://geo.compiegnois.fr/documents/cartotheque/Saint-Etienne-Roilaye_ortho_2021.jpg'), - name: 'Orthophotoplan 2021 de la commune de Saint-Etienne-Roilaye', - translations: {}, - }, - ], - translations: {}, - lineage: null, - temporalExtents: [{ start: null, end: null }], - reuseType: 'map' + uniqueIdentifier: '982b6e7d-61f5-43b3-983d-ebae8bc3892d', + kind: 'reuse', + otherLanguages: [], + defaultLanguage: 'fr', + recordUpdated: new Date('2022-12-08T15:06:54.000Z'), + resourceCreated: new Date('2019-12-30T23:00:00.000Z'), + title: 'Photographie aérienne 2021 sur la commune de Saint-Etienne-Roilaye', + abstract: + 'Orthophotoplan 2021 sur le territoire de la commune de Saint-Etienne-Roilaye.', + ownerOrganization: { name: null, translations: {} }, + contacts: [ + { + email: 'missing@missing.com', + role: 'unspecified', + organization: { name: null, translations: {} }, + }, + ], + contactsForResource: [ + { + email: 'missing@missing.com', + role: 'unspecified', + organization: { name: null, translations: {} }, + }, + ], + keywords: [ + { + thesaurus: { + id: 'geonetwork.thesaurus.external.theme.inspire-theme', + name: 'GEMET - INSPIRE themes, version 1.0', + url: new URL( + 'http://geo.compiegnois.fr/geonetwork/srv/fre/thesaurus.download?ref=external.theme.inspire-theme' + ), + }, + label: 'Ortho-imagerie', + type: 'theme', + translations: {}, + }, + { + thesaurus: { + id: 'geonetwork.thesaurus.external.theme.gemet', + name: 'GEMET - Concepts, version 2.4', + url: new URL( + 'http://geo.compiegnois.fr/geonetwork/srv/en/thesaurus.download?ref=external.theme.gemet' + ), + }, + label: 'photographie aérienne', + type: 'theme', + translations: {}, + }, + { label: 'ortho', type: 'theme', translations: {} }, + { + thesaurus: { + id: 'geonetwork.thesaurus.external.place.GeoCompiegnois', + name: 'Collectivités du Pays Compiégnois', + url: new URL( + 'http://geo.compiegnois.fr/geonetwork/srv/en/thesaurus.download?ref=external.place.GeoCompiegnois' + ), + }, + label: 'Saint-Étienne-Roilaye*60572', + type: 'place', + translations: {}, + }, + ], + topics: ['imageryBaseMapsEarthCover'], + licenses: [], + legalConstraints: [], + securityConstraints: [], + otherConstraints: [ + { + text: 'Utilisation libre sous réserve de mentionner la source (a minima le nom du producteur) et la date de sa dernière mise à jour', + translations: {}, + }, + ], + overviews: [ + { + url: new URL( + 'https://geo.compiegnois.fr/geonetwork/srv/api/records/982b6e7d-61f5-43b3-983d-ebae8bc3892d/attachments/Saint-Etienne-Roilaye_ortho_2021.jpg' + ), + }, + ], + spatialExtents: [ + { bbox: [2.987, 49.3372, 3.0286, 49.3783], translations: {} }, + ], + onlineResources: [ + { + type: 'link', + url: new URL( + 'http://geo.compiegnois.fr/documents/cartotheque/Saint-Etienne-Roilaye_ortho_2021.jpg' + ), + name: 'Orthophotoplan 2021 de la commune de Saint-Etienne-Roilaye', + translations: {}, + }, + ], + translations: {}, + lineage: null, + temporalExtents: [{ start: null, end: null }], + reuseType: 'map', } diff --git a/libs/api/metadata-converter/src/lib/fixtures/georhena.iso19139.reuse+solaire.xml b/libs/api/metadata-converter/src/lib/fixtures/georhena.iso19139.reuse+solaire.xml new file mode 100644 index 0000000000..e09fd8ba64 --- /dev/null +++ b/libs/api/metadata-converter/src/lib/fixtures/georhena.iso19139.reuse+solaire.xml @@ -0,0 +1,665 @@ + + + + 015e6d20-0d69-4ae7-adfe-85c588aac141 + + + + + + + + + + + + Carte statique + + + + + GeoRhena: Système d'Information Géographique du Rhin Supérieur + + + GeoRhena: Système d'Information Géographique du Rhin Supérieur + + + GeoRhena: Geographische Informationssystem des Oberrheins + + + GeoRhena: Geographical Information System of the Upper Rhine + + + + + + + + + 00 33 3 89 30 63 91 + + + + + + + 100, avenue d'Alsace + + + 100, avenue d'Alsace + + + 100, avenue d'Alsace + + + + + COLMAR + + + 68000 + + + FR + + + FR + + + FR + + + + + + + + + http://www.georhena.eu + + + text/html + + + + + + + + + + + + 2024-11-04T10:13:51.413244Z + + + ISO 19115:2003/19139 + + + 1.0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Production d'énergie renouvelable de type solaire thermique par km² en 2016 + + + Production d'énergie renouvelable de type solaire thermique par km² en 2016 + + + Produktion von erneuerbarer Energie aus Solarthermie pro km² im 2016 + + + Solar thermal renewable energy production per km² in 2016 + + + + + + + + + + 2022-11-30 + + + + + + + + + + 2023-03-20 + + + + + + + + + + 04_2022_301 + + + + + + + Cette carte représente la production d'énergie renouvelable de type solaire thermique en kWh/km² par commune sur le Rhin supérieur. Le solaire thermique est la chaleur produite par les chauffe-eau solaires collectifs et individuels ainsi que par les systèmes solaires combinés (chauffage et eau chaude sanitaire). + + + Cette carte représente la production d'énergie renouvelable de type solaire thermique en kWh/km² par commune sur le Rhin supérieur. Le solaire thermique est la chaleur produite par les chauffe-eau solaires collectifs et individuels ainsi que par les systèmes solaires combinés (chauffage et eau chaude sanitaire). + + + Diese Karte stellt die Produktion von erneuerbarer Energie aus Solarthermie in kWh/km² pro Gemeinde am Oberrhein dar. Die Solarthermie ist die Wärme, die durch kollektive, individuelle sowie Gemeinschafts-Solaranlagen erzeugt wird (Heizung sowie Warmwasseraufbereitung). + + + This map shows the production of renewable energy of the solar thermal type in kWh/km² per municipality on the Upper Rhine. Solar thermal is the heat produced by collective and individual solar water heaters as well as combined solar systems (heating and domestic hot water). + + + + + + + + + + GeoRhena + + + GeoRhena + + + GeoRhena + + + GeoRhena + + + + + + + + + 00 33 3 89 30 63 91 + + + + + + + 100, avenue d'Alsace + + + 100, avenue d'Alsace + + + 100, avenue d'Alsace + + + + + COLMAR + + + 68000 + + + FRANCE + + + FRANCE + + + FRANCE + + + + + contact@georhena.eu + + + contact@georhena.eu + + + GeoRhena + + + + + + + + + + + + + + + + + + + ATMO Grand Est + + + ATMO Grand Est + + + ATMO Grand Est + + + ATMO Grand Est + + + + + + + + + +33 (0)3 69 24 73 73 + + + + + + + 5, rue de Madrid + + + 5, rue de Madrid + + + + + Schiltigheim + + + 67300 + + + France + + + France + + + + + contact@atmo-grandest.eu + + + contact@atmo-grandest.eu + + + + + + + + + https://www.atmo-grandest.eu + + + WWW:LINK-1.0-http--partners + + + + + + + + + + + + + + + + + + + + + + + + + + + https://geoportal.georhena.eu/geonetwork/srv/api/records/015e6d20-0d69-4ae7-adfe-85c588aac141/attachments/04_2022_301.png + + + 04_2022_301.png + + + 04_2022_301.png + + + 04_2022_301.png + + + 04_2022_301.png + + + + + + + + + Carte + + + Carte + + + Karte + + + Map + + + + + + + + + Rhin Supérieur + + + Rhin Supérieur + + + Oberrhein + + + Upper Rhine + + + + + + + + + production d'énergie électrique + + + production d'énergie électrique + + + Elektrizitätserzeugung + + + electricity generation + + + + + source d'énergie renouvelable + + + source d'énergie renouvelable + + + Erneuerbare Energiequelle + + + renewable energy source + + + + + énergie solaire + + + énergie solaire + + + Solarenergie + + + solar energy + + + + + + + + + + GEMET - Concepts, version 2.4 + + + GEMET - Concepts, version 2.4 + + + + + + + 2010-01-13 + + + + + + + + + + geonetwork.thesaurus.external.theme.gemet + + + + + + + + + + + Licence CC BY + + + Licence CC BY + + + Licence CC BY + + + Licence CC BY + + + + + + + + + + + + + + + Pas d'autre limitation + + + Pas d'autre limitation + + + Keine andere Einschränkung + + + No other limitation + + + + + + + + + + + 100000 + + + + + + + + + + + + + environment + + + + + + + + 2016-01-01 + 2016-12-31 + + + + + + + + + + + + + + Carte au format PDF + + + Carte au format PDF + + + Karte in PDF + + + PDF Map + + + + + - + + + + + + + + + https://www.georhena.eu/sites/default/files/Cartes/04_2022_301.pdf + + + WWW:DOWNLOAD-1.0-http--download + + + Téléchargement du Pdf + + + Téléchargement du Pdf + + + Pdf herunterladen + + + Pdf Download + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/api/metadata-converter/src/lib/fixtures/georhena.records.ts b/libs/api/metadata-converter/src/lib/fixtures/georhena.records.ts new file mode 100644 index 0000000000..a1c232971b --- /dev/null +++ b/libs/api/metadata-converter/src/lib/fixtures/georhena.records.ts @@ -0,0 +1,216 @@ +import { ReuseRecord } from '@geonetwork-ui/common/domain/model/record' + +export const GEORHENA_REUSE_SOLAIRE_RECORD: ReuseRecord = { + uniqueIdentifier: '015e6d20-0d69-4ae7-adfe-85c588aac141', + resourceIdentifier: '04_2022_301', + kind: 'reuse', + otherLanguages: ['de', 'en'], + defaultLanguage: 'fr', + recordUpdated: new Date('2024-11-04T10:13:51.413Z'), + resourceCreated: new Date('2022-11-30T00:00:00.000Z'), + resourcePublished: new Date('2023-03-20T00:00:00.000Z'), + title: + "Production d'énergie renouvelable de type solaire thermique par km² en 2016", + abstract: + "Cette carte représente la production d'énergie renouvelable de type solaire thermique en kWh/km² par commune sur le Rhin supérieur. Le solaire thermique est la chaleur produite par les chauffe-eau solaires collectifs et individuels ainsi que par les systèmes solaires combinés (chauffage et eau chaude sanitaire).", + ownerOrganization: { + name: "GeoRhena: Système d'Information Géographique du Rhin Supérieur", + website: new URL('http://www.georhena.eu/'), + translations: { + name: { + de: 'GeoRhena: Geographische Informationssystem des Oberrheins', + en: 'GeoRhena: Geographical Information System of the Upper Rhine', + }, + }, + }, + contacts: [ + { + email: 'missing@missing.com', + role: 'author', + organization: { + name: "GeoRhena: Système d'Information Géographique du Rhin Supérieur", + website: new URL('http://www.georhena.eu/'), + translations: { + name: { + de: 'GeoRhena: Geographische Informationssystem des Oberrheins', + en: 'GeoRhena: Geographical Information System of the Upper Rhine', + }, + }, + }, + address: "100, avenue d'Alsace, COLMAR, 68000, FR", + }, + ], + contactsForResource: [ + { + email: 'contact@georhena.eu', + role: 'processor', + organization: { + name: 'GeoRhena', + translations: { + name: { + de: 'GeoRhena', + en: 'GeoRhena', + }, + }, + }, + address: "100, avenue d'Alsace, COLMAR, 68000, FRANCE", + phone: '00 33 3 89 30 63 91', + }, + { + email: 'contact@atmo-grandest.eu', + role: 'custodian', + organization: { + name: 'ATMO Grand Est', + website: new URL('https://www.atmo-grandest.eu/'), + translations: { + name: { + de: 'ATMO Grand Est', + en: 'ATMO Grand Est', + }, + }, + }, + address: '5, rue de Madrid, Schiltigheim, 67300, France', + phone: '+33 (0)3 69 24 73 73', + }, + ], + keywords: [ + { + label: 'Carte', + type: 'other', + translations: { + label: { + de: 'Karte', + en: 'Map', + }, + }, + }, + { + label: 'Rhin Supérieur', + type: 'other', + translations: { + label: { + de: 'Oberrhein', + en: 'Upper Rhine', + }, + }, + }, + { + thesaurus: { + id: 'geonetwork.thesaurus.external.theme.gemet', + name: 'GEMET - Concepts, version 2.4', + url: new URL( + 'https://geoportal.georhena.eu/geonetwork/srv/api/registries/vocabularies/external.theme.gemet' + ), + }, + label: "production d'énergie électrique", + type: 'theme', + translations: { + label: { + de: 'Elektrizitätserzeugung', + en: 'electricity generation', + }, + }, + }, + { + thesaurus: { + id: 'geonetwork.thesaurus.external.theme.gemet', + name: 'GEMET - Concepts, version 2.4', + url: new URL( + 'https://geoportal.georhena.eu/geonetwork/srv/api/registries/vocabularies/external.theme.gemet' + ), + }, + label: "source d'énergie renouvelable", + type: 'theme', + translations: { + label: { + de: 'Erneuerbare Energiequelle', + en: 'renewable energy source', + }, + }, + }, + { + thesaurus: { + id: 'geonetwork.thesaurus.external.theme.gemet', + name: 'GEMET - Concepts, version 2.4', + url: new URL( + 'https://geoportal.georhena.eu/geonetwork/srv/api/registries/vocabularies/external.theme.gemet' + ), + }, + label: 'énergie solaire', + type: 'theme', + translations: { + label: { + de: 'Solarenergie', + en: 'solar energy', + }, + }, + }, + ], + topics: ['environment'], + licenses: [], + legalConstraints: [ + { + text: "Pas d'autre limitation", + translations: { + text: { + de: 'Keine andere Einschränkung', + en: 'No other limitation', + }, + }, + }, + ], + securityConstraints: [], + otherConstraints: [ + { + text: 'Licence CC BY', + translations: { + text: { + de: 'Licence CC BY', + en: 'Licence CC BY', + }, + }, + }, + ], + overviews: [ + { + url: new URL( + 'https://geoportal.georhena.eu/geonetwork/srv/api/records/015e6d20-0d69-4ae7-adfe-85c588aac141/attachments/04_2022_301.png' + ), + description: '04_2022_301.png', + }, + ], + spatialExtents: [], + onlineResources: [ + { + type: 'link', + url: new URL( + 'https://www.georhena.eu/sites/default/files/Cartes/04_2022_301.pdf' + ), + name: 'Téléchargement du Pdf', + translations: { + name: { + de: 'Pdf herunterladen', + en: 'Pdf Download', + }, + }, + }, + ], + translations: { + title: { + de: 'Produktion von erneuerbarer Energie aus Solarthermie pro km² im 2016', + en: 'Solar thermal renewable energy production per km² in 2016', + }, + abstract: { + de: 'Diese Karte stellt die Produktion von erneuerbarer Energie aus Solarthermie in kWh/km² pro Gemeinde am Oberrhein dar. Die Solarthermie ist die Wärme, die durch kollektive, individuelle sowie Gemeinschafts-Solaranlagen erzeugt wird (Heizung sowie Warmwasseraufbereitung).', + en: 'This map shows the production of renewable energy of the solar thermal type in kWh/km² per municipality on the Upper Rhine. Solar thermal is the heat produced by collective and individual solar water heaters as well as combined solar systems (heating and domestic hot water).', + }, + }, + lineage: null, + temporalExtents: [ + { + start: new Date('2016-01-01T00:00:00.000Z'), + end: new Date('2016-12-31T00:00:00.000Z'), + }, + ], + reuseType: 'map', +} diff --git a/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.spec.ts b/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.spec.ts index 1365f8e79e..74063fa568 100644 --- a/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.spec.ts +++ b/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.spec.ts @@ -4,6 +4,7 @@ import { parseXmlString, xmlToString } from '../xml-utils' import { GEO2FRANCE_PLU_DATASET_RECORD } from '../fixtures/geo2france.records' import { GEO2FRANCE_REUSE_ONGULES_RECORD } from '../fixtures/geo2france.records.reuse+ongules' import { GEO2FRANCE_REUSE_ROILAYE_RECORD } from '../fixtures/geo2france.records.reuse+roilaye' +import { GEORHENA_REUSE_SOLAIRE_RECORD } from '../fixtures/georhena.records' import { GEOCAT_CH_DATASET_RECORD, GEOCAT_CH_SERVICE_RECORD, @@ -18,8 +19,12 @@ import GEO2FRANCE_SERVICE_EAUXUSEES from '../fixtures/geo2france.iso19139.servic // @ts-ignore import GEO2FRANCE_REUSE_ONGULES from '../fixtures/geo2france.iso19139.reuse+ongules.xml' // @ts-ignore +import GEO2FRANCE_REUSE_ONGULES_DUMMY from '../fixtures/geo2france.iso19139.reuse+ongules_dummy.xml' +// @ts-ignore import GEO2FRANCE_REUSE_ROILAYE from '../fixtures/geo2france.iso19139.reuse+roilaye.xml' // @ts-ignore +import GEORHENA_REUSE_SOLAIRE from '../fixtures/georhena.iso19139.reuse+solaire.xml' +// @ts-ignore import GENERIC_DATASET_PLUS_GEO2FRANCE_DATASET from '../fixtures/generic-dataset+geo2france-plu.iso19139.xml' // @ts-ignore import GEOCAT_CH_DATASET from '../fixtures/geocat-ch.iso19139.dataset.xml' @@ -27,6 +32,7 @@ import GEOCAT_CH_DATASET from '../fixtures/geocat-ch.iso19139.dataset.xml' import GEOCAT_CH_SERVICE from '../fixtures/geocat-ch.iso19139.service.xml' // @ts-ignore import GENERIC_DATASET from '../fixtures/generic-dataset.iso19139.xml' +import { ReuseRecord } from '@geonetwork-ui/common/domain/model/record' // this makes the xml go through the same formatting as the converter function formatXml(xmlString: string) { @@ -49,14 +55,18 @@ describe('ISO19139 converter', () => { const record = await converter.readRecord(GEO2FRANCE_SERVICE_EAUXUSEES) expect(record).toStrictEqual(GEO2FRANCE_SERVICE_EAUXUSEES_RECORD) }) - it('produces the corresponding record (geo2france reuse ongulets)', async () => { + it('produces the corresponding record (geo2france reuse ongulets interactivemap)', async () => { const record = await converter.readRecord(GEO2FRANCE_REUSE_ONGULES) expect(record).toStrictEqual(GEO2FRANCE_REUSE_ONGULES_RECORD) }) - it('produces the corresponding record (geo2france reuse roilaye)', async () => { + it('produces the corresponding record (geo2france reuse roilaye map)', async () => { const record = await converter.readRecord(GEO2FRANCE_REUSE_ROILAYE) expect(record).toStrictEqual(GEO2FRANCE_REUSE_ROILAYE_RECORD) }) + it('produces the corresponding record (georhena reuse solaire staticmap)', async () => { + const record = await converter.readRecord(GEORHENA_REUSE_SOLAIRE) + expect(record).toStrictEqual(GEORHENA_REUSE_SOLAIRE_RECORD) + }) it('produces the corresponding record (geocat.ch dataset)', async () => { const record = await converter.readRecord(GEOCAT_CH_DATASET) expect(record).toStrictEqual(GEOCAT_CH_DATASET_RECORD) @@ -85,6 +95,19 @@ describe('ISO19139 converter', () => { ) expect(xml).toStrictEqual(ref) }) + it('produces a valid XML document for third-party XML when record reuseType has been updated from "map" to "application"', async () => { + const recordChanged: ReuseRecord = { + ...GEO2FRANCE_REUSE_ONGULES_RECORD, // reuseType is 'map' here + ...{ reuseType: 'application' }, + } + // parse and output xml to guarantee identical formatting + const ref = xmlToString(parseXmlString(GEO2FRANCE_REUSE_ONGULES_DUMMY)) + const xml = await converter.writeRecord( + recordChanged, + GEO2FRANCE_REUSE_ONGULES + ) + expect(xml).toStrictEqual(ref) + }) }) describe('idempotency', () => { @@ -97,7 +120,7 @@ describe('ISO19139 converter', () => { ) expect(backAndForth).toStrictEqual(formatXml(GEO2FRANCE_PLU_DATASET)) }) - it('keeps the record unchanged (geo2france service traitement des eaux usées)', async () => { + it('keeps the record unchanged (geo2france service traitement des eaux usées)', async () => { const backAndForth = await converter.writeRecord( await converter.readRecord(GEO2FRANCE_SERVICE_EAUXUSEES), GEO2FRANCE_SERVICE_EAUXUSEES @@ -106,6 +129,31 @@ describe('ISO19139 converter', () => { formatXml(GEO2FRANCE_SERVICE_EAUXUSEES) ) }) + it('keeps the record unchanged (geo2france reuse ongulets interactivemap)', async () => { + const backAndForth = await converter.writeRecord( + await converter.readRecord(GEO2FRANCE_REUSE_ONGULES), + GEO2FRANCE_REUSE_ONGULES + ) + expect(backAndForth).toStrictEqual( + formatXml(GEO2FRANCE_REUSE_ONGULES) + ) + }) + it('keeps the record unchanged (geo2france reuse roilaye map)', async () => { + const backAndForth = await converter.writeRecord( + await converter.readRecord(GEO2FRANCE_REUSE_ROILAYE), + GEO2FRANCE_REUSE_ROILAYE + ) + expect(backAndForth).toStrictEqual( + formatXml(GEO2FRANCE_REUSE_ROILAYE) + ) + }) + it('keeps the record unchanged (georhena reuse solaire staticmap)', async () => { + const backAndForth = await converter.writeRecord( + await converter.readRecord(GEORHENA_REUSE_SOLAIRE), + GEORHENA_REUSE_SOLAIRE + ) + expect(backAndForth).toStrictEqual(formatXml(GEORHENA_REUSE_SOLAIRE)) + }) it('keeps the record unchanged (service)', async () => { const backAndForth = await converter.writeRecord( await converter.readRecord(GEOCAT_CH_SERVICE), diff --git a/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.ts b/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.ts index 2a33a8c586..3e5caddf88 100644 --- a/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.ts +++ b/libs/api/metadata-converter/src/lib/iso19139/iso19139.converter.ts @@ -340,6 +340,7 @@ export class Iso19139Converter extends BaseConverter { fieldChanged('uniqueIdentifier') && this.writers['uniqueIdentifier'](record, rootEl) + fieldChanged('reuseType') && this.writers['kind'](record, rootEl) fieldChanged('kind') && this.writers['kind'](record, rootEl) fieldChanged('defaultLanguage') && this.writers['defaultLanguage'](record, rootEl)