Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » EMF-IncQuery » Distinct Query
Distinct Query [message #1243743] Tue, 11 February 2014 11:33 Go to next message
Christian Mohr is currently offline Christian MohrFriend
Messages: 34
Registered: June 2012
Hi again,

i'am thinking about a way to create a distinct pattern result, but i can't come up with a solution.

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 #1243746 is a reply to message #1243743] Tue, 11 February 2014 11:39 Go to previous messageGo to next message
Abel Hegedus is currently offline Abel HegedusFriend
Messages: 192
Registered: September 2015
Senior Member
Did you try the "getAllValuesOfX" methods? (see
Re: Distinct Query [message #1243757 is a reply to message #1243746] Tue, 11 February 2014 11:53 Go to previous message
Gabor Bergmann is currently offline Gabor BergmannFriend
Messages: 35
Registered: July 2009
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.
Previous Topic:IncQuery support for XText 2.5
Next Topic:setSelectionToViewer NoSuchMethod exception
Goto Forum:

Current Time: Tue Aug 04 00:41:01 GMT 2020

Powered by FUDForum. Page generated in 0.01410 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top