Previous Page | Next Page

Adding Metadata Objects

Example of an AddMetadata Request That Creates Multiple, Unrelated Metadata Objects

The following method call shows another way to format an AddMetadata request that creates multiple objects. The request creates a second table object, named Sales Associates, and creates objects representing the table's columns by stacking their metadata property strings. A Column object cannot be created without an association to a table object. Therefore, a symbolic name is assigned to the PhysicalTable object to enable the Column objects to reference the PhysicalTable object before it is created.

<AddMetadata>
 <Metadata>
 <PhysicalTable Id="$Employees" Name="Sales Associates" 
     Desc="Sales associates in NW region" PublicType="Table">
     <TablePackages>
       <SASLibrary ObjRef="A53TPPVI.A1000001"/>
     </TablePackages>
  </PhysicalTable>
   
  <Column
     Name="Name"
     Desc="Name of employee"
     ColumnName="Employee_Name"
     SASColumnName="Employee"
     ColumnType="12"
     SASColumnType="C"
     ColumnLength="32"
     SASColumnLength="32"
     SASFormat="$Char32."
     SASInformat="$32."
     PublicType="Column" >
     <Table>
        <PhysicalTable ObjRef="$Employees"/> 
     </Table>
  </Column>

  <Column
     Name="Address"
     Desc="Home Address"
     ColumnName="Employee_Address"
     SASColumnName="Home_Address"
     ColumnType="12"
     SASColumnType="C"
     ColumnLength="32"
     SASColumnLength="32"
     SASFormat="$Char32."
     SASInformat="$32."
     PublicType="Column">
     <Table>
        <PhysicalTable ObjRef="$Employees"/> 
     </Table>
  </Column>

  <Column
     Name="Title"
     Desc="Job grade"
     ColumnName="Title"
     SASColumnName="Title"
     ColumnType="12"
     SASColumnType="C"
     ColumnLength="32"
     SASColumnLength="32"
     SASFormat="$Char32."
     SASInformat="$32."
     PublicType="Column">
     <Table>
        <PhysicalTable ObjRef="$Employees"/> 
     </Table>
  </Column>

 </Metadata>
 <Reposid>A0000001.A53TPPVI</Reposid>
 <NS>SAS</NS>
 <Flags>268435456</Flags>
 <Options/>
</AddMetadata>

In this method call, the <REPOSID>, <NS>, and <FLAGS> elements contain the same values as in Example of an AddMetadata Request That Creates an Application Metadata Object. In the <METADATA> element, note the following:

Here is an example of the output returned by the SAS Metadata Server:

<!-- Using the ADDMETADATA method. -->

<PhysicalTable Id="A53TPPVI.A4000002" Name="Sales Associates" 
  Desc="Sales associates in NW region" PublicType="Table">
 <TablePackages>
  <SASLibrary ObjRef="A53TPPVI.A1000001"/>
 </TablePackages>
</PhysicalTable>
<Column Name="Name" Desc="Name of employee" ColumnName="Employee_Name" 
  SASColumnName="Employee" ColumnType="12" SASColumnType="C" ColumnLength="32" 
  SASColumnLength="32" SASFormat="$Char32." SASInformat="$32." PublicType="Column"
  Id="A53TPPVI.A5000005">
  <Table>
   <PhysicalTable ObjRef="A53TPPVI.A4000002"/>
  </Table>
</Column>
<Column Name="Address" Desc="Home Address" ColumnName="Employee_Address" 
  SASColumnName="Home_Address" ColumnType="12" SASColumnType="C" ColumnLength="32" 
  SASColumnLength="32" SASFormat="$Char32." SASInformat="$32." 
  PublicType="Column" Id="A53TPPVI.A5000006">
  <Table>
   <PhysicalTable ObjRef="A53TPPVI.A4000002"/>
  </Table>
</Column>
<Column Name="Title" Desc="Job grade" ColumnName="Title" SASColumnName="Title" 
  ColumnType="12" SASColumnType="C" ColumnLength="32" SASColumnLength="32" 
  SASFormat="$Char32." SASInformat="$32." PublicType="Column" Id="A53TPPVI.A5000007">
  <Table>
   <PhysicalTable ObjRef="A53TPPVI.A4000002"/>
  </Table>
</Column>

The symbolic name is replaced with the PhysicalTable object's unique object identifier in the output everywhere that it was used.

Previous Page | Next Page | Top of Page