Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » ATL » I need to submit my project omorrow,but there are some errors!
I need to submit my project omorrow,but there are some errors! [message #1029270] Fri, 29 March 2013 12:07 Go to next message
yesheng chai is currently offline yesheng chaiFriend
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>

Re: I need to submit my project omorrow,but there are some errors! [message #1029945 is a reply to message #1029270] Sat, 30 March 2013 12:19 Go to previous messageGo to next message
yesheng chai is currently offline yesheng chaiFriend
Messages: 64
Registered: March 2013
Member
In the error line, instead of s.incoming you have to write the navigation
expression to reach *in the source model* the element to translate.

Re: I need to submit my project omorrow,but there are some errors! [message #1029946 is a reply to message #1029945] Sat, 30 March 2013 12:20 Go to previous messageGo to next message
yesheng chai is currently offline yesheng chaiFriend
Messages: 64
Registered: March 2013
Member
Dear Massimo Tisi,
> Thank you for your reply !I know that incoming in the OpaqueAction of
> UML metamodel is a sequence ,so that I modify the sentence like
> :incoming <- thisModule.resolveTemp(s.incoming.first(),'t3')and then
> it works .
> The following is the part of my output code:
> <Place name="Begin_InitialNode" outgoing="/2"/>
> <PlaceToTransition name="Begin_PlaceToTransition" source="/1" target="/3"/>
> <Transition name="Begin_Transition" incoming="/2" outgoing="/8"/>
> I want to automatically generate the value of identifier Id in each
> element ,which correspond to incoming or outgoing reference .
> I want to get the file like:
> <Place name="Begin_InitialNode" Id="/1" outgoing="/2"/>
> <PlaceToTransition name="Begin_PlaceToTransition" Id="/2" source="/1"
> target="/3"/>
> <Transition name="Begin_Transition" Id="/3" incoming="/2" outgoing="/8"/>
> How can I do ?
> Look forward to your reply!
> Best Wishes!
> YeshengChai
Re: I need to submit my project omorrow,but there are some errors! [message #1029947 is a reply to message #1029946] Sat, 30 March 2013 12:20 Go to previous messageGo to next message
yesheng chai is currently offline yesheng chaiFriend
Messages: 64
Registered: March 2013
Member
you can add a binding like this:

__xmiID__ <- newvalueoftheid
Re: I need to submit my project omorrow,but there are some errors! [message #1029950 is a reply to message #1029947] Sat, 30 March 2013 12:21 Go to previous messageGo to next message
yesheng chai is currently offline yesheng chaiFriend
Messages: 64
Registered: March 2013
Member
The values of outgoing and incoming are automatically generated by the
> system. I also want to the value of id is automatically generated and
> the value of outgoing and incoming are determined by id.
> binding :__xmiID__ <- newvalueoftheid
> I do not know that what expression represent "newvalueoftheid".
> Can you describe it in detail!
> Thank you very much !
> Best Wishes !
> YeshengChai
>
Re: I need to submit my project omorrow,but there are some errors! [message #1029951 is a reply to message #1029950] Sat, 30 March 2013 12:22 Go to previous messageGo to next message
yesheng chai is currently offline yesheng chaiFriend
Messages: 64
Registered: March 2013
Member
__xmiID__ allows you to manually decide what would be the id of each
element. You can for instance copy it from the __xmiID__ of the source,
like:
__xmiID__ <- s.__xmiID__

however you will not get the same ID numbering as the default XMI
serializer. To do this is more complicated and requires some java
programming for configuring the serializer.

Cheers,
Re: I need to submit my project omorrow,but there are some errors! [message #1029952 is a reply to message #1029951] Sat, 30 March 2013 12:22 Go to previous messageGo to next message
yesheng chai is currently offline yesheng chaiFriend
Messages: 64
Registered: March 2013
Member
Dear Massimo Tisi,
> From the output code :
> <Place name="Begin_InitialNode" token="1" outgoing="/2"/>
> <PlaceToTransition name="Begin_PlaceToTransition" source="/1" target="/3"/>
> <Transition name="Begin_Transition" incoming="/2" outgoing="/8"/>
> I think the id of Place ,PlaceToTransition,Transition respectively seen
> as 1,2 ,3 in ATL_VM .I want to get those values because the the values of
> outgoing and incoming come from them .
> If I assign the source id to target id, but the value of incoming and
> outgoing do not come from them so that I can not know the relationship
> of elements .
> Outgoing and incoming are references pointing to elements.
> Best Wishes!
> YeshengChai
>
Re: I need to submit my project omorrow,but there are some errors! [message #1029953 is a reply to message #1029952] Sat, 30 March 2013 12:23 Go to previous message
yesheng chai is currently offline yesheng chaiFriend
Messages: 64
Registered: March 2013
Member
when you set ids with __xmiID__ all the other references (like incoming and
outgoing) are updated.
Previous Topic:How can I get the MARTE Metamodel
Next Topic:How I can get the hierarchy of the events on a UML lifeline?
Goto Forum:
  


Current Time: Thu Dec 18 21:57:31 GMT 2014

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

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