Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » EMF-IncQuery » Running IncQuery transformation inside an Eclipse WorkspaceJob
Running IncQuery transformation inside an Eclipse WorkspaceJob [message #1059614] Mon, 20 May 2013 20:08 Go to next message
Joost van Pinxten is currently offline Joost van PinxtenFriend
Messages: 51
Registered: November 2012
Member
I'm trying to use the IncQuery engine inside a WorkspaceJob, but I'm having difficulties instantiating the rules on the engine:

118890 [Worker-0] WARN org.eclipse.incquery.runtime.673132056  - The incremental pattern matcher encountered an error during executing a callback on insertion of match "experiment"=simpleTraceExperiment of pattern nl.esi.dset.dseir.transformation.experiment. Error message: null argument:Realm cannot be null. (Developer note: AssertionFailedException in org.eclipse.incquery.runtime.api.MatchUpdateAdapter@4acb029 called from CallbackNode)
org.eclipse.core.runtime.AssertionFailedException: null argument:Realm cannot be null
	at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:85)
	at org.eclipse.core.databinding.observable.ChangeManager.<init>(ChangeManager.java:37)
	at org.eclipse.core.databinding.observable.AbstractObservable.<init>(AbstractObservable.java:29)
	at org.eclipse.core.databinding.observable.value.AbstractObservableValue.<init>(AbstractObservableValue.java:42)
	at org.eclipse.core.internal.databinding.property.value.SimplePropertyObservableValue.<init>(SimplePropertyObservableValue.java:50)
	at org.eclipse.core.databinding.property.value.SimpleValueProperty.observe(SimpleValueProperty.java:70)
	at org.eclipse.core.databinding.property.value.ValueProperty.observe(ValueProperty.java:107)
	at org.eclipse.emf.databinding.internal.EMFValuePropertyDecorator.observe(EMFValuePropertyDecorator.java:109)
	at org.eclipse.incquery.runtime.evm.specific.DefaultAttributeMonitor.observeAllAttributes(DefaultAttributeMonitor.java:94)
	at org.eclipse.incquery.runtime.evm.specific.DefaultAttributeMonitor.registerFor(DefaultAttributeMonitor.java:70)
	at org.eclipse.incquery.runtime.evm.api.RuleInstance$DefaultMatchAppearProcessor.activationMissing(RuleInstance.java:140)
	at org.eclipse.incquery.runtime.evm.api.RuleInstance$DefaultMatchEventProcessor.processMatchEvent(RuleInstance.java:102)
	at org.eclipse.incquery.runtime.evm.api.RuleInstance$DefaultMatchAppearProcessor.process(RuleInstance.java:147)
	at org.eclipse.incquery.runtime.api.MatchUpdateAdapter.notifyAppearance(MatchUpdateAdapter.java:91)
	at org.eclipse.incquery.runtime.internal.boundary.CallbackNode.update(CallbackNode.java:43)
	at org.eclipse.incquery.runtime.rete.network.ReteContainer.messageConsumptionSingleThreaded(ReteContainer.java:457)
	at org.eclipse.incquery.runtime.rete.network.Network.waitForReteTermination(Network.java:312)
	at org.eclipse.incquery.runtime.rete.network.ReteContainer.flushUpdates(ReteContainer.java:335)
	at org.eclipse.incquery.runtime.rete.network.ReteContainer.connectAndSynchronize(ReteContainer.java:173)
	at org.eclipse.incquery.runtime.rete.matcher.RetePatternMatcher.connect(RetePatternMatcher.java:134)
	at org.eclipse.incquery.runtime.rete.matcher.RetePatternMatcher.connect(RetePatternMatcher.java:155)
	at org.eclipse.incquery.runtime.api.impl.BaseMatcher.addCallbackOnMatchUpdate(BaseMatcher.java:313)
	at org.eclipse.incquery.runtime.evm.specific.rule.SimpleMatcherRuleInstance.prepareInstance(SimpleMatcherRuleInstance.java:45)
	at org.eclipse.incquery.runtime.evm.specific.rule.SimpleMatcherRuleSpecification.instantiateRule(SimpleMatcherRuleSpecification.java:73)
	at org.eclipse.incquery.runtime.evm.api.RuleBase.internalInstantiateRule(RuleBase.java:86)
	at org.eclipse.incquery.runtime.evm.api.RuleBase.instantiateRule(RuleBase.java:78)
	at org.eclipse.incquery.runtime.evm.api.RuleEngine.internalAddRule(RuleEngine.java:201)
	at org.eclipse.incquery.runtime.evm.api.RuleEngine.addRule(RuleEngine.java:179)
...
	at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:38)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)


Which seems to be related to a dependency on the existence of a 'Realm' (whatever that is) for supporting the databinding features. However, I don't use any databinding or derived feature, just plain registered patterns. I'm simply creating a new executionEngine and try to add some rules to them.

I believe that 'headless' execution inside an RCP environment should be possible since April 4 (wiki), although I don't think that this is completely relevant for this situation.

I know that the ObservableCollectionHelper and ConstraintAdapter are refactored to use the EVM, but these are also called from the Handler (and thus the GUI thread), not from a WorkspaceJob or different thread. Is it at this moment possible to run the IQ engine outside the main thread? Same problem occurs when I try to initialize, use and run the engine inside a:
new Thread(new Runnable(){});


Can you point me in the right direction? Thanks!

[Updated on: Mon, 20 May 2013 20:16]

Report message to a moderator

Re: Running IncQuery transformation inside an Eclipse WorkspaceJob [message #1059615 is a reply to message #1059614] Mon, 20 May 2013 20:15 Go to previous messageGo to next message
Abel Hegedus is currently offline Abel HegedusFriend
Messages: 197
Registered: September 2015
Senior Member
Hi Joost,

you are seeing this exception, because you are using an ActivationLifeCycle that includes the UPDATED state. This means that the attribute monitor will be initialized but since currently, it uses data binding, it can only work if there is a realm.

On how to create a simple realm: http://wiki.eclipse.org/JFace_Data_Binding/Realm

We are planning to switch from databinding to our own object monitors in the near future to make sure EVM works in such cases: https://bugs.eclipse.org/bugs/show_bug.cgi?id=406192
Re: Running IncQuery transformation inside an Eclipse WorkspaceJob [message #1059617 is a reply to message #1059615] Mon, 20 May 2013 20:30 Go to previous messageGo to next message
Joost van Pinxten is currently offline Joost van PinxtenFriend
Messages: 51
Registered: November 2012
Member
Hi Abel,

Thanks! What a fantastic reaction time! I've tried your suggestion and now it works properly again in a different thread.

For the people who are (like me) inexperienced with anything to do with JFace: this page about JFace binding also gave me some useful information about where to find the Realm class.

Simply use the DefaultRealm implementation that Abel has pointed me to and make sure it is constructed at least once before running the IQ engine in a different thread.

Cheers!
Joost
Re: Running IncQuery transformation inside an Eclipse WorkspaceJob [message #1059619 is a reply to message #1059617] Mon, 20 May 2013 21:01 Go to previous messageGo to next message
Istvan Rath is currently offline Istvan RathFriend
Messages: 59
Registered: July 2009
Member
Hi Joost,

could you also please check that the DefaultRealm mentioned towards the end of the API documentation (http://wiki.eclipse.org/EMFIncQuery/UserDocumentation/API#Tracking_changes_in_match_sets_efficiently) also solves your issue?

(The entire code is in Git, see the pointers towards the top of that wiki page.)

Thanks!
Istvan
Re: Running IncQuery transformation inside an Eclipse WorkspaceJob [message #1059670 is a reply to message #1059619] Tue, 21 May 2013 07:29 Go to previous message
Joost van Pinxten is currently offline Joost van PinxtenFriend
Messages: 51
Registered: November 2012
Member
Hi Istvan,

The DefaultRealm implemenation in Git is exactly the same one as Abel linked to. However, I cannot find the exact context where the DefaultRealm is instantiated in the code described on the wiki. I've tried some locations and it only works for me when I instantiate it inside the new Thread.

Regards,
Joost
Previous Topic:Generating *.eiq code from IncQuery metamodel instances
Next Topic:Non-persisted resources for AdvancedAPI
Goto Forum:
  


Current Time: Fri Apr 19 12:50:20 GMT 2024

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

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

Back to the top