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: 17
Registered: August 2018
Junior 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: 6538
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: 17
Registered: August 2018
Junior Member
thank you for your help. Solved my issue
Previous Topic:Requirements Table: How to add new columns?
Next Topic:Package with little red rectangle - what does it mean
Goto Forum:
  


Current Time: Thu Dec 12 01:25:34 GMT 2019

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

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

Back to the top