Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » Checking a single element using EVL
Checking a single element using EVL [message #882969] Thu, 07 June 2012 14:49 Go to next message
Maarten Bezemer is currently offline Maarten BezemerFriend
Messages: 117
Registered: February 2012
Senior Member
Hi,

I have a user who designed a big (>1MB and around 5000 elements/eObjects) model. Unfortunately, since I enabled EVL validation for my application, opening and editing this model is not doable anymore: it takes too much time.

Batch validation (opening) is fixed now (I made some errors triggering validation over and over). Live validation on the other hand is taking too long, after each modification to the model the user has to wait...

I know I can reduce the amount of model modifications (or notifications) using EMF Transactions. This is high on my todo list, but a lot of work (converting my application), so I am also looking at other possibilities.

One is to only validate the elements that are changed.
I already modified EvlValidator to cache the list of results (as the validation checks the complete model, so I am not doing this for each element) and invalidate the results for an object when it is modified (using adapters). This caching scheme seems to work properly.

Only problem is when I change an object (and its results are invalidated), it is going to be revalidated. EvlValidator is only capable of validating the complete model/resource, even though I have most of the results already available... Resulting in extensive validation for a single modification.


Now I was wondering whether someone has be working to modify the EVL validation to only validate a single element.
As this seems to be a lot of work (and hacking into the internals of EVL), I rather not re-invent the wheel...

Thanks,
Maarten

PS If anyone has other ideas to speed up (live-)validation with EVL: I am open for ideas! Smile

[Updated on: Thu, 07 June 2012 14:49]

Report message to a moderator

Re: Checking a single element using EVL [message #882986 is a reply to message #882969] Thu, 07 June 2012 15:35 Go to previous messageGo to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 156
Registered: October 2009
Senior Member

Assuming you can get the EObject which was modified y would guess you are able to get it's xmi:id also... I wonder if you can add a guard to your evl rules in the lines of:
guard : self.id = modifiedId


where modifiedId is a variable you pass to your EVL module context (you are using stand alone right?). I would also probably consider separating each context into its own file so can get the EClass of the modified EObject and call the specific file for that element type. Don't know if it will actually work, but if it do I am guessing it will definitively speed up the validation process.

Let me know if this sounds feasible and if you get it to work Wink.

Regards,


Horacio Hoyos Rodriguez
EngD Student
University Of York
Re: Checking a single element using EVL [message #882989 is a reply to message #882986] Thu, 07 June 2012 15:41 Go to previous messageGo to next message
Maarten Bezemer is currently offline Maarten BezemerFriend
Messages: 117
Registered: February 2012
Senior Member
Nice idea! Tomorrow I'll try to use guards to check a single object.

Although all objects are still checked (or at least their guards), it will hopefully save a lot of time not doing the actual validation.
We'll see Smile
Re: Checking a single element using EVL [message #882996 is a reply to message #882989] Thu, 07 June 2012 15:52 Go to previous messageGo to next message
Horacio Hoyos is currently offline Horacio HoyosFriend
Messages: 156
Registered: October 2009
Senior Member

If you have other guards remember to add the id check as first condition so if "fails" faster Wink. If you have (self.id = modifiedId) and (other conditions) the rest won't be evaluated if the id one is not met.

Horacio Hoyos Rodriguez
EngD Student
University Of York
Re: Checking a single element using EVL [message #890149 is a reply to message #882996] Thu, 21 June 2012 09:40 Go to previous message
Maarten Bezemer is currently offline Maarten BezemerFriend
Messages: 117
Registered: February 2012
Senior Member
I finally got around to trying this out...

Implementation

I added this operation:
@cached
operation EObject shouldValidate() : Boolean {
  return ValidateObject.isUndefined() or self == ValidateObject;
}

I modified EvlValidator to make ValidateObject available in the framestack. When it is null (undefined) the complete model is being checked.

And added guards to all my rules, like this:
constraint HasName {
  guard : self.shouldValidate()
  check : self.name.isDefined() and not self.name.isEmpty()
  message : 'Unnamed ' + self.eClass().name + ' not allowed'
}


This seems to work properly, when adding a debug println() it is only showed once of the object that need the live-validation.

About the speed

At a first glance, live-validation does not seem to be faster.

And I am suspecting that batch-validation got (much) slower. Maybe because loads of guards need to be checked all the time?

Altogether, it does not seem to pay out as much as hoped, so I'll need to think of another approach... Sad
(I'll keep a patch file around of the described modifications, in the case where more tries/fixed are needed Wink )
Previous Topic:Concordance Indexing Builder freezes
Next Topic:Strange Model Artifacts
Goto Forum:
  


Current Time: Sat Dec 20 02:26:06 GMT 2014

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

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