Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » EMF-IncQuery » Filter The result of Graph(Filter The result of Graph)
Filter The result of Graph [message #1445384] Wed, 15 October 2014 11:02 Go to next message
Salwa Alzahmi is currently offline Salwa AlzahmiFriend
Messages: 37
Registered: June 2013
Member
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 21:40 Go to previous messageGo to next message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
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 Go to previous messageGo to next message
Salwa Alzahmi is currently offline Salwa AlzahmiFriend
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

Re: Filter The result of Graph [message #1447679 is a reply to message #1447620] Sat, 18 October 2014 18:29 Go to previous message
Zoltan Ujhelyi is currently offline Zoltan UjhelyiFriend
Messages: 392
Registered: July 2015
Senior Member
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
Previous Topic:Generating and building IncQuery Project
Next Topic:Get notified when index is ready
Goto Forum:
  


Current Time: Thu Apr 18 22:51:27 GMT 2024

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

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

Back to the top