I need to submit my project omorrow,but there are some errors! [message #1029270] |
Fri, 29 March 2013 12:07 |
yesheng chai Messages: 64 Registered: March 2013 |
Member |
|
|
module Activites2PetriNets2;
create OUT : PetriNets from IN : UML;
helper context UML!Package def:isTopLevelPackage:Boolean=
if self.refImmediateComposite().oclIsUndefined() then
true
else
false
endif;
rule Package
{
from
s: UML!Package(s.isTopLevelPackage)
to
t1:PetriNets!PetriNet
(
name <- s.packagedElement->collect(e|e.name).first()+'_PetriNets'
)
}
rule InitialNode
{
from
s:
UML!InitialNode
to
t1:
PetriNets!Place
(
name <- s.name+'_InitialNode',
outgoing <- t2,
token <-1
),
t2:
PetriNets!PlaceToTransition
(
name <- s.name+'_PlaceToTransition',
target <- t3
),
t3:
PetriNets!Transition
(
name <- s.name+'_Transition',
outgoing <- s.outgoing.first()//error
)
}
rule OpaqueAction
{
from
s:
UML!OpaqueAction
to
t1:
PetriNets!Transition
(
name <- s.name+'_Transition',
incoming <- thisModule.resolveTemp(s.incoming,'t3'),//error
outgoing <- s.outgoing
)
}
rule ActivityFinalNode
{
from
s:UML!ActivityFinalNode
to
t1:PetriNets!Transition
(incoming <- thisModule.resolveTemp(s.incoming,'t3'),//error
name <- s.name+'_Transition',
outgoing <- t2
),
t2:PetriNets!TransitionToPlace
(
name <- s.name+'_TransitionToPlace',
target <- t3,
Guards <- t4,
Weights <- t5
),
t3:PetriNets!Place
(
name <- s.name+'_Place',
token <- 0
),
t4:PetriNets!Guard
(
name <- 'null',
value <- 'true'
),
t5:PetriNets!Weight
(
name <- 'null',
value <- '0'
)
}
rule ControlFlowEdge
{
from
s:UML!ControlFlow
to
t1:PetriNets!TransitionToPlace
(
name <- s.name+'_TransitionToPlace',
target <- t2
),
t2:PetriNets!Place
(
name <- s.name+'_Place',
outgoing <- t3
),
t3:PetriNets!PlaceToTransition
(
name <- s.name+'_PlaceToTransition'
)
}
I have marked the wrong place with the error.The references can not work.I also want to generate default id(like xmi:id= or id=) corresponding to reference.
<?xml version="1.0" encoding="ISO-8859-1"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns="PetriNets">
<PetriNet name="Activity1_PetriNets"/>
<Place name="Begin_InitialNode" token="1" outgoing="/2"/>
<PlaceToTransition name="Begin_PlaceToTransition" source="/1" target="/3"/>
<Transition name="Begin_Transition" incoming="/2" outgoing="/8"/>
<Transition name="eat_Transition" outgoing="/11"/>
<Transition name="over_Transition" outgoing="/6"/>
<TransitionToPlace name="over_TransitionToPlace" target="/7" source="/5">
<Guards name="null" value="true"/>
<Weights name="null" value="0"/>
</TransitionToPlace>
<Place name="over_Place" incoming="/6"/>
<TransitionToPlace name="First_TransitionToPlace" target="/9" source="/3"/>
<Place name="First_Place" outgoing="/10" incoming="/8"/>
<PlaceToTransition name="First_PlaceToTransition" source="/9"/>
<TransitionToPlace name="Second_TransitionToPlace" target="/12" source="/4"/>
<Place name="Second_Place" outgoing="/13" incoming="/11"/>
<PlaceToTransition name="Second_PlaceToTransition" source="/12"/>
</xmi:XMI>
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03598 seconds