Paths

Section - TM Language Reference

A path is a way of describing the relationship between elements and attributes in a model.

A path can as simple as Rel_a.AttributeName

or as complex as Rel_a.Rel_b.Rel_c.Rel_d.Rel_e.Rel_f.Rel_g.AttributeName

SML supports a variety of transform styles. Almost all transform problems can be solved in:

Both extremes should be avoided; remember that the goals are readability and maintainability.

If correctly used, paths are easy to both read and navigate when writing transforms.    The following Control Key short cuts allow you to explore and navigate paths from within a transform.

Key Combination Name Description
CTRL + E Expand Expands model tree(s) to display node(s) referenced in current transform statement
CTRL + G Iterate Call Group Displays in turn each transform which calls the current transform
CTRL + K Visit Cascade Transform Displays any transform called by current transform
CTRL + T Insert/Visit Cascade Transform Displays any transform called by current transform; if no transforms are called, creates new called transform
CTRL + Y Visit Caller(s) Displays transforms which call current transform

 

Notes:

Paths and Cardinality

When two elements are related cardinality rules govern the nature of that relationship.  The cardinality defines the minimum number of origin elements that must exist for each destination element, and vice versa.  The options are either one (1) or many (n).

Transformation Manager only allows the use of complex paths in a single transform where the relationship between the elements in that path can be defined as 1.1.1.1.1.n or 1.1.1.1.1

Transformation Manager will not let you define a single transform that use complex paths where the relationships between elements in the path can be defined by a pattern such as 1.n.n.1.n.  Here you will have to break the single transform into a number of separate dependent transforms which each obey the cardinality rules described above.


Examples

Example 1

    ProductLineItem := ListOfOrderDetail;

 

This means: pick up the destination of the ListOfOrderDetail relationship (assume this is a ListOfOrderDetail) and transform it to the destination end of the ProductLineItem relationship (assume this is a ProductLineItem) using a suitable transform.

If both the source and the target are XML, Transformation Manager will construct and invoke a default transform if no explicit transform exists. That transform will be as follows: 

TRANSFORM ProductLineItem <- ListOfOrderDetail $Content := $Content;

If no ListOfOrderDetail items exist then no ProductLineItem will be created. You can test for this explicitly by:

IF (ListOfOrderDetail) THEN

    ProductLineItem := ListOfOrderDetail;

ELSE

    . . . tell the user we didn't get one

END_IF

 

It is not strictly necessary to do this.

If you attempt to transform from an attribute to an XML element or from an XML element to an attribute then the system will assume that you intend to transform to the content of the element. Thus  

ProductLineItem := ListOfOrderDetail.attr;

is quietly expanded to: 

ProductLineItem.$Content := ListOfOrderDetail.attr;

while

ProductLineItem.attr := ListOfOrderDetail;

is quietly expanded to:

ProductLineItem.attr := ListOfOrderDetail.$Content;

 

Example 2

fromRole.PartnerRoleDescription.GlobalPartnerRoleClassificationCode := 'X';

tells Transformation Manager to make a fromRole relationship, then a PartnerRoleDescription then a GlobalPartnerRoleClassificationCode and then set its content to the literal string value X.

Example 3

IF (OrderHeader.OrderReference.BuyerRefNum.Reference.RefNum) THEN

    . . . XXX

END_IF;

 

If the current source has a OrderHeader which has a OrderReference which has a BuyerRefNum which has a Reference which has a RefNum then do XXX. If any of these relationships have multiple cardinality then it takes the first item (if there is one).