Aller au contenu

Updating a set of records

From the editor board, editors can do batch editing on multiple records.

Batch editing consists of 3 steps:

  • Choose a set of records
  • Define edits
  • Apply changes

Defining edits

Warning: You can break things here. When defining xpath and using delete or replace mode, be sure to test on a single record before applying changes to a lot of records. If needed, back up your record first.

Changes are defined on a per standard basis. A set of default fields to edit is available (and can be extended in the config-editor.xml file of the standard).

An advanced mode is also available to define custom edits. The advanced mode consists of:

  • an optional title
  • a type of update (gn_add, gn_create, gn_replace, gn_delete)
  • a mandatory XPath to point to the element(s) to update. The XPath may contain a filter expression.
  • a value, which could be an XML snippet or a text string if the mode is not delete.

To add an element, eg. add a new keyword section in first position:

  "xpath": "/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:descriptiveKeywords[1]",
  "value": "<gn_add><gmd:descriptiveKeywords xmlns:gmd=\"\" xmlns:gco=\"\"><gmd:MD_Keywords><gmd:keyword><gco:CharacterString>Waste water</gco:CharacterString></gmd:keyword><gmd:type><gmd:MD_KeywordTypeCode codeList=\"./resources/codeList.xml#MD_KeywordTypeCode\" codeListValue=\"theme\"/></gmd:type></gmd:MD_Keywords></gmd:descriptiveKeywords></gn_add>"

To remove an element, eg. remove all online resource having a protocol OGC:WMS:

  "xpath": ".//gmd:onLine[*/gmd:protocol/*/text() = 'OGC:WMS']",

To replace an element, eg. replacing a keyword value:

  "xpath":".//gmd:keyword/gco:CharacterString[text() = 'wastewater']",
  "value":"<gn_replace>Waste water</gn_replace>"

Applying changes

When applying changes, user privileges apply, so if the user cannot edit a selected record, batch edits will not be applied to that record.

The batch edit report explains how many records were processed:

Batch editing can also be applied using the API: doc/api/index.html#/records/batchEdit>


Add a new keyword sections in identification

  • Mode: Add

  • XPath (the parent element of the XML snippet to add). The XML is inserted in the position defined in the XSD.

  • XML

    <mri:descriptiveKeywords xmlns:mri=""
          <gcx:Anchor xlink:href="">Service d’accès aux cartes</gcx:Anchor>

Replace a keyword section encoded using a CharacterString to an Anchor

  • Mode: Replace

  • XPath (the parent element of the XML snippet to insert)

    .//mri:descriptiveKeywords[*/mri:keyword/gco:CharacterString/text() = 'infoMapAccessService']
  • XML

    <mri:MD_Keywords  xmlns:cit=""
        <gcx:Anchor xlink:href="">Service d’accès aux cartes</gcx:Anchor>
        <mri:MD_KeywordTypeCode codeList=""
               <gcx:Anchor xlink:href="">Classification of spatial data services</gcx:Anchor>
                     <cit:CI_DateTypeCode codeList=""
                     <gcx:Anchor xlink:href="">geonetwork.thesaurus.external.theme.httpinspireeceuropaeumetadatacodelistSpatialDataServiceCategory-SpatialDataServiceCategory</gcx:Anchor>

Remove a keyword block

  • Mode: Remove

  • XPath (the second descriptiveKeywords block corresponding to a thesaurus 'Champ géographique')

        [*/mri:thesaurusName/*/cit:title/gcx:Anchor = 'Champ géographique'])[2]
  • XML (N/A)

Remove a keyword

  • Mode: Remove

  • XPath (All keyword with value 'IDP_reference')

    .//gmd:keyword[*/text() = 'IDP_reference']
  • XML (N/A)

Remove associatedResource with a type partOfSeamlessDatabase only if it is a serie

  • Mode: Remove

  • XPath

    .[mdb:metadataScope/*/mdb:resourceScope/*/@codeListValue = 'series']//mri:associatedResource[*/mri:associationType/*/@codeListValue = "partOfSeamlessDatabase"]
  • XML (N/A)