Skip to main content



      Home
Home » Modeling » VIATRA » Instancing twice to get results
Instancing twice to get results [message #1717633] Tue, 15 December 2015 07:34 Go to next message
Eclipse UserFriend
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 08:38 Go to previous messageGo to next message
Eclipse UserFriend
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 10:20 Go to previous messageGo to next message
Eclipse UserFriend
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 10:23 Go to previous message
Eclipse UserFriend
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: Sat Jul 12 22:34:21 EDT 2025

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

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

Back to the top