Skip to main content



      Home
Home » Modeling » VIATRA » Interface change from IncQuery 0.7 to 0.8
Interface change from IncQuery 0.7 to 0.8 [message #1742664] Tue, 06 September 2016 09:33 Go to next message
Eclipse UserFriend
Hello,

I've noticed that from IncQuery v0.7 to v0.8, the inteface org.eclipse.incquery.runtime.api.IPatternMatch has been changed. The method
public Pattern pattern()
has been replaced by
public IQuerySpecification<? extends IncQueryMatcher<? extends IPatternMatch>> specification()
. With this new interface, how could you get a Pattern from a PatternMatch? Any suggestion would be welcomed.

PS: Is there any sort of notice of API change in the project ?

Best regards,

[Updated on: Tue, 06 September 2016 09:34] by Moderator

Re: Interface change from IncQuery 0.7 to 0.8 [message #1742668 is a reply to message #1742664] Tue, 06 September 2016 09:42 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

before version 1.0 we did a few API breaking changes to make sure the platform provides an easy-to-use API; and after version 1.0 we were extra careful not limit the breaks of the runtime API of IncQuery/VIATRA. In general, the releases page in the wiki provides migration guides between versions: https://wiki.eclipse.org/VIATRA/Releases

For v0.8 we have changed the direction of dependency between the pattern language and the runtime to the more normal one, namely the language depends on the runtime, and the interface does not know anything about the concepts of Patterns, etc. For this reason, accessing the patterns from the runtime API in general is not possible.

However, could you elaborate on what you try to achieve? I could then propose alternatives that are more inline with the philosophy of VIATRA.

Best regards,
Zoltán
Re: Interface change from IncQuery 0.7 to 0.8 [message #1742675 is a reply to message #1742668] Tue, 06 September 2016 10:54 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Thank you for your reply. Here is the use case that led to my question. In order not to have to recalculate the result of the query each time the model is changed, I have a cache of <Pattern, PatternMatch>. A match update listener (IMatchUpdateListener) is used to notify when a new match appears or disappears. With the deprecated API, I could get a pattern from the pattern match and update my cache properly. So to be inline with the new API update, could you suggest an alternative?

Best regards,
Tu
Re: Interface change from IncQuery 0.7 to 0.8 [message #1742678 is a reply to message #1742675] Tue, 06 September 2016 11:07 Go to previous message
Eclipse UserFriend
Hi,

first of all, it seems strange to me that you maintain a cache of PatternMatch instances for each Pattern, as the Pattern matcher itself already caches the results. In other words, when you need all matches of a pattern, ask the corresponding matcher (the results will be fast because of the internal caches). Still, if you want to get notified on model changes, you could ask the IncQueryEngine/ViatraQueryEngine (depending on the version you use; I'd recommend using as new version as you can; you will need the advanced version) to provide updateListeners for your Matcher.

As an example, you could have a look at http://git.eclipse.org/c/viatra/org.eclipse.viatra.examples.git/tree/query/headless/org.eclipse.viatra.query.application/src/org/eclipse/viatra/query/application/common/ViatraQueryHeadlessAdvanced.java#n124 ; based on the version you are using minor changes might be necessary.

Best regards,
Zoltán
Previous Topic:Problems with the tutorial
Next Topic:How to get Xtext resource
Goto Forum:
  


Current Time: Wed Jul 23 17:24:05 EDT 2025

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

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

Back to the top