Home » Archived » EMF-IncQuery » Unique names of derived features?
| |
Re: Unique names of derived features? [message #1250538 is a reply to message #1250493] |
Wed, 19 February 2014 10:31 |
Emre T Messages: 119 Registered: April 2013 |
Senior Member |
|
|
Ok, I thought so. An example for the usage of the annotation parameters would be like this then:
Lets say we have two model elements "A" and "B", which have a derived reference with the same name "derivedReference" and the same type (e.g. "Class" element from model being referenced). When I define the two patterns for these two derived references, I could do it as the following.
@QueryBasedFeature (feature = "derivedReference", source = "A", target = "Class")
pattern firstDerivedReference (This: A, Target: Class) { ... }
@QueryBasedFeature (feature = "derivedReference", source = "B", target = "Class")
pattern secondDerivedReference (This: B, Target: Class) { ... }
Would it be the right usage? Could EMF IncQuery then differentiate between the two derived references and generate the notifiers accordingly?
Best regards,
Emre
[Updated on: Wed, 19 February 2014 10:31] Report message to a moderator
|
|
| |
Re: Unique names of derived features? [message #1250544 is a reply to message #1250538] |
Wed, 19 February 2014 10:37 |
Abel Hegedus Messages: 197 Registered: September 2015 |
Senior Member |
|
|
Just a quick response, the example you wrote is not exactly correct.
The 'source' and 'target' parameters refer to _parameters_, not EClasses. So in your case, use:
@QueryBasedFeature (feature = "derivedReference", source = This, target = Target)
pattern firstDerivedReference (This: A, Target: Class) { ... }
@QueryBasedFeature (feature = "derivedReference", source = This, target = Target)
pattern secondDerivedReference (This: B, Target: Class) { ... }
As written in the wiki, you don't have to declare 'source' and 'target' if only two parameters are used in the query and the first is the source and the second is the target.
Edit: I corrected the example to make sure the information is correct for future readers.
[Updated on: Mon, 24 February 2014 00:46] by Moderator Report message to a moderator
|
|
| | | | |
Re: Unique names of derived features? [message #1254940 is a reply to message #1251805] |
Mon, 24 February 2014 00:36 |
Emre T Messages: 119 Registered: April 2013 |
Senior Member |
|
|
Hello again,
I needed to use the parameters again, and I am getting the following error: Invalid parameter type String. Expected Variable
I use them, like you have corrected:
@QueryBasedFeature (feature = "ref", source = "This", target = "Target")
pattern refQuery(This: A, Middle: B, Target: C) = { ... }
The source is the derived feature is A, the target is B, but I have to make a definitive stop at the Middle B, to be able traverse the model.
What might be the reason?
Thanks!
EDIT: Ok, it's solved, clearly, I should have been more careful to the error. After removing quotes, it was gone.
[Updated on: Mon, 24 February 2014 00:44] Report message to a moderator
|
|
| |
Goto Forum:
Current Time: Thu Mar 28 09:53:20 GMT 2024
Powered by FUDForum. Page generated in 0.02957 seconds
|