Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » VIATRA » Instancing twice to get results
Instancing twice to get results [message #1717633] Tue, 15 December 2015 12:34 Go to next message
Fon Vitale is currently offline Fon VitaleFriend
Messages: 14
Registered: November 2011
Junior Member
Hi,

I'm new to VIATRA and EMF-IncQuery. I'm trying a simple m2m transformation using the Incremental Transformation API and getting some strange behaviour.

For a m2m transformation with a simple rule like (it transforms a model Model element of the source metamodel into a Model element of the target metamodel):

	val model2ModelRule = createRule.precondition(ModelMatcher::querySpecification).action(IncQueryActivationStateEnum.APPEARED) [
		var newModel = outResource.create(model) as Model
		newModel.name = m.name
		createTrace(m, newModel)
	].addLifeCycle(Lifecycles.getDefault(false, false)).build


With query:

pattern model(m : Model) {
	Model(m);
}


If I run:

IncrementalSimpleUML2RDB transformation = new IncrementalSimpleUML2RDB(inRsc, outRsc);
transformation.transform();


I don't get any result in outRsc (the output resource). But if I run:
IncrementalSimpleUML2RDB transformation = new IncrementalSimpleUML2RDB(inRsc, outRsc);
transformation.transform();

transformation = new IncrementalSimpleUML2RDB(inRsc, outRsc);
transformation.transform();


I do get results.

So, what am I misunderstanding wrongly?

Many thanks in advance.
Re: Instancing twice to get results [message #1717636 is a reply to message #1717633] Tue, 15 December 2015 13:38 Go to previous messageGo to next message
Fon Vitale is currently offline Fon VitaleFriend
Messages: 14
Registered: November 2011
Junior Member
Analyzing more deeply the situation, an NPE is launched when the match change its state (APPEARED -- FIRE --> FIRED). I have changed the activation state of the rule for FIRED, but the rule is never invoked.
Re: Instancing twice to get results [message #1717658 is a reply to message #1717636] Tue, 15 December 2015 15:20 Go to previous messageGo to next message
Fon Vitale is currently offline Fon VitaleFriend
Messages: 14
Registered: November 2011
Junior Member
Well, I found the problem. It was a bad instance in the initialization method of my transformation. My fault.

On the other hand, is there any way to control the execution order of the rules? I know that RuleOrderBasedFixedPriorityResolver exists, but I think that it works when tehre are conflicts.

Thanks you!
Re: Instancing twice to get results [message #1717659 is a reply to message #1717658] Tue, 15 December 2015 15:23 Go to previous message
Abel Hegedus is currently offline Abel HegedusFriend
Messages: 187
Registered: September 2015
Senior Member
Hi,

yes, when there are multiple activations that can be fired in the same time, the conflict resolver decides which is executed next.
For most M2M use case, either the FixedPriority or the InverseDisappearanceFixedPriority resolvers are appropriate.

Cheers
Previous Topic:[Release] VIATRA 0.8.0
Next Topic:EMF-Incquery website/p2 update site not available
Goto Forum:
  


Current Time: Wed Sep 20 20:16:42 GMT 2017

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

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