Skip to main content



      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 13:05 Go to next message
Eclipse UserFriend
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 13:57 Go to previous message
Eclipse UserFriend
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: Fri Apr 18 10:39:34 EDT 2025

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

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

Back to the top