Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EMF-IncQuery » Special syntax for pattern activation on nullable features?
Special syntax for pattern activation on nullable features? [message #1044055] Thu, 18 April 2013 12:50 Go to next message
Joost van Pinxten is currently offline Joost van Pinxten
Messages: 50
Registered: November 2012
Member
When using nullable (i.e. 0..1) features which you would like to have UPDATED events for, I'm using the following pattern:

pattern nullableFeature(container) = {
  // Matches those with NULL features
  Container(container);
} or {
  // Matches those without NULL features
  Container.feature(container, _feature);
}

However, this leads to exploding pattern sizes when there are several nullable features; i.e. all combinations of null and non-null features will generate a piece of the pattern.

To avoid this problem, I'd suggest a specific prefix, much like the '_' which is used with single variables that also do not appear as parameter in the pattern definition. Is it possible to instruct the RETE engine with e.g. an '&' or '$' to indicate that it should still update (instead of disappearing) in case a null is set?

I think I've seen a Bugzilla entry somewhat related to this, but as I'm not sure and I can't find it right now, I thought I'd put it out here. If you guys consider this a sound feature, then I'll post a feature request in the Bugzilla.
Re: Special syntax for pattern activation on nullable features? [message #1044064 is a reply to message #1044055] Thu, 18 April 2013 13:02 Go to previous messageGo to next message
Abel Hegedus is currently offline Abel Hegedus
Messages: 92
Registered: July 2009
Member
The first pattern body matches ALL Containers, not just those with NULL features.

I think that you mean this question: http://incquery.net/incquery/faq#Q:_How_are_null-valued_features_represented_in_the_query_language

Also, as discussed earlier, activations, UPDATED events and UPDATE states are EVM concepts, not pattern language concepts.

I have created an issue for this specific problem: https://bugs.eclipse.org/bugs/show_bug.cgi?id=405980

There is also the blocking issue: https://bugs.eclipse.org/bugs/show_bug.cgi?id=398744 that we are currently working on.
Re: Special syntax for pattern activation on nullable features? [message #1044089 is a reply to message #1044064] Thu, 18 April 2013 13:28 Go to previous messageGo to next message
Joost van Pinxten is currently offline Joost van Pinxten
Messages: 50
Registered: November 2012
Member
Thanks Abel, it seems that I as a user don't see the separation between EVM and pattern language that clearly.

Is it correct to say that if only the first piece of the pattern had been present, the feature would NOT be included in IQBase, and therefore does not (at the moment) trigger an UPDATE event in the EVM (unless IQBase triggers something else too)?
Re: Special syntax for pattern activation on nullable features? [message #1044097 is a reply to message #1044089] Thu, 18 April 2013 13:37 Go to previous message
Abel Hegedus is currently offline Abel Hegedus
Messages: 92
Registered: July 2009
Member
Yes, it is correct what you say.

A workaround would be the following:
// suppose you have an engine
IncQueryEngine engine = ... 
// fill up for each feature that you want to use in any of the UPDATE Jobs
Set<EStructuralFeature> featuresUsedByUpdate = ... 
// this will make IQBase cache the values of these features and consider changes to them interesting for registered update callbacks
engine.getBaseIndex().registerEStructuralFeatures(featuresUsedByUpdate) 
Previous Topic:Substring search in atributes
Next Topic:Generating *.eiq code from IncQuery metamodel instances
Goto Forum:
  


Current Time: Thu Sep 18 05:40:21 GMT 2014

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

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