CSW Transaction Update
From the spec (section 7.2.6.2): The update action is used to modify existing records in the catalogue. The update action contains a single new metadata record instance and a predicate that defines the set of catalogue records that will be modified. The predicate may identify zero or more records that are to be modified by the update action. The encoding of the predicate is specified in the protocol binding and may be further qualified or extended in an Application Profile.
For instance, the update action has two modes of operation: you can either send the full metadata record for it to be replaced, or you could specify which properties to update their values for. GeoNetwork supports both modes of operation. Here's an example request to update a number of individual properties:
<csw:Transaction service="CSW" version="2.0.2" xmlns:csw="http://www.opengis.net/cat/csw/2.0.2" ....>
<csw:Update>
<csw:RecordProperty>
<csw:Name>OrganisationName</csw:Name>
<csw:Value>Automated Geographic Reference Center - Updated property</csw:Value>
</csw:RecordProperty>
<csw:RecordProperty>
<csw:Name>MetadataPointOfContact</csw:Name>
<csw:Value>Utah State Goverment - Updated property</csw:Value>
</csw:RecordProperty>
<!-- XPath property -->
<csw:RecordProperty>
<csw:Name>gmd:identificationInfo/gmd:MD_DataIdentification/gmd:citation/gmd:CI_Citation/gmd:title/gco:CharacterString</csw:Name>
<csw:Value>Municipalities 2004 (Archive) - Updated property</csw:Value>
</csw:RecordProperty>
<csw:Constraint version="1.1.0">
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>Identifier</ogc:PropertyName>
<ogc:Literal>bf7ab961-a69f-48e9-a6da-61c207de86d6</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
</csw:Constraint>
</csw:Update>
</csw:Transaction>
If you want to update the full record then use a request like the following:
<csw:Transaction service="CSW" version="2.0.2" xmlns:csw="http://www.opengis.net/cat/csw" ... >
<csw:Update>
<gmd:MD_Metadata>
.... full metadata record contents here....
</gmd:MD_Metadata>
<csw:Constraint version="1.1.0">
<ogc:Filter>
<ogc:PropertyIsEqualTo>
<ogc:PropertyName>Identifier</ogc:PropertyName>
<ogc:Literal>4e4390ff-ab16-44f1-bb4d-812d1da6b7e3</ogc:Literal>
</ogc:PropertyIsEqualTo>
</ogc:Filter>
</csw:Constraint>
</csw:Update>
</csw:Transaction>
That should also make the <csw:Constraint> element unnecessary, but GeoNetwork requires it anyway.
Sample response:
<?xml version="1.0" ?><csw:TransactionResponse xmlns:csw="http://www.opengis.net/cat/csw/2.0.2">
<csw:TransactionSummary>
<csw:totalInserted>0</csw:totalInserted>
<csw:totalUpdated>1</csw:totalUpdated>
<csw:totalDeleted>0</csw:totalDeleted>
</csw:TransactionSummary>
</csw:TransactionResponse>
Exception reports:
The following is a sample exception report occurred when trying an update with a missing <csw:Constraint> element
<?xml version="1.0" ?>
<ows:ExceptionReport version="1.0.0"
xmlns:ows="http://www.opengis.net/ows"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/ows http://schemas.opengis.net/ows/1.0.0/owsExceptionReport.xsd">
<ows:Exception exceptionCode="NoApplicableCode">
<ows:ExceptionText>Cannot process transaction: null</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>
See the sample file transaction_update_full_record.xml attached to the GN_Transactions_in_python page.
