Dynamic OCL Constraints [message #1791039] |
Thu, 21 June 2018 19:14 |
Ioannis Nearchou Messages: 18 Registered: February 2018 |
Junior Member |
|
|
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] |
Wed, 04 July 2018 02:26 |
Ioannis Nearchou Messages: 18 Registered: February 2018 |
Junior Member |
|
|
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] |
Tue, 07 August 2018 02:12 |
Ioannis Nearchou Messages: 18 Registered: February 2018 |
Junior Member |
|
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.03866 seconds