Several asset definitions (constraint, operation, annotation) can have an additional context definition. For example, it is possible to relate a constraint to a property or a sub-property by specifying an appropriate context definition.
When no context is specified, all expressions relate directly to the structure they are defined in. When a context is specified, this context selects specific items within the hierarchy of the structure it is defined in.
We separate the context expression from the following constraint, operation, or annotation with a double colon as in the following annotation:
sponsor/name::<appearance>Print this name always in golden letters</appearance>
In AOM we adopt a subset of XPath for expressing contexts. In the example above we relate to the sub-property name in property sponsor.
In cases where a property or sub-property appears in multiple occurrences within an expression we can pinpoint an occurrence by specifying an index (starting at 1):
would identify section+ in the expression chapter(section, header, section+). If no index was specified the context expression would apply to both occurrences of section.
We can also relate to arcs by specifying their respective role name or the name of their target asset. The preferred method is to equip arcs with a role name and to relate to that role name.
When specifying a context expression within an annotation of a Level 2 Structure or on model level it can be desirable to refer to certain assets that reside within the hierarchy of that structure. This can be done by starting the context expression with a path separator followed by the name of the asset.
Here, we relate to asset project, property sponsor, and its sub-property name. If an asset does not belong to the model's default namespace its namespace prefix must be specified with the asset name. Since asset names are unique within a model, index expressions are not necessary and not allowed with asset names.
Wild cards are allowed for asset names, namespace prefixes and property names:
refers to all assets with the name project independent of the namespace.
Refers to all sub-properties named email that are grand-children of asset c:project.
The descendants operator // allows to specify descendants of a node (instead of direct children).
Refers to all sub-properties named email that are descendants of asset c:project.
refers to all email properties and sub-properties on any level. It is equivalent with /*:*//email.
Contact: support 'at' aoModeling.org