AML, The Extensible PLM Language, Explained

This week’s PLM guru gets straight into the secret sauce of Aras Innovator, aka AML (Adaptive Markup Language).  Aras takes XML to a whole new level in the form of the AML dialect built into the very core of Aras Innovator.

But why does that matter, you say?  AML is simple, easy to learn and extensible.  If you choose to embrace it, you can form your own AML and use it to run your enterprise PLM Platform in ways only you could dream up.

So how do you get started down this path of AML enlightenment?  Training’s a great start and for those of you that have the background knowledge and want to beef up to the next level, I sat down with Aras’s own head of product development, Rob McAveney, for a few tips.

Rob says to get started; there are really only a few tags that you need to know:

<AML> tag:  serves as the top level of an AML document, and may contain one or more <Item> tags.<Item> tags may contain one or more property tags (named after the properties) and a <Relationships> tag, which in turn may contain one or more <Item> tags.

Got it?  Okay, let’s cover some examples.  Keep in mind that everything in Aras Innovator is an Item and every Item has a type (its ItemType name).  Permissions are also checked on every request and an error will be returned if the requested operation is not valid for the current user.

The following AML will retrieve a Part Item with a known id:

<AML>
 <Item type="Part" action="get" id="F48DB69482994831BC26314A1586B39E"/>
</AML>

Breaking this down, the <Item> tag has three attributes: type, action and id.  In this case, the type is “Part”, but it could just as easily have been “Document” or “Process Plan” or even “ItemType”.  In other words, you can get any Item in Aras Innovator with this form of AML.  The actionattribute is set to “get” in this case.

Other actions include “add”, “update” and “delete”.  By specifying an id, we know that this transaction is for a single item with a unique id.  When this AML is submitted, the Aras Innovator server will return AML with more detail (including the properties of the requested item), like this:

<Item type="Part" typeId="4F1AC04A2B484F3ABA4E20DB63808A88"
      id="F48DB69482994831BC26314A1586B39E" page="1" pagemax="1" itemmax="1">
 <state>Preliminary</state>
 <name>Widget Assembly</name>
 <item_number>1000</item_number>
 ... (more properties)
</Item>

If you don’t happen to know the id of the item you’re looking for, property values in the request can be used as search criteria, like this:

<AML>
 <Item type="Part" action="get">
  <item_number>1000</item_number>
 </Item>
</AML>

This AML will return the same as above, assuming there is only one Part with an item_number of “1000”.  Let’s say you want to get both the Part item and its BOM (Bill of Materials).  You would use the <Relationships> tag to specify the relationships you’re looking for, like this:

<AML>
 <Item type="Part" action="get">
  <item_number>1000</item_number>
  <Relationships>
   <Item type="Part BOM" action="get"/>
  </Relationships>
 </Item>
</AML>

The structure of the response from the server would then look like this (properties removed for clarity):

<Item type="Part" id="F48DB69482994831BC26314A1586B39E">
 <item_number>1000</item_number>
 <Relationships>
  <Item type="Part BOM" id="0A2746E857BA4BFCB606FF447919A9E0">
    <quantity>10</quantity>
    <related_id>
     <Item type="Part" id="DF3822B9D0CD4C6991F5800161D9B48D">
      <item_number>1001</item_number>
     </Item> 
    </related_id>
  </Item>
  <Item type="Part BOM" id="6F5E747AC2F84108B41E0576F73E9466">
   <quantity>2</quantity>
   <related_id>
    <Item type="Part" id="E2B9A29631074C8F94F25FC93C74AAB6"/>
      <item_number>1002</item_number>
     </Item> 
   </related_id>
  </Item>
 </Relationships>
</Item>

Note that the top-level Part item contains a <Relationships> tag, which contains 2 Part BOM items.  Each Part BOM item then has a related_id property, which contains the child Part item.

So, the response is telling you that Part 1000 has a BOM that includes Part 1001 (quantity 10) and Part 1002 (quantity 2).  This response is showing a single-level BOM, but a multi-level one would simply have relationships under Parts 1001 and 1002.

The repeated Item / Relationships / Item / related_id pattern is a hallmark of AML.

Other actions, like “add”, work similarly.  Example:

<AML>
 <Item type="Part" action="add">
  <item_number>1003</item_number>
 </Item>
</AML>

Simply creates a new Part and sets its item_number to “1003”.  The response from the server is similar to that of a “get” request, and includes data that is set automatically by the server, like id and state:

<Item type="Part" typeId="4F1AC04A2B484F3ABA4E20DB63808A88"
      id="57D2BD8E6BC34A8C85E54242C88FD205" page="1" pagemax="1" itemmax="1">
 <state>Preliminary</state>
 <item_number>1003</item_number>
 ... (more properties)
</Item>

There are multiple instances where you could use this type of AML like writing your own Aras Innovator client, connecting Aras Innovator to another web service, use XSLT to transform AML to another dialect.

Want to see more in the future about AML?  Let us know in the feedback and we’ll see about getting Rob to share with us again soon!

Leave a Reply