Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » OCL Constraint in profile - local variable
OCL Constraint in profile - local variable [message #1817601] Tue, 26 November 2019 13:30 Go to next message
jo ber is currently offline jo berFriend
Messages: 94
Registered: August 2018
Member
Hi

I've the following constraint:
index.php/fa/36819/0/
For each Class in the model, the allInstance() will be executed. Is there a way to make it executed only once in the profile definition when I start the validation?

thank you!
Re: OCL Constraint in profile - local variable [message #1817611 is a reply to message #1817601] Tue, 26 November 2019 16:01 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Until Package constraints are supported, the best way to avoid allInstances is to relocate the Constraint to the relevant type.

So, I might try something like:

context Class
inv UniqueMyClassIdentifier:
extension_MyClass->isUnique(Identifier)

NB The 'polarity' of the constraint name should make sense in the error message 'constraintname' is violated.

You haven't provided a metamodel so I have not checked how many stupid mistakes my snippet has, but you can clearly see the benefit of using the Pivot OCL's type-safe navigation rather than the UML2 project's Java API.

Regards

Ed Willink
Re: OCL Constraint in profile - local variable [message #1817678 is a reply to message #1817611] Wed, 27 November 2019 19:08 Go to previous message
jo ber is currently offline jo berFriend
Messages: 94
Registered: August 2018
Member
thank you for your help. Solved my issue
Previous Topic:Issue with Undo
Next Topic:Package with little red rectangle - what does it mean
Goto Forum:
  


Current Time: Fri Apr 19 03:11:59 GMT 2024

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

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

Back to the top