|Programmatically run OCL queries with multiple meta-models produces unknown type errors [message #1773787]
||Wed, 04 October 2017 15:52
| Thibault beziers la fosse
Registered: February 2017
I just started using OCL within Java and I'm encountering some issues.
I'm creating models using MoDisco, which conform to multiple meta-models (java, javaapplication, kdmSourceExtension, and kdm), and I'm trying to request those models for some specific data.
So, when I'm requesting the model conforming to the MoDisco java meta-model, things are working fine. But when requesting the JavaApplication one, where the elements inherit from the kdmSourceExtension one, it won't work, and I'm having exceptions during the parsing, such as:
org.eclipse.ocl.SemanticException: Unknown type (ASTNodeSourceRegion)
My Java code is the following:
ocl = OCL.newInstance(EcoreEnvironmentFactory.INSTANCE);
OCL_HELPER = ocl.createOCLHelper();
OCLExpression query = OCL_HELPER.createQuery("self.children -> collect(n : ASTNodeSourceRegion | n.node)");
Object o = ocl.evaluate(java2File, query);
What can I do to collect those nodes ? Here is a sample of the metamodel:
An other example:
JavaNodeSourceRegion.allInstances() -> collect (node) ---> works
Despite the fact that JavaNodeSourceRegion inherits from ASTNodeSourceRegion.
ASTNodeSourceRegion.allInstances() -> collect (node) ---> Does not work
Thank you, for any advice you could give me
Powered by FUDForum
. Page generated in 0.01906 seconds