Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » Compare Eenum types
Compare Eenum types [message #1756026] Fri, 10 March 2017 09:00 Go to next message
Faiez Zalila is currently offline Faiez ZalilaFriend
Messages: 235
Registered: March 2010
Senior Member
Hi All

I have this subset of metamodel

		class FSM
		{
			attribute name : String[?];
			property ownedState#owningFSM : State[*|1] { ordered composes };
			property initialState : State[1];
			property finalState : State[+|1] { ordered };
			property attribute : Attribute[?];
			invariant AttributeTypeMustBeEEnum: attribute.type.oclIsTypeOf(ecore::EEnum);
		}
		class State
		{
			property literal : ecore::EEnumLiteral[?];
			property owningFSM#ownedState : FSM[1];
			invariant StateLiteralAlreadyDefinedInFSMAttributeType: owningFSM.attribute.type.oclAsType(ecore::EEnum)=literal.eEnum;
		}
		class Attribute
		{
			attribute name : AttributeName[1];
			property type : ecore::EClassifier[?]
		}


Despite the creation of valid models, the StateLiteralAlreadyDefinedInFSMAttributeType invariant is never validated.

Is this invariant correct?

best,
Re: Compare Eenum types [message #1756043 is a reply to message #1756026] Fri, 10 March 2017 10:58 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5585
Registered: July 2009
Senior Member
Hi

It is very easy to get confused about the meta-structure of enums,

If you want me to look at it provide a complete example (zipped project.)

Regards

Ed Willink
Re: Compare Eenum types [message #1756074 is a reply to message #1756043] Fri, 10 March 2017 15:34 Go to previous messageGo to next message
Faiez Zalila is currently offline Faiez ZalilaFriend
Messages: 235
Registered: March 2010
Senior Member
Hi Ed,
Thank for ur answer

You can find a zipped file contaning a metamodel and a conforming model which doesn't validate the property StateLiteralAlreadyDefinedInFSMAttributeType

best regards,
  • Attachment: Archive.zip
    (Size: 1.73KB, Downloaded 18 times)
Re: Compare Eenum types [message #1756082 is a reply to message #1756074] Fri, 10 March 2017 16:54 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5585
Registered: July 2009
Senior Member
Hi

https://bugs.eclipse.org/bugs/show_bug.cgi?id=513479 raised

It is indeed very easy to get confused by the meta-structure of enums, which is IMHO broken in Ecore. An enumeration literal is the only EObject that has no Exxx existence at run-time requiring OCL to work hard to reconstruct it. You seem to have found a path where this is not happening.

Regards

Ed Willink
Re: Compare Eenum types [message #1756086 is a reply to message #1756082] Fri, 10 March 2017 17:33 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5585
Registered: July 2009
Senior Member
Hi

There is no problem with Ecore for this example. There is a perfectly good EEnumLiteral but an invalid EEnum that has no EPackage.

I really cannot understand why you are creating dynamic EEnums in an extension XMI. This seems to fly in the face of every kind of discipline that we pursue with models. I recommend that you stick to XML so that you can do whatever you like without any unhelpful discipline.

Regards

Ed Willink
Previous Topic:Validation problem with Dynamic Instance
Next Topic:Changing invariants written in OCLinEcore needs Eclipse restart
Goto Forum:
  


Current Time: Mon Jan 22 10:39:35 GMT 2018

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

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