Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » evaluate new OCL constrains as I am drawing a UML model
evaluate new OCL constrains as I am drawing a UML model [message #1744893] Sat, 01 October 2016 19:01 Go to next message
Bea Perez is currently offline Bea PerezFriend
Messages: 26
Registered: July 2012
Junior Member
Hello,
I would like to define OCL constraints on the UML metamodel and being able to automatically evaluate them as I am drawing new UML models. I am not sure whether there is any UML-OCL tool which allows me to do that.

It would be perfect if I could incluye my own OCL contraint file into the tool so that I not need to 1) draw the diagrama and 2) choose an option un the tool to evaluate my constraints. I would prefer to evaluate such constrains automatically as I am drawing the model.

Is that posible?

Thank you ver y much un advance.
Bea
Re: evaluate new OCL constrains as I am drawing a UML model [message #1744906 is a reply to message #1744893] Sun, 02 October 2016 07:55 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

If you want separate constraints, you should be able to develop a *.ocl file with the Complete OCL editor, then use OCL->Load Document to load it for use. Follow the Complete OCL tutorial. I think load now works in Papyrus, even if the tutorial says coming soon.

If you want to animate constraints within UML, you can create an Instance/Object Diagram of Instance Specifications and apply the OCLforUML::Validations stereotype to enable validations on the diagram.

Regards

Ed Willink
Re: evaluate new OCL constrains as I am drawing a UML model [message #1744909 is a reply to message #1744906] Sun, 02 October 2016 11:53 Go to previous messageGo to next message
Bea Perez is currently offline Bea PerezFriend
Messages: 26
Registered: July 2012
Junior Member
Dear Ed,
Thank you very much for your response.
My idea is to force the UML editor to draw UML models verifying my specific structural constrains (defined at the metamodel level).
For example, "any class of my class diagram must have at least one property".
For that reason, I would like the tool to verify them at drawing time.

I suppose it would match your first suggestion.

Just in case, is there any other tool that provides such a functionality?

Thank you in advance!

Bea
Re: evaluate new OCL constrains as I am drawing a UML model [message #1744914 is a reply to message #1744909] Sun, 02 October 2016 16:07 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Dresden OCL amongst others may support editing the OCL, but I think only Eclipse OCL supports use within Papyrus and vice-versa.

Regards

Ed Willink
Re: evaluate new OCL constrains as I am drawing a UML model [message #1744952 is a reply to message #1744914] Mon, 03 October 2016 09:57 Go to previous messageGo to next message
Bea Perez is currently offline Bea PerezFriend
Messages: 26
Registered: July 2012
Junior Member
Thanks again Ed.
I have tried with Papyrus. I draw a UML Class diagram, create a OCL file and load such an OCL file. Then I validate it but nothing happens even I know that the constrain in the file is false.

I have seen the forum entry: https://www.eclipse.org/forums/index.php/t/1074938/

but it seem that it does not work with the Papyrus Version: Neon (4.6.0).

Perhaps there is a way to integrate my ocl constraints into the tool?

The OCL file is:

import uml: 'http://www.eclipse.org/uml2/4.0.0/UML#/'

context uml::Class

inv CamelCaseName: name.at(1)=name.at(1).toUpperCase()

And my Class diagram has a Class with lower case name.

Thank you very much
Bea



Re: evaluate new OCL constrains as I am drawing a UML model [message #1744971 is a reply to message #1744952] Mon, 03 October 2016 15:04 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Using the PapyrusTestFile,.di and ExtraUMLValidation.ocl from the Complete OCL tutorial, it works in Neon.1.

However you don't get live constraint validation. You need to invoke Validation->... each time you want a refresh.

Regards

Ed Willink
Re: evaluate new OCL constrains as I am drawing a UML model [message #1744992 is a reply to message #1744971] Mon, 03 October 2016 21:26 Go to previous messageGo to next message
Bea Perez is currently offline Bea PerezFriend
Messages: 26
Registered: July 2012
Junior Member
Thabk you Ed.
Do you know how to impose such type of constraints with live validation so that I can avoid validating each time I modify the diagram?
Re: evaluate new OCL constrains as I am drawing a UML model [message #1745007 is a reply to message #1744992] Tue, 04 October 2016 07:40 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

No idea. Try the Papyrus forum.

The Sample Ecore Editor has a "Live Validation" option. This isn't yet supported by the UML Model Editor.

Regards

Ed Willink
Re: evaluate new OCL constrains as I am drawing a UML model [message #1745023 is a reply to message #1745007] Tue, 04 October 2016 09:37 Go to previous messageGo to next message
Bea Perez is currently offline Bea PerezFriend
Messages: 26
Registered: July 2012
Junior Member
I will try with the Papyrus forum. Thank you very much Ed for your help.
Re: evaluate new OCL constrains as I am drawing a UML model [message #1745274 is a reply to message #1745023] Fri, 07 October 2016 08:02 Go to previous messageGo to next message
Bea Perez is currently offline Bea PerezFriend
Messages: 26
Registered: July 2012
Junior Member
It works in Papyrus, I have an error in the import, it is without #
Re: evaluate new OCL constrains as I am drawing a UML model [message #1745297 is a reply to message #1745274] Fri, 07 October 2016 11:21 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Thanks for clarifying. The solution is always helpful for anyone else reading a thread.

Regards

Ed Willink
Previous Topic:[Announce] OCL 6.1.1 and 6.2.1 for Neon
Next Topic:UML2AS: Error when translating OpaqueExpression with multiple languages
Goto Forum:
  


Current Time: Tue Mar 19 04:40:51 GMT 2024

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

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

Back to the top