Programmatically run OCL queries with multiple meta-models produces unknown type errors [message #1773787] |
Wed, 04 October 2017 15:52 |
Thibault beziers la fosse Messages: 10 Registered: February 2017 |
Junior Member |
|
|
Hi,
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();
OCL_HELPER.setContext(JavaapplicationPackage.eINSTANCE.getEClassifier("Java2File"));
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
ASTNodeSourceRegion.allInstances() -> collect (node) ---> Does not work Despite the fact that JavaNodeSourceRegion inherits from ASTNodeSourceRegion.
Thank you, for any advice you could give me
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02057 seconds