[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.modeling.m2m] [ATL] Multiple Input Models Issue
|
- From: barrettr@xxxxxxxxxx (Ronan)
- Date: Fri, 16 Mar 2007 15:38:43 +0000 (UTC)
- Newsgroups: eclipse.modeling.m2m
- Organization: Eclipse
- User-agent: NewsPortal/0.36 (http://florian-amrhein.de/newsportal)
Hi,
My ATL transform takes in a number of input models (WSDL interfaces) and
produces one output model (UML Class Diagram). The problem is that each
time the root transformation(ProcessToRoot) runs (once for every input
model) it creates a new model in the output UML Class diagram. I want
there to be only one output model with a number of classes in it
representing each input interface. My attempt so far is below..
module XMLtoUML; -- Module Template
create OUT : UML from IN : XML, IN2 : XML;
rule ProcessToRoot{
from
r: XML!Root
--merge the two input models
using{
a:Set(XML!Root) =
XML!Root.allInstancesFrom('IN')->union(XML!Root.allInstancesFrom('IN2'));
}
to
rt : UML!Model(
packagedElement <-
a->collect(e|e.children->select(e|e.name='wsdl:portType')->collect(e|thisModule.PortTypeToInterface(e)))
)
}
lazy rule PortTypeToInterface{
from
pt: XML!Element(
pt.name = 'wsdl:portType'
)
to
inf : UML!Interface(
name <- pt.children->select(e|e.name='name')->first().value,
ownedOperation <-
pt.children->select(e|e.name='wsdl:operation')->collect(e|thisModule.OperationToOperation(e))
)
}
lazy rule OperationToOperation{
from
opx: XML!Element
to
opu : UML!Operation(
name <- opx.children->select(e|e.name='name')->first().value
)
}
I have successfully got the 2nd and 3rd rules merging correctly but need
the first rule to only fire once in order to create only one output model.
Any ideas?
Also is there any way to merge all input models without having to
explicitly enumerate them as I have done with the allInstancesFrom method
in a using block?
Cheers,
Ronan