|
|
|
Re: Additional nodes to containers via layers [message #1734660 is a reply to message #1732679] |
Fri, 10 June 2016 04:27  |
Eclipse User |
|
|
|
Hi Sebastien,
Le 19/05/2016 à 08:39, Sebastian Lehrig a écrit :
> Thank you Julien, that clarifies already a lot. Still, I have one issue
> left:
>
> My reused element from the second layer includes a "Semantic Candidates
> Expression" of the form "[self. ... /]". Before I moved the element to
> the second layer, "self" used to refer to the container. With the reused
> mapping solution, the context of self is however not this container.
For a mapping, the context of self is the domain class of the parent
mapping or diagram description for root mappings.
>
> In your example, "Attributes" use the expression "feature:eAttributes".
> This expression is actually evaluated in the context of the container
> ("Class" in you case).
In the provided sample, the mapping is defined as children of the
Attributes Layer but also reused from the Class mapping. Sirius will
evaluate it in to situations: as a root mapping on the diagram targeting
an EPackage: it will produce nothing as the feature eAttributes will not
be found on this concept and then it will be evaluated as a resued
mapping from the Class mapping, this time it will find elements if the
current EClass has some attributes defined.
If you use a "[self. ... /]" expression in your
> example, the context moves to "Package". Why isn't that the same
> behavior as for "feature:eAttributes"?
If you use feature: and call the completion proposal, you will see that
eAttributes is not proposed. The context is EPackage as it is the domain
class of the diagram description and the Attributes mapping it a root
mapping. The completion proposal computation does not take into account
the "reuse" locations.
The provided sample is not a valid VSM, if you launch the validation it
will indicate that the ecore::EPackage class does not have the feature
named eAttributes.
But it shows you that you can define a mapping somewhere and reuse it
correctly from another place and that you have to do that carefully to
be sure it will be valid on all places in which you want it to produce
some result. If you define/reuse it from mappings with different domain
class, you can use a more complex query or Java service to do a semantic
candidate expression which will handle both cases.
>
Regards,
--
Maxime - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Powered by
FUDForum. Page generated in 0.04459 seconds