SPW-DIG / metawal-core-geonetwork

Metawal - Catalogue pour l'information géographique de Wallonie
http://metawal.wallonie.be
GNU General Public License v2.0
3 stars 1 forks source link

Batch edit - ajout des catégories HVD #852

Closed vbombaerts closed 1 year ago

vbombaerts commented 1 year ago

Ajouter les catégories HVD aux données INSPIRE en fonction des thèmes.

vbombaerts commented 1 year ago

@marceaulouis xpath : /mdb:MD_Metadata/mdb:identificationInfo/mri:MD_DataIdentification/mri:descriptiveKeywords

snippet :

         <mri:descriptiveKeywords>
            <mri:MD_Keywords>
               <mri:keyword>
                  <gco:CharacterString>Météorologiques</gco:CharacterString>
               </mri:keyword>
               <mri:type>
                  <mri:MD_KeywordTypeCode codeList="http://standards.iso.org/iso/19115/resources/Codelists/cat/codelists.xml#MD_KeywordTypeCode"
                                          codeListValue="theme"/>
               </mri:type>
               <mri:thesaurusName>
                  <cit:CI_Citation>
                     <cit:title>
                        <gcx:Anchor xlink:href="http://data.europa.eu/bna/asd487ae75">High-value dataset categories</gcx:Anchor>
                     </cit:title>
                     <cit:date>
                        <cit:CI_Date>
                           <cit:date>
                              <gco:Date>2023-10-05</gco:Date>
                           </cit:date>
                           <cit:dateType>
                              <cit:CI_DateTypeCode codeList="http://standards.iso.org/iso/19115/resources/Codelists/cat/codelists.xml#CI_DateTypeCode"
                                                   codeListValue="publication"/>
                           </cit:dateType>
                        </cit:CI_Date>
                     </cit:date>
                     <cit:date>
                        <cit:CI_Date>
                           <cit:date>
                              <gco:Date>2023-10-05</gco:Date>
                           </cit:date>
                           <cit:dateType>
                              <cit:CI_DateTypeCode codeList="http://standards.iso.org/iso/19115/resources/Codelists/cat/codelists.xml#CI_DateTypeCode"
                                                   codeListValue="publication"/>
                           </cit:dateType>
                        </cit:CI_Date>
                     </cit:date>
                     <cit:identifier>
                        <mcc:MD_Identifier>
                           <mcc:code>
                              <gcx:Anchor xlink:href="https://metawal.wallonie.be/geonetwork/srv/api/registries/vocabularies/external.theme.high-value-dataset-category">geonetwork.thesaurus.external.theme.high-value-dataset-category</gcx:Anchor>
                           </mcc:code>
                        </mcc:MD_Identifier>
                     </cit:identifier>
                  </cit:CI_Citation>
               </mri:thesaurusName>
            </mri:MD_Keywords>
         </mri:descriptiveKeywords>

A tester. Snippet à adapter en fonction de la catégorie.

marceaulouis commented 1 year ago

Je n'arrive pas, les previews des modifs sont vides donc j'ajoute une erreur..

J'ai au final :

XPath : /mdb:MD_Metadata/*/mri:MD_DataIdentification

Value :

<mri:descriptiveKeywords xmlns:mri="http://standards.iso.org/iso/19115/-3/mri/1.0" xmlns:gco="http://standards.iso.org/iso/19115/-3/gco/1.0" xmlns:cit="http://standards.iso.org/iso/19115/-3/cit/2.0" xmlns:gcx="http://standards.iso.org/iso/19115/-3/gcx/1.0" xmlns:mcc="http://standards.iso.org/iso/19115/-3/mcc/1.0">
<mri:MD_Keywords>
               <mri:keyword>
                  <gco:CharacterString>Géospatial</gco:CharacterString>
               </mri:keyword>
               <mri:type>
                  <mri:MD_KeywordTypeCode codeList="http://standards.iso.org/iso/19115/resources/Codelists/cat/codelists.xml#MD_KeywordTypeCode"
                                          codeListValue="theme"/>
               </mri:type>
               <mri:thesaurusName>
                  <cit:CI_Citation>
                     <cit:title>
                        <gcx:Anchor xlink:href="http://data.europa.eu/bna/asd487ae75">High-value dataset categories</gcx:Anchor>
                     </cit:title>
                     <cit:date>
                        <cit:CI_Date>
                           <cit:date>
                              <gco:Date>2023-10-05</gco:Date>
                           </cit:date>
                           <cit:dateType>
                              <cit:CI_DateTypeCode codeList="http://standards.iso.org/iso/19115/resources/Codelists/cat/codelists.xml#CI_DateTypeCode"
                                                   codeListValue="publication"/>
                           </cit:dateType>
                        </cit:CI_Date>
                     </cit:date>
                     <cit:date>
                        <cit:CI_Date>
                           <cit:date>
                              <gco:Date>2023-10-05</gco:Date>
                           </cit:date>
                           <cit:dateType>
                              <cit:CI_DateTypeCode codeList="http://standards.iso.org/iso/19115/resources/Codelists/cat/codelists.xml#CI_DateTypeCode"
                                                   codeListValue="publication"/>
                           </cit:dateType>
                        </cit:CI_Date>
                     </cit:date>
                     <cit:identifier>
                        <mcc:MD_Identifier>
                           <mcc:code>
                              <gcx:Anchor xlink:href="https://metawal.wallonie.be/geonetwork/srv/api/registries/vocabularies/external.theme.high-value-dataset-category">geonetwork.thesaurus.external.theme.high-value-dataset-category</gcx:Anchor>
                           </mcc:code>
                        </mcc:MD_Identifier>
                     </cit:identifier>
                  </cit:CI_Citation>
               </mri:thesaurusName>
            </mri:MD_Keywords>
</mri:descriptiveKeywords>

J'ai testé sur ces fiches, si jamais c'est lié à une fiche en particulier :

https://metawal.wallonie.be/geonetwork/srv/fre/catalog.search#/metadata/56d7efe4-b25b-4d82-adca-c2c193b1b4fa https://metawal.wallonie.be/geonetwork/srv/fre/catalog.search#/metadata/4bef2af5-422a-45b0-9e9a-fa692fb0f18c

fxprunayre commented 1 year ago

Il manque le namespace XLINK et l'erreur ne remonte pas. J'ai également modifié le xpath.

A tester avec:

{
  "field": "XPath_1",
  "insertMode": "gn_add",
  "xpath": "/mdb:identificationInfo/*",
  "value": "<mri:descriptiveKeywords xmlns:mri=\"http://standards.iso.org/iso/19115/-3/mri/1.0\" xmlns:gco=\"http://standards.iso.org/iso/19115/-3/gco/1.0\" xmlns:cit=\"http://standards.iso.org/iso/19115/-3/cit/2.0\" xmlns:gcx=\"http://standards.iso.org/iso/19115/-3/gcx/1.0\"  xmlns:mcc=\"http://standards.iso.org/iso/19115/-3/mcc/1.0\"  xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n<mri:MD_Keywords>\n               <mri:keyword>\n                  <gco:CharacterString>Géospatial</gco:CharacterString>\n               </mri:keyword>\n               <mri:type>\n                  <mri:MD_KeywordTypeCode codeList=\"http://standards.iso.org/iso/19115/resources/Codelists/cat/codelists.xml#MD_KeywordTypeCode\"\n                                          codeListValue=\"theme\"/>\n               </mri:type>\n               <mri:thesaurusName>\n                  <cit:CI_Citation>\n                     <cit:title>\n                        <gcx:Anchor xlink:href=\"http://data.europa.eu/bna/asd487ae75\">High-value dataset categories</gcx:Anchor>\n                     </cit:title>\n                     <cit:date>\n                        <cit:CI_Date>\n                           <cit:date>\n                              <gco:Date>2023-10-05</gco:Date>\n                           </cit:date>\n                           <cit:dateType>\n                              <cit:CI_DateTypeCode codeList=\"http://standards.iso.org/iso/19115/resources/Codelists/cat/codelists.xml#CI_DateTypeCode\"\n                                                   codeListValue=\"publication\"/>\n                           </cit:dateType>\n                        </cit:CI_Date>\n                     </cit:date>\n                     <cit:date>\n                        <cit:CI_Date>\n                           <cit:date>\n                              <gco:Date>2023-10-05</gco:Date>\n                           </cit:date>\n                           <cit:dateType>\n                              <cit:CI_DateTypeCode codeList=\"http://standards.iso.org/iso/19115/resources/Codelists/cat/codelists.xml#CI_DateTypeCode\"\n                                                   codeListValue=\"publication\"/>\n                           </cit:dateType>\n                        </cit:CI_Date>\n                     </cit:date>\n                     <cit:identifier>\n                        <mcc:MD_Identifier>\n                           <mcc:code>\n                              <gcx:Anchor xlink:href=\"https://metawal.wallonie.be/geonetwork/srv/api/registries/vocabularies/external.theme.high-value-dataset-category\">geonetwork.thesaurus.external.theme.high-value-dataset-category</gcx:Anchor>\n                           </mcc:code>\n                        </mcc:MD_Identifier>\n                     </cit:identifier>\n                  </cit:CI_Citation>\n               </mri:thesaurusName>\n            </mri:MD_Keywords>\n</mri:descriptiveKeywords>",
  "isXpath": true,
  "condition": "count(mdb:identificationInfo/*/mri:descriptiveKeywords[*/mri:thesaurusName/*/cit:title/*/text() = 'High-value dataset categories']) = 0"
}

J'ai ajouté une condition pour ne pas ajouter s'il y a déjà un bloc pour ce thésaurus.