blob: 0a4a950a0f6325ba1a54da5566f410ada921bf2f [file] [log] [blame]
h1. Writing Queries Using the Legacy Request Language
Before Sirius, the main query language used in Viewpoint was based on Acceleo 2, which is an older, incompatible version of Acceleo and is not maintained anymore. It is still currently deprecated and not maintained, but still supported through an optional extension to ease the transition for existing users who have VSMs using this language. We refer to it as the "legacy language" to avoid confusion with the newer Acceleo (version 3 and above). If you use it your Sirius project must declare a dependency to the @org.eclipse.sirius.query.legacy@ plug-in to ensure the necessary support will be available wherever your modelers are used. You are also encouraged to update your VSMs to use one of the recommended languages supported by Sirius.
Expressions in this language are enclosed between @<%@ and @%>@ strings. For example, @<%name%>@. You can mix fixed strings and evaluated parts inside a single expression, for example @Some text <%aComputedPart%>. Some other <%computedText%>.@ See the language's "reference manual":http://www.acceleo.org/doc/obeo/fr/acceleo-2.6-reference.pdf for more details.
In the context of Sirius, you have access to a special feature which can be used to follow "back-links" or "cross-references". From a given model element, this allows you to easily (and efficiently) find all the elements which refer to it in the scope of the models and representations in the same modeling project. This feature is available through the @~@ operator, which has two forms:
* @anExpression.~@: if @anExpression@ evaluates to the model element _M_, then the expression will return the set of all model elements which have a direct reference to _M_.
* @anExpression.~ref@, where @ref@ can be any valid name: if @anExpression@ evaluates to the model element _M_, then the expression will return the set of all model elements which have a direct reference to _M_ through a reference named @ref@.
For example if model element _A_ has a reference named _r1_ to model element _C_, and _B_ has a reference _r2_ to _C_, then @C.~r1@ will return _A_ but not _B_, while @C.~@ would return both _A_ and _B_.
_Warning:_ To test a Java service invoked through a legacy language expression, you have to launch an Eclipse runtime or to type its parameters with @EObject@ and then cast them to your domain types in the service body.The legacy language interpreter is not able to retrieve non-deployed service with domain types parameters.