Using GetMetadataObjects to Get All Metadata of a Specified Metadata Type |
To get all metadata objects of a specified metadata type, the SAS Open Metadata Interface provides the GetMetadataObjects method. The default behavior of the GetMetadataObjects method is to get general, identifying information for each object of the metadata type specified in the TYPE parameter from the repository specified in the REPOSID parameter. The method supports flags and options that enable you to expand the request to get additional properties for each object, to search additional repositories, and to filter the objects that are returned by the request.
The following is an example of a GetMetadataObjects request that does not contain flags or options. The request gets a list of all objects of the PhysicalTable metadata type in Test repository 1, and their Id= and Name= attributes. The method call is formatted for the INMETADATA parameter of the DoRequest method.
<GetMetadataObjects> <!--Reposid specifies Test repository 1 --> <Reposid>A0000001.A53TPPVI</Reposid> <Type>PhysicalTable</Type> <Objects/> <NS>SAS</NS> <Flags>0</Flags> <Options/> </GetMetadataObjects>
In the request, note the following:
The <REPOSID> element specifies the repository from which to get the objects.
The <TYPE> element specifies the metadata type whose objects you want to list.
The <NS> element specifies the namespace.
The <FLAGS> and <OPTIONS> elements, although blank in this request, support flags and additional XML elements that expand or filter the GetMetadataObjects request.
The <OBJECTS> element is an output parameter. Here is an example of the output returned by the SAS Metadata Server:
<!-- Using the GETMETADATAOBJECTS method. --> <Objects> <PhysicalTable Id="A53TPPVI.A4000001" Name="Sales Offices"/> <PhysicalTable Id="A53TPPVI.A4000002" Name="Sales Associates"/> </Objects>
Test repository 1 has two objects of metadata type PhysicalTable defined.
A GetMetadataObjects request can be expanded to get additional attributes, to get associated objects, to include subtypes, and to get objects from additional repositories.
A GetMetadataObjects request can be filtered to get only objects that have specific attributes and associations. You can also filter the associated objects that are returned in a request.
For more information, see:
Expanding a GetMetadataObjects Request to Return Additional Properties
Expanding a GetMetadataObjects Request to Include Additional Repositories
Filtering the Associated Objects That Are Retrieved By a GetMetadataObjects Request
The GetMetadataObjects method is typically used to list application objects in a repository. But, it can also be used to list repositories. For more information, see Using GetMetadataObjects To List Repositories.
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.