0

I am working on Google Colaboratory, and I have to implement OCL (Object Constraint Language), I searched a lot, but I didn't find how to implement it. Can someone give me an idea please?

iacob
  • 20,084
  • 6
  • 92
  • 119

2 Answers2

1

AgileUML has a Python code generator from UML/OCL (itself written in OCL): this is the uml2py plugin for AgileUML (https://github.com/eclipse/agileuml). There are some videos on using the tool at: https://www.youtube.com/watch?v=NXq2L0fo7N4

Kevin Lano
  • 81
  • 2
0

It is surely possible for you to implement OCL, duplicating the efforts of one of the existing Open Source implementations such as Eclipse OCL or USE. There is an official OMG specification that will define what you need to do, however it has many deficiencies that will require research to solve and design around. I would be surprised if you can implement a 'full' implementation of OCL from scratch with plausible accuracy in less than a person year.

I suspect that you have mis-stated what you want to do or have misunderstood what someone has instructed you to do.

Ed Willink
  • 1,205
  • 7
  • 8
  • Thank you for the great response, however, I have proposed a meta-model and some OCL constraints related to this meta-model (conception phase). Actually, I want to implement this meta-model and its OCL constraints . Thus, I use the google colab for this goal (execution phase) . unfortunately, I have not known how I will implement the OCL constraints, can I do it through a simple python code or there are some packages that are necessary for these constraints?. Thank you in advance. – najla fattouch Mar 10 '21 at 16:10
  • In the absence of automated tooling OCL can often be used as a specification language for code that is manually implemented in your favourite language. – Ed Willink Apr 01 '21 at 08:59
  • @najlafattouch arriving late, but few months ago I started a very simple/naive OCL to Python compiler, only for OCL expressions (https://github.com/aranega/pyecoreocl). You could use it to write OCL expressions and compile them to Python/evaluate them at run-time. As Ed said, it would be pretty unrealistic to write a full OCL implementation in a short time. – Vincent Aranega Jul 20 '21 at 18:46