Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » how to construct a uml property in the LET expression
how to construct a uml property in the LET expression [message #537096] Tue, 01 June 2010 10:23 Go to next message
wafaa is currently offline wafaaFriend
Messages: 163
Registered: January 2010
Location: Egypt
Senior Member
hi all

I am supposed to construct a class ownedAttributes from aother classes that has stereotype 'datatype'
I stopped in how to create a uml property in the let expression and fill its attributes like name and type, and the class that owns this property, all these constructed properties will be appended in a sequence then returned to the ownedAttribute property

can u check the idea and tell me how to use it



rule ontClass{
from
oc : UML!Class(
oc.hasStereotype('OntClass')
)
to
c : UML!Class(
name <- oc.name ,
ownedAttribute <- oc.myDatatypeProperty -> iterate( p ; propSeq : Sequence(UML!Property) = Sequence{} |
let a : UML!Property = ?????
-- i want here to set its name as p.name
-- type as p.ownedAttribute -> select(m | m.hasStereotype('range')) -> asSequecnce() ->first().type
--and the owner is of course class c

propSeq.including(a)
)
}

-- where myDatatypeProperty is a sequence of uml class that each class of this sequence will create an attribute in the class who calls the helper

thanks in advanced
Re: how to construct a uml property in the LET expression [message #537120 is a reply to message #537096] Tue, 01 June 2010 11:44 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
use a lazy rule
Re: how to construct a uml property in the LET expression [message #537190 is a reply to message #537120] Tue, 01 June 2010 15:05 Go to previous messageGo to next message
wafaa is currently offline wafaaFriend
Messages: 163
Registered: January 2010
Location: Egypt
Senior Member
thank you , but can you explain how to use the lazy rule
i have seen examples and I do not know what is the role of element e in the called rule,
it is the only example i found about lazy rule from the use cases of atl


rule BlkA2BlkB {
from
blkA : TypeA!BlockA
to
blkB : TypeB!BlockB (
inputPorts <- blkA.inputPorts->
collect(e | thisModule.PortA2InPortB(e)),
outputPorts <- blkA.outputPorts->
collect(e | thisModule.PortA2OutPortB(e))
)
}

lazy rule PortA2InPortB {
from
s : TypeA!PortA
to
t : TypeB!InPortB (
name <- s.name
)
}

is that mean the e is put in the from section of the called rule

[Updated on: Tue, 01 June 2010 15:06]

Report message to a moderator

Re: how to construct a uml property in the LET expression [message #537206 is a reply to message #537190] Tue, 01 June 2010 15:19 Go to previous messageGo to next message
wafaa is currently offline wafaaFriend
Messages: 163
Registered: January 2010
Location: Egypt
Senior Member
I have written test but doesnot work


rule ontClass{
from
oc : UML!Class(
oc.hasStereotype('OntClass')
)
to
c : UML!Class(
name <- oc.name ,
ownedAttribute <- oc.myDatatypeProperty -> collect(e | thisModule.dtp2umlP(e))
)
}

lazy rule dtp2umlP{
from dtp : UML!Class
to p :UML!Property(
name <- dtp.name,
type <- dtp.ownedAttribute ->select(x | x.hasStereotype('range'))->asSequence()->first().type
)
}

where Mydatatype property is helper like this

helper context UML!Class def: myDatatypeProperty : Sequence(UML!Class)=
thisModule.allDatatypeProperty -> iterate(p ; test : Sequence(UML!Class) = Sequence{}|
if p.ownedAttribute -> select(x |x.hasStereotype('domain'))->asSequence() ->first().type = self
then
test.including(p)
else
test
endif
);
Re: how to construct a uml property in the LET expression [message #537207 is a reply to message #537190] Tue, 01 June 2010 15:19 Go to previous message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
wafaa wrote on Tue, 01 June 2010 11:05

is that mean the e is put in the from section of the called rule
[/color]

yes
Previous Topic:[ATL] setting __xmiID__ values doesn't work?
Next Topic:[QVTO] compile transformation sources at forehand
Goto Forum:
  


Current Time: Mon Nov 04 08:13:10 GMT 2024

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

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

Back to the top