更新一组记录

在编辑器板中,编辑器可以对多个记录执行批编辑。

../../_images/batch-editing-menu.png

批量编辑包括3个步骤:

  • 选择一组记录

  • 定义编辑

  • 应用更改

定义编辑

警告:你可以在这里打破东西。当定义xpath并使用delete或replace模式时,在对许多记录应用更改之前,请确保对单个记录进行测试。如果需要,请先备份您的记录。

更改是在每个标准的基础上定义的。可以使用一组要编辑的默认字段(可以在 config-editor.xml 标准文件)。

../../_images/batch-editing-iso19139fields.png

高级模式也可用于定义自定义编辑。高级模式包括:

  • 可选择的标题

  • 一种更新 (gn_addgn_creategn_replacegn_delete

  • 指向要更新的元素的必需XPath。XPath可以包含筛选器表达式。

  • 一个值,如果模式不是 delete .

../../_images/batch-editing-advancedmode.png

要添加元素,例如在第一个位置添加新的关键字部分:

[{
  "xpath": "/gmd:identificationInfo/gmd:MD_DataIdentification/gmd:descriptiveKeywords[1]",
  "value": "<gn_add><gmd:descriptiveKeywords xmlns:gmd=\"http://www.isotc211.org/2005/gmd\" xmlns:gco=\"http://www.isotc211.org/2005/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>"
}]

删除一个元素,例如删除所有有协议的联机资源 OGC:WMS

[{
  "xpath": ".//gmd:onLine[*/gmd:protocol/*/text() = 'OGC:WMS']",
  "value":"<gn_delete></gn_delete>"
}]

要替换元素,例如替换关键字值:

[{
  "xpath":".//gmd:keyword/gco:CharacterString[text() = 'wastewater']",
  "value":"<gn_replace>Waste water</gn_replace>"
}]
../../_images/batch-editing-replace.png

应用更改

应用更改时,将应用用户权限,因此,如果用户无法编辑选定的记录,则不会对该记录应用批编辑。

批编辑报告解释了处理了多少记录:

../../_images/batch-editing-report.png

批处理编辑也可以使用 API

实例

在标识中添加新的关键字节

  • 模式:添加

  • XPath(要添加的XML片段的父元素)。XML插入到XSD中定义的位置。

    .//srv:SV_ServiceIdentification
    
  • XML

    <mri:descriptiveKeywords xmlns:mri="http://standards.iso.org/iso/19115/-3/mri/1.0"
                             xmlns:gcx="http://standards.iso.org/iso/19115/-3/gcx/1.0"
                             xmlns:xlink="http://www.w3.org/1999/xlink">
      <mri:MD_Keywords>
        <mri:keyword>
          <gcx:Anchor xlink:href="http://inspire.ec.europa.eu/metadata-codelist/SpatialDataServiceCategory/infoMapAccessService">Service d’accès aux cartes</gcx:Anchor>
        </mri:keyword>
      </mri:MD_Keywords>
    </mri:descriptiveKeywords>
    

将使用字符字符串编码的关键字节替换为锚点

  • 模式:替换

  • XPath(要插入的XML片段的父元素)

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

    <mri:MD_Keywords  xmlns:cit="http://standards.iso.org/iso/19115/-3/cit/2.0"
                      xmlns:mri="http://standards.iso.org/iso/19115/-3/mri/1.0"
                      xmlns:mcc="http://standards.iso.org/iso/19115/-3/mcc/1.0"
                      xmlns:gco="http://standards.iso.org/iso/19115/-3/gco/1.0"
                      xmlns:gcx="http://standards.iso.org/iso/19115/-3/gcx/1.0"
                      xmlns:xlink="http://www.w3.org/1999/xlink">
      <mri:keyword>
        <gcx:Anchor xlink:href="http://inspire.ec.europa.eu/metadata-codelist/SpatialDataServiceCategory/infoMapAccessService">Service d’accès aux cartes</gcx:Anchor>
      </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://inspire.ec.europa.eu/metadata-codelist/SpatialDataServiceCategory#">Classification of spatial data services</gcx:Anchor>
            </cit:title>
            <cit:date>
               <cit:CI_Date>
                  <cit:date>
                     <gco:Date>2008-12-03</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="http://metawal.wallonie.be/geonetwork/srv/fre/thesaurus.download?ref=external.theme.httpinspireeceuropaeumetadatacodelistSpatialDataServiceCategory-SpatialDataServiceCategory">geonetwork.thesaurus.external.theme.httpinspireeceuropaeumetadatacodelistSpatialDataServiceCategory-SpatialDataServiceCategory</gcx:Anchor>
                  </mcc:code>
               </mcc:MD_Identifier>
            </cit:identifier>
         </cit:CI_Citation>
      </mri:thesaurusName>
    </mri:MD_Keywords>
    

删除关键字块

  • 模式:删除

  • XPath(对应于同义词表Champ géographique的第二个descriptiveKeywords块)

    (.//mri:descriptiveKeywords
        [*/mri:thesaurusName/*/cit:title/gcx:Anchor = 'Champ géographique'])[2]
    
  • XML(不适用)

删除关键字

  • 模式:删除

  • XPath(值为'IDP_reference'的所有关键字)

    .//gmd:keyword[*/text() = 'IDP_reference']
    
  • XML(不适用)

仅当seamlessdatabase的part类型为serie时,才删除它的associatedResource

  • 模式:删除

  • XPath

    
    

    . [mdb:metadataScope//mdb:resourceScope//@codeListValue = 'series'] //mri:关联资源 [/mri:associationType//@codeListValue = "partOfSeamlessDatabase"]

  • XML(不适用)