GetMetadata

Short Description

Gets specified attributes and associations for the specified metadata object.

Category

Read methods

Syntax

rc=GetMetadata(inMetadata,outMetadata,ns,flags,options);

Parameters

Method Parameters
Parameter
Type
Direction
Description
rc
N
out
Return code for the method. For more information, see Return Code.
inMetadata
C
in
Metadata property string that identifies the object and attributes and associations to be read.
outMetadata
C
out
Returned metadata property string that includes the results of the Read operation.
ns
C
in
Namespace to use as the context for the request.
flags
L
in
OMI_ALL=1
Specifies to get all of the attributes that are documented for the requested metadata type in its Attributes table, and all of the associations that are documented in its Associations table, whether they have values stored for them or not. The results include both unique and inherited attributes and associations. If the returned XML stream includes references to any associated objects, GetMetadata returns only general, identifying information for the associated objects.
OMI_ALL_SIMPLE=8
Specifies to get all of the attributes of the requested object. If the request returns associated objects, it gets all attributes for those objects as well. The results include both unique and inherited attributes.
OMI_DEPENDENCY_USED_BY=16384
Specifies to include associations to objects that exist in all project repositories in the method results.
OMI_FULL_OBJECT= 2
New in SAS 9.3, instructs the SAS Metadata Server to use a type definition from the SAS type dictionary to expand the specified object's metadata definition. The server reads the values in the object's PublicType and UsageVersion attributes to determine which type definition to use to process the request.
OMI_INCLUDE_SUBTYPES=16
Specifies to get the specified properties for metadata objects that are subtypes of the specified metadata type, in addition to the specified metadata object. The OMI_INCLUDE_SUBTYPES flag must be set with the OMI_TEMPLATE flag and a template, or the flag is ignored.
OMI_LOCK=32768
Locks the specified object and any associated objects selected by GetMetadata flags and options from update by everyone except the caller.
OMI_NOEXPAND_DUPS=524288
Modifies OMI_TEMPLATE and OMI_FULL_OBJECT processing so that objects are expanded by the associated template (user-defined or from the type dictionary) only once per primary object specified in the INMETADATA parameter.
OMI_NOFORMAT=67108864
Causes date, time, and datetime values in the output XML stream to be returned as raw SAS date, SAS time, and SAS datetime floating-point values. Without the OMI_NOFORMAT flag, the default US-English locale is used to format the values into recognizable character strings.
OMI_SUCCINCT=2048
Specifies to omit attributes and associations that do not contain a value or that contain a null value from the returned XML string.
OMI_TEMPLATE=4
Checks the OPTIONS parameter for user-defined templates that specify which metadata properties to return. The user-specified templates are submitted in a <TEMPLATES> element in the OPTIONS parameter.
OMI_UNLOCK=131072
Unlocks an object lock that is held by the caller.
OMI_UNLOCK_FORCE=262144
Unlocks an object lock that is held by another user.
options
C
in
Passed indicator for options.
<DOAS Credential="credHandle"/>
Enables a client to make a metadata request for another user. For more information, see <DOAS> Option.
<TEMPLATES>
In SAS 9.3, there are two ways to specify templates. You can specify a metadata type and properties to return directly in the <TEMPLATES> element. Or, you can specify multiple templates, each contained within a <TEMPLATE> subelement in the <TEMPLATES> element. Either way, the <TEMPLATES> element must be specified with the OMI_TEMPLATE flag. For more information, see Using Templates.

Details

The GetMetadata method gets specified attributes and associations for the specified SAS Metadata Model metadata object.
The method’s default behavior is to get attributes and associations that are specified in the INMETADATA parameter of the method call. As an alternative, you can set one or more flags that specify to get all attributes or all attributes and associations. For usage information, see Getting the Properties of a Specified Metadata Object.
In SAS 9.3, the method supports three new flags—OMI_FULL_OBJECT (2), OMI_UNLOCK (131072), and OMI_UNLOCK_FORCE (262144). The OMI_FULL_OBJECT flag instructs the SAS Metadata Server to use a type definition from the SAS type dictionary to identify the association names to expand when getting the specified object. The flag is effective only if the specified object is a PrimaryType subtype in the SAS Metadata Model, and only if it stores the name of a type definition in the PublicType attribute. The type definition internalizes information about the primary metadata type and associations that will be retrieved so that clients do not need to know the details of the object’s logical metadata definition. For more information, see GetMetadata and Logical Type Definitions and Using the OMI_FULL_OBJECT Flag.
Many resources and information assets are described in a SAS metadata repository by a set of associated SAS Metadata Model metadata types. The GetMetadata method has no concept of a logical metadata definition unless you set the OMI_FULL_OBJECT flag, or you specify a user-defined template that specifies association names to expand with the specified object. In SAS 9.3, the GetMetadata method supports an alternative template form that makes it easier to map a user-defined template to an object, and easier to control the scope of associated objects that are returned. For more information, see SAS 9.3 Template Changes and Creating Templates for the Get Methods. Templates are discussed in Getting Attributes and Associations of Associated Objects.
The OMI_UNLOCK and OMI_UNLOCK_FORCE flags release object locks set with the OMI_LOCK flag.
The GetMetadata method uses the US-English locale to format date, time, and datetime values. Set the OMI_NOFORMAT (67108864) flag to return these values as SAS floating-point values that you can format.
A GetMetadata method that requests associated objects and that is issued in a public repository (the foundation or a custom repository) returns associated objects from all public repositories. If you want to include associated objects that are in project repositories in a public GetMetadata request, set the OMI_DEPENDENCY_USED_BY flag.
The OMI_INCLUDE_SUBTYPES flag extends processing of user-defined templates to include associated metadata objects that are subtypes of the specified metadata object. This functionality is useful when you want to retrieve a common set of properties for multiple SAS Metadata Model metadata objects. For more information, see Using GetMetadata to Get Common Properties for Sets of Objects.
For more information about specifying GetMetadata flags, see Using IOMI Flags. For information about interdependencies between GetMetadata flags, see Combining GetMetadata Flags.

Example 1: Standard Interface

The following is an example of how to issue a GetMetadata method regardless of the programming environment. The request gets the Name, Description, and Column values of the PhysicalTable with an ID of A5345678.A5000001.
<!-- Create a metadata list to be passed to GetMetadata method -->

inMetadata= "<PhysicalTable Id="A5345678.A5000001" Name="" Desc="">
              <Columns/>
            </PhysicalTable>";
ns="SAS";
flags=0;
options="";

rc=GetMetadata(inMetadata, outMetadata, ns, flags, options);

<!-- outMetadata XML string returned -->
<PhysicalTable Id="A5345678.A5000001" Name="New Table" Desc="New Table added 
through API">
  <Columns>
    <Column Id="A5345678.A3000001" Name="New Column" Desc="New Column added 
through API"/>
    <Column Id="A5345678.A3000002" Name="New Column2" Desc="New Column2 added 
through API"/>
  </Columns>
</PhysicalTable>

Example 2: DoRequest Method

The following is an example of an XML string that shows how to format the request in example 1 for the INMETADATA parameter of the DoRequest method.
<!-- XML string for inMetadata parameter of DoRequest method call -->

<GetMetadata>
  <Metadata>
    <PhysicalTable Id="A5345678.A500001" Name="" Desc="">
       <Columns/>
    </PhysicalTable>
  </Metadata>
  <NS>SAS</NS>
  <Flags>0</Flags>
  <Options/>
</GetMetadata>

Related Methods