|
Re: Filter The result of Graph [message #1445732 is a reply to message #1445384] |
Wed, 15 October 2014 21:40 |
Zoltan Ujhelyi Messages: 392 Registered: July 2015 |
Senior Member |
|
|
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 16:15 |
Salwa Alzahmi Messages: 37 Registered: June 2013 |
Member |
|
|
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 17:52] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03390 seconds