Special syntax for pattern activation on nullable features? [message #1044055] |
Thu, 18 April 2013 08:50  |
Eclipse User |
|
|
|
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 #1044097 is a reply to message #1044089] |
Thu, 18 April 2013 09:37  |
Eclipse User |
|
|
|
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)
|
|
|
Powered by
FUDForum. Page generated in 0.13476 seconds