Skip to main content



      Home
Home » Archived » EMF-IncQuery » Distinct Query
Distinct Query [message #1243743] Tue, 11 February 2014 06:33 Go to next message
Eclipse UserFriend
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 #1243746 is a reply to message #1243743] Tue, 11 February 2014 06:39 Go to previous messageGo to next message
Eclipse UserFriend
Did you try the "getAllValuesOfX" methods? (see https://wiki.eclipse.org/EMFIncQuery/UserDocumentation/API#Matcher)
Re: Distinct Query [message #1243757 is a reply to message #1243746] Tue, 11 February 2014 06:53 Go to previous message
Eclipse UserFriend
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: Mon Jul 07 20:45:08 EDT 2025

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

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

Back to the top