Removing record assignments

You can update records in a running data domain by removing standard attribute and managed value assignments.

The updateRecords sub-operation of ingestChanges includes two elements that delete assignments from records in the data domain:
  • deleteAssignments
  • wildcardDeleteAssignments

Both elements can delete standard attribute assignments as well as managed value assignments. Note that the standard attributes or managed values are not removed from the data domain; they are removed only from the specified records.

You can use both elements in the same updateRecords operation. In this case, the wildcardDeleteAssignments request is processed before the deleteAssignments request.

Both elements are case sensitive, including the standard attribute and managed value names and their assignment values.

Assignment deletion cannot be combined in the same request with any operation that would modify the assignments to be deleted.

Note: If you submit the ingestChanges request after a Transaction Web Service request that starts an transaction, the request must specify the outer transaction ID. If no outer transactions have been started, the ID attribute must be omitted in the request.

deleteAssignments request

The deleteAssignments element of the updateRecords sub-operation removes individual standard attribute and/or managed value assignments from the records in your data domain, but does not otherwise affect the record. You can remove one or more assignments in the same request.

To remove individual assignments:
  • Indicate which records should be affected by including the EQL filter inside the recordSpecifier element in your request.
  • Specify the attributes from which assignment values should be deleted for these records.
The deleteAssignments request format is:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
  xmlns:ns="http://www.endeca.com/MDEX/ingest/2/0" 
  xmlns:ns1="http://www.endeca.com/MDEX/XQuery/2009/09">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:ingestChanges>
         <ns:updateRecords>
            <ns:recordSpecifier>?</ns:recordSpecifier>
              <ns:deleteAssignments>
                <ns1:attribute name="?">?</ns1:attribute>
            </ns:deleteAssignments>
          </ns:updateRecords>
      </ns:ingestChanges>
   </soapenv:Body>
</soapenv:Envelope>
where the string that you add to a recordSpecifier element is an EQL expression identifying records.
The following example illustrates this request:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
  xmlns:ns="http://www.endeca.com/MDEX/ingest/2/0" 
  xmlns:ns1="http://www.endeca.com/MDEX/XQuery/2009/09">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:ingestChanges>
         <ns:updateRecords>
            <ns:recordSpecifier>"price" > 45</ns:recordSpecifier>
              <ns:deleteAssignments>
                <ns1:attribute name="color">purple</ns1:attribute>
            </ns:deleteAssignments>
          </ns:updateRecords>
      </ns:ingestChanges>
   </soapenv:Body>
</soapenv:Envelope>

The example removes one value, purple, of the color standard attribute assignment for all records whose values for the price attribute are higher than 45.

A successful ingestChangesResponse returned from the above sample request should look like this:
<ingest:ingestChangesResponse 
xmlns:ingest="http://www.endeca.com/MDEX/ingest/2/0">
  <ingest:numPropertiesCreated>0</ingest:numPropertiesCreated>
  <ingest:numRecordsAffected>4</ingest:numRecordsAffected>
  <ingest:numRecordsDeleted>0</ingest:numRecordsDeleted>
</ingest:ingestChangesResponse>

The numRecordsAffected element in the response shows that four records were successfully modified.

wildcardDeleteAssignments request

The wildcardDeleteAssignments element of the updateRecords element in the ingestChanges operation removes all assignments from the same standard attribute or managed value at once. This operation, similar to assignment deletion, cannot be combined with any operation that modifies the assignments to be deleted.

The request must use EQL statement inside the recordSpecifier element to identify the record to be updated, and also list the attribute name from which all assignments must be deleted. The wildcardDeleteAssignments request format is:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
  xmlns:ns="http://www.endeca.com/MDEX/ingest/2/0" 
  xmlns:ns1="http://www.endeca.com/MDEX/XQuery/2009/09">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:ingestChanges>
          <ns:updateRecords>
            <ns:recordSpecifier>?</ns:recordSpecifier>
               <ns:wildcardDeleteAssignments>
                <ns1:attribute name="?"/>
               </ns:wildcardDeleteAssignments>
            </ns:updateRecords>
       </ns:ingestChanges>
   </soapenv:Body>
</soapenv:Envelope>
To remove all assignments on one record from a specific standard attribute or managed value, use a single tag with the attribute, as in this example that removes all assignments from the color standard attribute for the record whose partID is P4000:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
  xmlns:ns="http://www.endeca.com/MDEX/ingest/2/0" 
  xmlns:ns1="http://www.endeca.com/MDEX/XQuery/2009/09">
   <soapenv:Header/>
   <soapenv:Body>
      <ns:ingestChanges>
          <ns:updateRecords>
            <ns:recordSpecifier>"partID" = 'P4000'</ns:recordSpecifier>
               <ns:wildcardDeleteAssignments>
                <ns1:attribute name="color"/>
               </ns:wildcardDeleteAssignments>
            </ns:updateRecords>
       </ns:ingestChanges>
   </soapenv:Body>
</soapenv:Envelope>

In the example, if record P4000 had six assignments from the color standard attribute, then all six assignments would be removed.

If successful, the operation returns the following ingestChangesResponse, indicating that one record was affected:
<ingest:ingestChangesResponse xmlns:ingest="http://www.endeca.com/MDEX/ingest/2/0">
   <ingest:numPropertiesCreated>0</ingest:numPropertiesCreated>
   <ingest:numRecordsAffected>1</ingest:numRecordsAffected>
   <ingest:numRecordsDeleted>0</ingest:numRecordsDeleted>
</ingest:ingestChangesResponse>