Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » Refining mode, multiple inputs, same metamodel.
Refining mode, multiple inputs, same metamodel. [message #1781745] Mon, 12 February 2018 22:48
Gonzalo López is currently offline Gonzalo LópezFriend
Messages: 14
Registered: February 2018
Junior Member
Hello,

I´m trying to transform a model (base) inserting into it some elements from another model (replacement). I´m working with bpmn metamodel.

First I tryed something like this (it´s pretty much hardcoded cause I´m starting):

-- @atlcompiler atl2010
-- @nsURI BPMN20=http:// www. omg .org/spec/BPMN/20100524/MODEL

module substitution;
create out : BPMN20 from base : BPMN20, replacement : BPMN20;

--select the only task in replacement.bpmn
helper def: replacementTask: BPMN20!Task =
	BPMN20!Task.allInstancesFrom('replacement').first();

helper def: incoming: Sequence(BPMN20!SequenceFlow) =
	BPMN20!SequenceFlow.allInstancesFrom('base') -> select(f | f.id = 'SequenceFlow_3');

helper def: outgoing: Sequence(BPMN20!SequenceFlow) =
	BPMN20!SequenceFlow.allInstancesFrom('base') -> select(f | f.id = 'SequenceFlow_5');


	

rule replace {
	from
		proc: BPMN20!Process in base
	to
		c: BPMN20!Process  (
			flowElements <- proc.flowElements.including(newTask)
		),
		newTask: BPMN20!Task (
			id <- 'new_id',
			name <- thisModule.replacementTask.name,
			incoming <- thisModule.incoming,
			outgoing <- thisModule.outgoing
						
		)
}


Once I ran it I got the followint message:

Cannot set feature flowElements to value [org.eclipse.bpmn2.impl.StartEventImpl@5e67d3cb (id: StartEvent_1, anyAttribute: null) (name: Start Event 1) (parallelMultiple: false) (isInterrupting: true), org.eclipse.bpmn2.impl.EndEventImpl@6bbb1fea (id: EndEvent_1, anyAttribute: null) (name: End Event 1), org.eclipse.bpmn2.impl.TaskImpl@7b00bfa5 (id: Task_1, anyAttribute: null) (name: tarea1) (completionQuantity: 1, isForCompensation: false, startQuantity: 1), org.eclipse.bpmn2.impl.SequenceFlowImpl@4eaa8c94 (id: SequenceFlow_2, anyAttribute: null) (name: null) (isImmediate: false), org.eclipse.bpmn2.impl.TaskImpl@c2e54ee (id: Task_2, anyAttribute: null) (name: tarea2) (completionQuantity: 1, isForCompensation: false, startQuantity: 1), org.eclipse.bpmn2.impl.SequenceFlowImpl@330814ea (id: SequenceFlow_3, anyAttribute: null) (name: null) (isImmediate: false), org.eclipse.bpmn2.impl.TaskImpl@6c37272b (id: Task_3, anyAttribute: null) (name: tarea3) (completionQuantity: 1, isForCompensation: false, startQuantity: 1), org.eclipse.bpmn2.impl.SequenceFlowImpl@27351ff1 (id: SequenceFlow_4, anyAttribute: null) (name: null) (isImmediate: false), org.eclipse.bpmn2.impl.SequenceFlowImpl@5d32c1f (id: SequenceFlow_5, anyAttribute: null) (name: null) (isImmediate: false), org.eclipse.bpmn2.impl.TaskImpl@7f311d06 (id: null, anyAttribute: null) (name: null) (completionQuantity: 1, isForCompensation: false, startQuantity: 1)], containment references cannot span across models.


I managed to make it work by adding, in inputs, BPMN20 metamodel twice, with different names:


-- @atlcompiler atl2010
-- @nsURI BPMN20BASE=http:/ /www. omg. org/spec/BPMN/20100524/MODEL
-- @nsURI BPMN20REPLACEMENT=http:// www. omg .org/spec/BPMN/20100524/MODEL

module subst7;
create out : BPMN20BASE refining base : BPMN20BASE, replacement : BPMN20REPLACEMENT;

--select the only task in replacement.bpmn
helper def: replacementTask: BPMN20REPLACEMENT!Task =
	BPMN20REPLACEMENT!Task.allInstancesFrom('replacement').first();

helper def: incoming: Sequence(BPMN20BASE!SequenceFlow) =
	BPMN20BASE!SequenceFlow.allInstancesFrom('base') -> select(f | f.id = 'SequenceFlow_3');

helper def: outgoing: Sequence(BPMN20BASE!SequenceFlow) =
	BPMN20BASE!SequenceFlow.allInstancesFrom('base') -> select(f | f.id = 'SequenceFlow_5');


	
	
rule replace {
	from
		proc: BPMN20BASE!Process in base
	to
		c: BPMN20BASE!Process  (
			flowElements <- proc.flowElements.including(newTask)
		),
		newTask: BPMN20BASE!Task (
			id <- 'new_id',
			name <- thisModule.replacementTask.name,
			incoming <- thisModule.incoming,
			outgoing <- thisModule.outgoing
						
		)
}


However:
1- I´m not sure thats the correct way to solve it, doesn´t seem right.
2- I still get the "containment references cannot span across models" message if I try to run the transformation through java.

Is there a way to achieve this?

Thank you
Previous Topic:Error executing add and drop BPMN2.0
Next Topic:Example TCS for OWL to RDF/XML serialization
Goto Forum:
  


Current Time: Fri Nov 16 18:51:22 GMT 2018

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

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

Back to the top