How to execute OCL constraint? [message #1058297] |
Mon, 13 May 2013 09:43  |
Eclipse User |
|
|
|
Hi,
I created an OCL constraint:
// create OCL instance for Ecore
OCL ocl = OCL.newInstance(EcoreEnvironmentFactory.INSTANCE);
// create OCL helper
OCLHelper<EClassifier, EOperation, EStructuralFeature, Constraint> helper = ocl
.createOCLHelper();
// set OCL context classifier
helper.setContext(ModelPackage.Literals.DEVICE);
Constraint invariant = helper.createInvariant("Modules.allInstances()->size()>=20");
How to execute this invariant nw?
Any help is appreciated.
Thanks
Kosala
|
|
|
Re: How to execute OCL constraint? [message #1058313 is a reply to message #1058297] |
Mon, 13 May 2013 10:31  |
Eclipse User |
|
|
|
Hi,
Boolean res = false;
// create OCL instance for Ecore
OCL ocl = OCL.newInstance(EcoreEnvironmentFactory.INSTANCE);
// create OCL helper
OCLHelper<EClassifier, EOperation, EStructuralFeature, Constraint> helper = ocl
.createOCLHelper();
// set OCL context classifier
helper.setContext(ModelPackage.Literals.DEVICE);
102 Constraint invariant = helper.createInvariant("self.Modules.number <= 20");
Query eval = ocl.createQuery(invariant);
res = (Boolean) eval.evaluate(device);
This gives an error at line 102: Exception in thread "main" java.lang.AbstractMethodError: org.eclipse.ocl.ecore.impl.IntegerLiteralExpImpl.setLongSymbol(Ljava/lang/Long;)V
any help is appreciated.
cheers,
|
|
|
Powered by
FUDForum. Page generated in 0.06309 seconds