Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » The 'Property::CompatibleDefaultExpression' constraint is violated for xxxxx
The 'Property::CompatibleDefaultExpression' constraint is violated for xxxxx [message #1755185] Tue, 28 February 2017 18:05 Go to next message
Faiez Zalila is currently offline Faiez ZalilaFriend
Messages: 235
Registered: March 2010
Senior Member
I have this metamodel (subset)
		abstract class Entity
		{
			property parts : Part[*|1] { ordered composes };
			property elements : Element[*|1] { ordered derived readonly }
			{
				initial: self.parts.element;
			}
		}
               class Part
		{
			property element : Element[1];
		}


When I added
			{
				initial: self.parts.element;
			}


I warning is appeared

Quote:

The 'Property::CompatibleDefaultExpression' constraint is violated
for 'dsm::Entity::elements'


Why this warning appears? any suggestion?

thanks
Re: The 'Property::CompatibleDefaultExpression' constraint is violated for xxxxx [message #1755187 is a reply to message #1755185] Tue, 28 February 2017 18:57 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 5585
Registered: July 2009
Senior Member
Hi

Difficult to be sure without a repro, but almost certainly

The 'Property::CompatibleDefaultExpression' constraint is violated

i.e. initial: self.parts.element is not compatible with property element : Element[1]

which looks rather likely since I suspect that self.parts.element is an implicit collect: self.parts->collect(element) and so a Bag.

Try using the editor hovertext which will tell you what the types are.

Regards

Ed Willink
Previous Topic:How to integrating OCL expressions in DSL grammar (Xtext project ) ?
Next Topic:Validation Problems of OCL Constraints contained in a static UML Profile
Goto Forum:
  


Current Time: Sun Jan 21 18:58:37 GMT 2018

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

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