Filter The result of Graph [message #1445384] |
Wed, 15 October 2014 07:02  |
Eclipse User |
|
|
|
Hi,
I have questions regarding filtering the Zest Graph.
within my EMF model "teachermodel.teacher" (that i visualized using incquery with zest viewer) I have element e.g., Teacher associated with another element e.g. course which located in another EMF model "coursemode.course". I rely on a dynamic boolean attribute e.g.,enabled associated with course element to trigger an update to the graph , forexample all Teacher for the courses that are enabled 'TRUE' will be displayed in the graph ..
Can you please guide me through which is the best way to implement:
1) the change (adding more elements) in EMF model , should reflect in the graph (more node should be created after executing particular query) at the runtime
2) filtering the graph at the runtime based on dynamic attribute located in different EMF model
thanks
sal
|
|
|
Re: Filter The result of Graph [message #1445732 is a reply to message #1445384] |
Wed, 15 October 2014 17:40   |
Eclipse User |
|
|
|
Hi Salwa,
I don't understand exactly what do you mean by dynamic attributes. If you mean an attribute that is added during runtime, and is not present in the metamodel (as in dynamic EMF API), the IncQuery tooling cannot help you to formulate the correct queries. However, if you mean an attribute that you intend to change during runtime, but is present in the metamodel as well, you could write queries that include that attribute. E.g. consider the following pattern definition, when the Course.enabled attribute is a boolean available in the metamodel:
pattern enabledCourses(t: Teacher, c: Course) {
Teacher.courses(t, c);
Course.enabled(c, true);
}
In this case, filtering the graph to these attributes can be done by simply providing the filter definitions in the query, solving your second question.
About your first question, EMF-IncQuery does not require any specific method to update results on model changes - anything EMF allows should work with IncQuery out of the box. So you can directly modify the model, use the tree editor or use transactions, as your application requires it. After each change EMF sends notifications, which will cause EMF-IncQuery to update the query caches, and finally the Viewers framework will update the visualization.
I hope, I understood your questions correctly. If not, or if I am not clear enough, feel free to ask for clarification.
Cheers,
Zoltán
|
|
|
Re: Filter The result of Graph [message #1447620 is a reply to message #1445732] |
Sat, 18 October 2014 12:15   |
Eclipse User |
|
|
|
Thank you for the answer I was able to solve my issue with filtering the result as per ur feedback.
However , the problem I currently have is with updating the matcher . When my EMF model get change at runtime, the Zest graph should be updated too with the new matcher result.
can you please help me if I should add specific listener for engine or matcher somewhere.
Quote:After each change EMF sends notifications, which will cause EMF-IncQuery to update the query caches, and finally the Viewers framework will update the visualization. I couldn't see this working !!!
below is my update method for Zest Graph
This method update the graph but with old matcher result !!!!
public void updateGraph(EObject eob) {
// TODO Auto-generated method stub
graphViewer.applyLayout();
graphViewer.refresh();
}
the code to initialize State:
state = IncQueryViewerDataModel.newViewerState( //Initializing state
engine, //on a selected IncQueryEngine
getPatternsWithProperAnnotations(), //with all query specifications loaded to the selected engine
ViewerDataFilter.UNFILTERED, //using no filters
ImmutableSet.of(ViewerStateFeature.EDGE, ViewerStateFeature.CONTAINMENT)); //but requiring all features
// binding result with viewer
IncQueryGraphViewers.bind(graphViewer, state, true);
[Updated on: Sat, 18 October 2014 13:52] by Moderator
|
|
|
Re: Filter The result of Graph [message #1447679 is a reply to message #1447620] |
Sat, 18 October 2014 14:29  |
Eclipse User |
|
|
|
Hi Salwa,
the code snippet you shared seems correct. If the viewer is not updated, than something is not working as it should be. Could you please provide an executable example that shows this behavior? It would help a lot for locating the issue.
Cheers,
Zoltán
|
|
|
Powered by
FUDForum. Page generated in 0.16631 seconds