Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » OCL » createQuery() takes a considerable time?
createQuery() takes a considerable time? [message #1058271] Mon, 13 May 2013 12:28
Kosala Yapa is currently offline Kosala YapaFriend
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

Previous Topic:OCL to validate XML models?
Next Topic:How to execute OCL constraint?
Goto Forum:
  


Current Time: Sun Nov 23 17:38:51 GMT 2014

Powered by FUDForum. Page generated in 0.01933 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software