Find the feature of changed elements [message #1703378] |
Fri, 31 July 2015 04:12  |
Eclipse User |
|
|
|
Hi,
I'm working with Incquery and I have a question that if I have a value that is contained by a container. How can I find the feature of the container corresponding to the value. For example, I have a feature value (an operation or attribute), I want to to find the feature ownedOperation or onwedAttribute, respectively. I can get it programmatically by get all feature values and check if ithey contain the given value.
Thanks,
|
|
|
|
Re: Find the feature of changed elements [message #1703385 is a reply to message #1703378] |
Fri, 31 July 2015 04:48   |
Eclipse User |
|
|
|
Hi,
for index performance reasons, IncQuery current does not support referencing the containment hierarchy directly, however, if you know which features to check, there is a workaround for that: you can have a pattern that provides the union of all features. For example, see the following helper pattern:
pattern container(EObject container, EObject object) {
Class.ownedOperation(container, object);
} or {
StructuredClassifier.ownedAttributes(container, object);
} or {
//You have to have a body for all interesting containment references
...
}
If you have this pattern, and bind the second parameter to the value you have, the matcher will bind the first parameter to the container. This is equivalent of getting all feature values and checking whether they are contained.
I hope, this idea helps. If not, feel free to ask for clarification.
Cheers,
Zoltán
|
|
|
|
Re: Find the feature of changed elements [message #1703387 is a reply to message #1703385] |
Fri, 31 July 2015 04:52   |
Eclipse User |
|
|
|
Zoltan Ujhelyi wrote on Fri, 31 July 2015 08:48Hi,
for index performance reasons, IncQuery current does not support referencing the containment hierarchy directly, however, if you know which features to check, there is a workaround for that: you can have a pattern that provides the union of all features. For example, see the following helper pattern:
pattern container(EObject container, EObject object) {
Class.ownedOperation(container, object);
} or {
StructuredClassifier.ownedAttributes(container, object);
} or {
//You have to have a body for all interesting containment references
...
}
Hi Zoltan,
Yes I'm using this kind of query and transitive closure to find the containment hierarchy and it works. But I'm looking for if I can get the feature of the container corresponding to the given value
|
|
|
|
Re: Find the feature of changed elements [message #1703393 is a reply to message #1703388] |
Fri, 31 July 2015 05:19  |
Eclipse User |
|
|
|
Van Cam PHAM wrote on Fri, 31 July 2015 10:58
Hi Gabor, I've tried this but it does not work.
Does not work how?
Did you read the Javadoc?
Anyway, I think you should ask about your difficulties with these methods at the EMF forum instead, since the EMF Java API does not have anything to do with IncQuery.
[Updated on: Fri, 31 July 2015 05:19] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.08369 seconds