Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » oclIsKindOf returning unexpected values
oclIsKindOf returning unexpected values [message #1833603] Mon, 19 October 2020 16:07 Go to next message
Thomas Chiang is currently offline Thomas ChiangFriend
Messages: 100
Registered: March 2020
Senior Member
Is there an AQL query for the interpreter that can do a getType of a selected model element? I am trying to build some validation rules but when I query a model element for it's type using oclIsKindOf() or oclIsTypeOf() I get false for everything that I check; stuff from my ecore model and stuff that is built into Sirius.

I have been following this documentation to try and figure out what is going on and why I can't get the expected returns that I want from those methods.
https://www.eclipse.org/acceleo/documentation/

I have inheritances in my ecore model which is why I am using oclIsKindOf() to check if it conforms to the expected supertype. my inheritance is defined as such:

index.php/fa/39096/0/

Is there a way to get the type of the elements that are created in my editor? Or at least some way I can check what the type of the element actually is? Or why I keep getting false? This is the command that I am using in the interpreter: aql:[ self.oclIsKindOf(wFP_V2::Data)/]

[Updated on: Mon, 19 October 2020 16:09]

Report message to a moderator

Re: oclIsKindOf returning unexpected values [message #1833610 is a reply to message #1833603] Mon, 19 October 2020 19:11 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Metamodel schizophrenia is a common cause of oclIsKindOf and related impossible type failures. You may have inadvertently loaded the 'same' metamodel more than once and so types from one do not conform to the other.

In Sirius you should probably be using not-genmodelled models consistently so use Ecore.ecore.

Regards

Ed Willink
Re: oclIsKindOf returning unexpected values [message #1833636 is a reply to message #1833610] Tue, 20 October 2020 07:44 Go to previous message
Yvan Lussaud is currently offline Yvan LussaudFriend
Messages: 63
Registered: July 2009
Member
Hi,

If you are on an EObject in the variable self you can use self.eClass() to get its type.

regards,
Yvan.
Previous Topic:[Property View] Shared between model explorer tree, EMF editor and Sirius
Next Topic:How to reconnect the source of an edge
Goto Forum:
  


Current Time: Sat Apr 20 16:38:10 GMT 2024

Powered by FUDForum. Page generated in 0.02823 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top