Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » EMF-IncQuery » Duplication issue of Item and Edge in Zest graph(I have duplication relations in the graph)
Duplication issue of Item and Edge in Zest graph [message #1433249] Sun, 28 September 2014 12:52 Go to next message
Salwa Alzahmi is currently offline Salwa AlzahmiFriend
Messages: 37
Registered: June 2013
Member
Hi,

I am trying to create Zest viewer to the library example.
I created a viewpart and i define the state where I bind with the viewer.
The visualizer work fine , but the only issue that there are redundancy in the created relations between Items. for example i passed the library's example finalPattern to the engine to view the result on zest. the resulted graph shows a duplication of Teacher item.
please see the attach photo and source code .

you help is highly appreciate it

[Updated on: Sun, 28 September 2014 12:55]

Report message to a moderator

Re: Duplication issue of Item and Edge in Zest graph [message #1433259 is a reply to message #1433249] Sun, 28 September 2014 13:12 Go to previous messageGo to next message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
Messages: 392
Registered: July 2015
Senior Member
Hi Salwa,

I tried to look at the source attachment, but it sadly misses the patterns you initialize the Zest Viewer from. If possible, next time please try to include your entire project as is to allow executing it; as this was usually it is much easier to figure out where the problem lies.

However, I can still give some pointers where to look for item duplication issues: items (graph nodes) are not created on a per-object but a per-match basis. This means, if you have two queries annotated with @Item that return the same EObject, the visualization will display two different graph nodes. The same issue comes forth if you have a pattern, that returns the same model element multiple times. E.g. consider the following example (I guess, your code is similar to this):

@Item(item = T, label = "$T.name$")
pattern finalPattern(Y : Year, C : Course, T : Teacher, S : Student) {
  Year.schoolClasses.courses(Y, C);
  Course.teacher(C, T);
  Student.schoolClass.courses(S, C);
  find theOnesWithTheBiggestCircle(S);
  find teachesTheMostCourses(T);
}


In this case, when a teacher teaches multiple students, there are multiple matches that contain the same teacher (e.g. {2012, Modeling, "Dániel Varró", "Zoltán Ujhelyi"} and {2012, Modeling, "Dániel Varró", "Zoltán Ujhelyi"}, and the viewers framework creates a graph node from each match.

If you want to avoid such multiplication, you should use a pattern that disallows duplication of the model elements, e.g. use a simple pattern that returns all teachers/students; or create a helper pattern with only a single parameter:
@Item(item = T, label = "$T.name$")
pattern helper(T: Teacher) {
  find finalPattern(_, _, T, _);
}


I hope, the answer was clear enough. If not, feel free to ask for clarifications.

Cheers,
Zoltán
Re: Duplication issue of Item and Edge in Zest graph [message #1433640 is a reply to message #1433259] Mon, 29 September 2014 04:12 Go to previous message
Salwa Alzahmi is currently offline Salwa AlzahmiFriend
Messages: 37
Registered: June 2013
Member
Thank you for your prompt reply.
Yes , That was helpful.

I create two helper method to display the Item ,and I have the original method for displaying the Edge.
In my ViewPart, I create a collection of pattern specifications and Pass it to my ViewerState.


@Item(item = T, label = "$T.name$")
pattern helper(T: Teacher) {
  find finalPattern(_, _, T, _);
}
@Item(item = S, label = "$S.name$")
pattern helper(S: Student) {
  find finalPattern(_, _, _, S);
}

@Edge(source = T, target = S, label = "busiest ")  
pattern finalPattern(Y : Year, C : Course, T : Teacher, S : Student) {
  Year.schoolClasses.courses(Y, C);
  Course.teacher(C, T);
  Student.schoolClass.courses(S, C);
  find theOnesWithTheBiggestCircle(S);
  find teachesTheMostCourses(T);
}



THank you for you help.
Previous Topic:how load xml emf resource using api
Next Topic:correct steps to install emf incquery
Goto Forum:
  


Current Time: Thu Apr 18 00:32:16 GMT 2024

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

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

Back to the top