Using GetMetadata to Get the Properties of a Specified Metadata Object |
A GetMetadata request gets requested attributes for the specified object and only the Id=, Name= and Desc= attributes of any associated objects that are requested directly in the <METADATA> element, or indirectly by the OMI_ALL (1) flag. To get additional attributes for associated objects, you must set the OMI_TEMPLATE (4) flag and specify a template in the GetMetadata request. A template is an additional property string that is specified in the OPTIONS parameter of the GetMetadata method within a <TEMPLATES> element.
The template can request additional attributes for the object specified in the <METADATA> element of the GetMetadata request, it can request specific attributes for associated objects requested in the <METADATA> element, and it can request additional associated objects. The attributes that are requested in the template are retrieved, in addition to the attributes that are requested in the <METADATA> element or that are requested by other GetMetadata flags. For information on how to create a template, see Using Templates.
The following is an example of a GetMetadata request that sets the OMI_TEMPLATE flag and specifies a template to request additional attributes for both the specified object and associated objects requested in the <METADATA> element:
<GetMetadata> <Metadata> <Column Id="A53TPPVI.A5000001" Name="" Desc="" ColumnType="" SASFormat=""> <Table/> </Column> </Metadata> <NS>SAS</NS> <!-- OMI_TEMPLATE --> <Flags>4</Flags> <Options> <Templates> <Column Id="" ColumnLength="" BeginPosition="" EndPosition=""/> <PhysicalTable Id="" Name="" Desc="" DBMSType="" MemberType=""/> </Templates> </Options> </GetMetadata>
In the request, note the following:
The <METADATA> element specifies the metadata type, an object instance identifier, four of the metadata type's attributes, and the association name Table.
The <NS> element specifies the namespace.
The <FLAGS> element specifies the number representing the OMI_TEMPLATE flag.
The <OPTIONS> element contains a <TEMPLATES> element and two templates. The first template specifies additional attributes to retrieve for the Column object identified in the <METADATA> element. The second template specifies additional attributes to retrieve for the PhysicalTable object that is associated with the Column object through the Table association name that was requested in the <METADATA> element.
Here is an example of the output that is returned by the SAS Metadata Server:
<!-- Using the GETMETADATA method. --> <Column Id="A53TPPVI.A5000001" Name="City" Desc="City of Sales Office" ColumnType="12" SASFormat="$Char32." ColumnLength="32" BeginPosition="0" EndPosition="0"> <Table> <PhysicalTable Id="A53TPPVI.A4000001" Name="Sales Offices" Desc="Sales offices in NW region" DBMSType="" MemberType=""/> </Table> </Column>
The GetMetadata method gets the values of the Name=, Desc=, ColumnType=, SASFormat=, ColumnLength=, BeginPosition=, and EndPosition= attributes of the specified Column object. In addition, it gets the Id=, Name=, Desc=, DBMSType=, and MemberType= attributes of the Column object's associated PhysicalTable object.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.