run OCL on models programmatically [message #1835192] |
Thu, 26 November 2020 17:28 |
Faezeh Khorram Messages: 9 Registered: June 2020 |
Junior Member |
|
|
Hi,
I am working on a DSL for writing test scenarios which will be executed on models conforming to different DSLs (e.g., FSM, BPMN, ...).
I want to add an OCL functionality to my test DSL in order to enable the tester to evaluate OCL queries on a model under test.
For instance, I want to simply validate the following OCL query on a Pertinent model:
petrinet.places -> select (p | p.tokens = '0')
and I expect to receive the following answer:
p1, p2, p3, p4
Using my test DSL, the test scenario will look like this:
Test Description petrinetTestUsingOCL uses configuration oclConfiguration{
tester.oclTestGate sends oclquery (query = "petrinet.places -> select (p | p.tokens = '0')")
to petrinet.oclMUTGate;
alternatively{
petrinet.oclMUTGate sends "p1, p2, p3, p4" to tester.oclTestGate;
set verdict to PASS;
} or{
set verdict to FAIL;
}
}
I've implemented an interpreter for my test DSL and for interpreting the above code, I need to programmatically run the OCL query on the intended Petrinet model, in fact, it is required that my interpreter be able to validate and execute OCL queries and check the answer.
I suppose this functionality can be possible using OCL Eclipse (using its provided APIs) but I don't know how and where to start.
Could anyone guide me please?
Bests,
Faezeh
|
|
|
Re: run OCL on models programmatically [message #1835194 is a reply to message #1835192] |
Thu, 26 November 2020 17:43 |
Sina Madani Messages: 160 Registered: November 2015 Location: York, UK |
Senior Member |
|
|
Not sure if it's useful but I've also wanted to use OCL programmatically and this is what I came up with (link). Basically you want to use org.eclipse.ocl.pivot.utilities.OCL and call OCL.newInstance(new ResourceSetImpl()). Also need to call org.eclipse.ocl.xtext.completeocl.CompleteOCLStandaloneSetup.doSetup(); and org.eclipse.ocl.pivot.model.OCLstdlib.install(). Use OCL.parse to parse the query. Hope that's somewhat helpful.
[Updated on: Sat, 28 November 2020 15:00] Report message to a moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03356 seconds