Distinct Query [message #1243743] |
Tue, 11 February 2014 06:33  |
Eclipse User |
|
|
|
Hi again,
i'am thinking about a way to create a distinct pattern result, but i can't come up with a solution.
Example:
Lets say there are multiple Students (your school example + students with fore- and surname) with the same surname. Now i want to get all distinct surnames. (duplicate surnames shouldn't match).
Is there a way with incquery or is it impossible at the moment?
Thanks for any advice/help.
Greets Christian
|
|
|
|
Re: Distinct Query [message #1243757 is a reply to message #1243746] |
Tue, 11 February 2014 06:53  |
Eclipse User |
|
|
|
Also, if you need to use the set of all distinct surnames in the definition of another pattern, you can capture it as a pattern as well:
pattern surname(name) = {
Person.surname(_somePerson, name);
}
Since match results always have SET semantics in the mathematical sense (i.e. matches do not have multiplicities, each combination of pattern parameters is either in the query results exactly once or it doesn't match at all), here every string that is a surname of a Person in the model will appear exactly once in the match set of the pattern.
Note that the above pattern is different from the following one:
pattern surname(person, name) = { // notice the additional parameter
Person.surname(person, name);
}
In the second example the same name will appear multiple times in the query results, if there are multiple Persons with the same surname.
|
|
|
Powered by
FUDForum. Page generated in 0.23772 seconds