Dynamic OCL Constraints [message #1791039] |
Thu, 21 June 2018 15:14  |
Eclipse User |
|
|
|
Hello Everyone,
I have been working on an exercise to programmatically create instances of classes from an ecore file, give the instances values befitting their attributes and then running ocl validation checks on each instance. I have been pulling the constraints from the instance annotations and creating OCL invariants with an OCL helper, with the entire string representing a given constraint. Now, I want to expand my program by dynamically creating these constraints, instead. I am still a bit new to EMF and OCL, so I am wondering what are the best resources to read or some general information, to start me in the direction of handling this dynamic OCL approach? I have also been informed to look into Abstract Syntax Trees, so was also wondering about general information regarding them too.
Thank you,
Ioannis Nearchou
|
|
|
|
|
|
Re: Dynamic OCL Constraints [message #1791676 is a reply to message #1791480] |
Tue, 03 July 2018 22:26   |
Eclipse User |
|
|
|
Hello Ed,
Thank you for the response. I have received further clarification about my present task. I must create ad hoc OCL expressions at run-time, save them as model constraints and evaluating them. I have been pointed to this article http://www.eclipse.org/articles/article.php?file=Article-HowToProcessOCLAbstractSyntaxTrees/index.html, for further information. I am testing with a hard-code example expression, before I proceed with user input.
From what I understand in the article, I will need to implement a visitor for the OCL Expression I create and handle the nodes of the OCL AST appropriately, when evaluating. I wanted to know more about handling expression types with this evaluation visitor, such as encountered if expressions or literal expressions. What should I consider when handling for nested expressions, like literal expressions nested within if expressions?
Thank you,
Ioannis Nearchou
|
|
|
|
Re: Dynamic OCL Constraints [message #1793377 is a reply to message #1791679] |
Mon, 06 August 2018 22:12   |
Eclipse User |
|
|
|
Hello Ed,
How are you? I apologize for the late update. I received much more context to settle the confusion I had about the direction I was given. I followed the last comment, which was also required in the direction I had been given, using the likes of createOperationCallExp() and other create calls for other expression subtypes, based on a string received from a user entering ocl expression strings into the console.
Now, the link of the deprecated article and asking about ASTs actually regard a plugin that was linked in the article. I found the OCLASTView plugin link in the article and want to use it to get a visual decomposition of an ocl expression by its components. I have downloaded the jar file, but since it is not downloaded from an update site, was wondering to where I would have to move the file to access it in eclipse? I am sorry for this not being an ocl based question, but still felt it relevant since it is connected to an earlier reply.
Thank you,
Ioannis Nearchou
|
|
|
Re: Dynamic OCL Constraints [message #1793380 is a reply to message #1793377] |
Tue, 07 August 2018 01:12  |
Eclipse User |
|
|
|
Hi
I usually put JARs in a project/plugin lib folder. Depending on your IP constraints you can then commit the jar to GIT, or .gitignore it and provide a README explaining how to download it.
If you use Xtext, you will find that Xtext automatically downloads .antlr-generator-3.2.0-patch.jar to the root of your project.
Regards
Ed Willink
|
|
|
Powered by
FUDForum. Page generated in 0.04566 seconds