Issues with oclIsKindOf in AQL expressions [message #1777270] |
Mon, 27 November 2017 14:40  |
Eclipse User |
|
|
|
Hello,
I start with Sirius (Obeo Designer 10.0.0)
I have an Ecore metamodel, named avs, with (among other) a "LeafCOmponent" class, a "WindSource" class which inherit from Leaf Component, and many other child class of LeafComponent.
In a Sirius diagram, I want to have a generic mapping for all LeafComponents, but a specific one for WindSources. I can create the specific mapping, but I should exclude WindSources from the generic one.
Detailing all the subtypes of LeafComponent (without WindSource) in the Domain Class of the generic mapping is not a satisfying solution (there are many and they can evolve), so I put "avs::LeafComponent" in the Domain Class of the generic mapping
I tried to use the precondition Expression of the generic mapping with:
aql:not self.oclIsKindOf(avs::WindSource)
I also tried to modify the Semantic Candidate Expression with:
aql:self.components->select(c | not c.oclIsKindOf(avs::WindSource))
instead of
but none of those solution produce the expected result: I always have two nodes created for WindSources instances: one with the generic mapping, and the other with the specific one, so I guess that in those conditions, oclIsKindOf is always evaluated to false...
Am I doing something wrong?
Thanks for your help,
Emilien
|
|
|
|
|
Re: Issues with oclIsKindOf in AQL expressions [message #1777549 is a reply to message #1777270] |
Thu, 30 November 2017 04:34   |
Eclipse User |
|
|
|
Hi, and thanks for the answers
@Julien Dupont, I understand the difference between oclIsKindOf and oclIsTypeOf, but both are here evaluated to false when applied on objects that actually are WindSources
@Ed Willink, I think it's really a problem of metamodel schizophrenia, because when I use autocompletion (for example in a Domain Class field), each class of my metamodel appears twice, the first with the tooltip description:
ClassName
In http://com.my.avs
And the second with tooltip description:
ClassName
In http://com.my.avs
Located at platform:/resource/AVS/model/avs.ecore
However, I'm a little confused about the different way I can reference the metamodel, because I have no explicit references to it in my .design project:
I have created the metamodel with ecore tools, then I have generated all the associated code (generate>all on the ecore file), and then I have exported the 3 projects (AVS, AVS.edit and AVS.editor) as "deployable plug-ins and fragments"
I tried to create a new .odesign file in a new workspace (to avoid interferences between the metamodel in the plug-in and the one in the workspace): I have not the duplication of class with autocompletion anymore, but the "oclIsKindOf" function still doesn't work...
Furthermore, when I come back in the first workspace, I have a new kind of warning message when I try to use AQL expressions with the metamodel:
the following mapping semantic candidates expression could not be correctly evaluated : aql:self.components->select(c|c.oclIsKindOf(avs::WindSource))
org.eclipse.sirius.common.tools.api.interpreter.EvaluationException: An error has appeared during the evaluation of an expression:
Expression: aql:self.components->select(a|a.oclIsKindOf(avs::WindSource))
Diagnostic: Diagnostic ERROR source=org.eclipse.acceleo.query code=0 invalid type literal avs::WindSource data=[org.eclipse.acceleo.query.ast.impl.ErrorEClassifierTypeLiteralImpl@67a3ed4a (value: null, segments: [avs, WindSource], missingColon: false)]
Target URI Fragment: platform:/resource/AvsInstances/TestProject.avs#//@rootComponents.0/@components.2
It looks like the interpreter doesn't know the metamodel. When I try the same request directly in the Sirius interpreter, it produce the expected result.
So I'm a little confused about where and how I should add references to my metamodel...
Thanks for the help,
Regards
Emilien
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03339 seconds