createQuery() takes a considerable time? [message #1058271] |
Mon, 13 May 2013 12:28 |
Kosala Yapa Messages: 159 Registered: September 2010 |
Senior Member |
|
|
Hi there,
I create a OCL query and execute that over EObject.
Sample code:
// 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);
// helper.setInstanceContext(ModelPackage.Literals.DEVICE__MODULES);
helper.setInstanceContext(device);
// create query
OCLExpression<EClassifier> query = helper
.createQuery("self.Modules->select(m|m.number<>null)->size()");
// use the query expression parsed before to create a Query
Query eval = ocl.createQuery(query);
int result = (Integer) eval.evaluate(device);
This is working fine, but createQuery() statement takes a considerable time. Any approach to fix that issue?
Thanks in advance.
Kosala
|
|
|
Powered by
FUDForum. Page generated in 0.03930 seconds