Hi,
recently I asked Ábel why I don't get results when derived features in ecore models are involved in patterns. I found his answer very helpful and want to share it with you. Thanks Ábel!
best regards,
Jan
------ answer from Ábel -------
Hi Jan,
you have guessed correctly, the problem is that eAllReferences is derived and NOT wellbehaving (see informal definition here:
https://viatra.inf.mit.bme.hu/incquery/new/examples/derivedfeatures)
as in they don't send change notifications. EMF-IncQuery knows that
such features are not to be trusted and does not include them in the
pattern matching. This is a perfect example of why old fashioned derived
features (calculated by complex imperative code) are bad :)
However, you're in luck, because we have also run
into the same issue and we actually plan on transparently supporting
derived features in Ecore by replacing path constraints in queries
during interpretation with subpatterns (
https://github.com/ujhelyiz/EMF-IncQuery/issues/297).
As you can see, eAllReferences is at line 57, and it
depends on several of the earlier patterns. These patterns were all
defined by carefully examining the original Ecore implementation.
As for my statement, correctly it sound like this:
"wellbehaving derived features (be it Java or query based) can be
queried transparently" :)
I hope you find the above description helpful.
Best regards,
Ábel Hegedüs