By default, the GetMetadata
method gets only the Id, Name and Desc attributes of any associated
objects that are returned by a request. If you set the OMI_ALL_SIMPLE
(8) flag, you can get all of the XML attributes of the specified object
and any associated objects. However, if you want to get specific attributes
of associated objects, or associations of associated objects, you
must set the OMI_TEMPLATE (4) flag and specify a template in the GetMetadata
request.
A template is one or
more additional property strings that you specify in the OPTIONS parameter
of the GetMetadata method within a <TEMPLATES> element. The
property strings specify additional attributes and associations to
retrieve for the primary object in the INMETADATA parameter, an associated
object that is requested in the INMETADATA parameter, or an associated
object that is requested in another template. The attributes that
are requested in the template are retrieved in addition to any attributes
that are requested in the INMETADATA parameter or that are requested
by other GetMetadata flags.
For information about how to create a template, see Creating Templates for the Get Methods. SAS introduces several new template features in SAS 9.3,
including a new template form.
The following is an
example of a GetMetadata request that sets the OMI_TEMPLATE flag and
specifies a template. Templates request additional attributes for
both the specified object and associated objects requested in the
INMETADATA parameter (<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 metadata type
attributes, and the association name Table.
-
The <NS> element specifies
the SAS namespace.
-
The <FLAGS> element specifies
the number representing the OMI_TEMPLATE flag (4).
-
The <OPTIONS> element contains
a <TEMPLATES> element and two property strings. Each property
string is a template. The first template specifies additional attributes
to retrieve for the Column object identified in the <METADATA>
element. The second template specifies 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.