Previous Page | Next Page

Deleting Metadata Objects

Using the DeleteMetadata Method to Delete Application Metadata Objects

The DeleteMetadata method removes metadata from a SAS Metadata Repository. In SAS 9.2, a DeleteMetadata method that is issued in the SAS namespace removes the specified object. If the OMI_TEMPLATES (4) flag is set, DeleteMetadata also deletes associated objects that are specified in a user-defined template. The template is passed to the SAS Metadata Server in a <TEMPLATE> element within a <TEMPLATES> element in the OPTIONS parameter.


Using DeleteMetadata to Delete a Specified SAS Metadata Model Object

The default behavior of the DeleteMetadata method is to delete the metadata object specified in the INMETADATA parameter. Submit a metadata property string that identifies the object to be deleted in the INMETADATA parameter. Identify the object to delete by its metadata type and 17-character metadata identifier. It is not necessary to specify the object's Name= value. Set the OMI_TRUSTED_CLIENT flag in the FLAGS parameter. The OMI_TRUSTED_CLIENT flag must be set in all requests that add, delete, or update metadata on the SAS Metadata Server.

In addition to the specified object, the DeleteMetadata method automatically deletes any associated objects that have a 1:1 cardinality to the specified metadata object as defined in the SAS Metadata Model. A 1:1 cardinality indicates a dependent relationship between two objects.

The DeleteMetadata does not list the Id= values of deleted associated objects in its output. Set the OMI_RETURN_LIST (1024) flag to include these Id= values in the output.

To delete multiple objects at once, stack their property strings in the INMETADATA parameter. When deleting multiple objects, do not specify associated objects that have a 1:1 cardinality in the DeleteMetadata method. If you specify them, the SAS Metadata Server attempts to locate objects that have already been deleted, and it aborts the delete operation when they are not found. You can prevent the delete operation from being aborted by setting the OMI_IGNORE_NOTFOUND (134217728) flag. However, it is recommended that you do not specify the associated objects instead.

The following is an example of a DeleteMetadata request that deletes an individual metadata object, in this case, a SASLibrary object. The OMI_RETURN_LIST (1024) flag is set with the OMI_TRUSTED_CLIENT (268435456) flag so that the OUTMETADATA parameter returns the identifiers of any dependent objects that might be deleted with the SASLibrary object. The request is formatted for the INMETADATA parameter of the DoRequest method.

<DeleteMetadata>
   <Metadata>
      <SASLibrary Id='A2345678.A2000001'/>
  </Metadata> 
   <NS>SAS</NS>
   <Flags>268436480</Flags>
   <Options/>
</DeleteMetadata>

For a listing of SAS Metadata Model metadata types that can be deleted with the DeleteMetadata method, see the SAS 9.2 Metadata Model documentation.

For information about how to also delete associated objects in a DeleteMetadata request, see Deleting Associated Objects Using a User-Defined Template.

Previous Page | Next Page | Top of Page