Define script execution context : <context> tag
Before a <gendoc> tag, a <context> must have been defined to
determine the model and the element to use as starting context.
<context> tag can contain the following attributes :
- model : Model absolute path (global parameters can be used)
- element : Path to the model element to use as script context (path from model root)
- importedBundles : List of external bundles names (separated by ‘;’ character)
- searchMetamodels : false(default)/true.
Set to “true” when your model
uses element from external meta-models, for example with SysML, when both UML and SysML meta-models are used.
<context
model='${model_folder}/model_1.uml'
element='model/package1/subpackage1'
importedBundles='gmf;papyrus'
searchMetamodels='true'
/>
The context tag must be defined at least once in the document.
When executing a script, the last defined context is used.
Values of the attributes that are not updated are kept from previous context.
For example, “importedBundles” attribute can be defined only once in the document and will
be kept until a new value is indicated.
Dealing with specific models
Using multiple meta-models
If the model selected references another meta-model, set the following attribute to “true”
in order for gendoc to analyse meta-models used as references.
Meta-models where elements have no ‘name’ feature
With specific meta-models where elements have no ‘name’ property, context elements are defined:
- Using another property for all the elements in path
- Ex : <context … element='id1/id2/id3' labelFeature='id'/>
Property ‘id’ is used for all elements in path
- Note : standard case is equivalent to <context … element='modelRoot/package1/subPackage1'
labelFeature='name'/>
- Using another property only for some elements in path
- Ex : <context … element='modelRoot/id=“id2”/subPackage1'/>
Property ‘id’ is used only for the package part of the element path
Property ‘name’ is used for others
- Using indexes of the position inside model tree (starting at 0 and not 1)
- Ex: <context … element='modelRoot/{1}/subPackage1'/>
If package2 is at the second place inside the model.