Not a valid classifier [message #1085654] |
Tue, 13 August 2013 03:23  |
Eclipse User |
|
|
|
Hi all,
I'm now doing some work to merge two uml models into one uml model.
Here's the rule I designed to copy the property element in some class:
unique lazy rule Property_Clone {
from
s : UML!Property
to
t : UML!Property (
name <- s.name ,
lowerValue <- thisModule.ValueSpecification_Clone( s.lowerValue ) ,
upperValue <- thisModule.ValueSpecification_Clone( s.upperValue )
)
}
Here comes the rules which were called in the previous 'Property_Clone' rule:
unique lazy abstract rule ValueSpecification_Clone {
from
s : UML!ValueSpecification
to
t : UML!ValueSpecification (
name <- s.name
)
}
unique lazy rule LiteralString_Clone extends ValueSpecification_Clone {
from
s : UML!LiteralString
to
t : UML!LiteralString (
value <- s.value
)
}
unique lazy rule LiteralInteger_Clone extends ValueSpecification_Clone {
from
s : UML!LiteralInteger
to
t : UML!LiteralInteger (
value <- s.value
)
}
unique lazy rule LiteralBoolean_Clone extends ValueSpecification_Clone {
from
s : UML!LiteralBoolean
to
t : UML!LiteralBoolean (
value <- s.value
)
}
unique lazy rule LiteralReal_Clone extends ValueSpecification_Clone {
from
s : UML!LiteralReal
to
t : UML!LiteralReal (
value <- s.value
)
}
unique lazy rule LiteralUnlimitedNatural_Clone extends ValueSpecification_Clone {
from
s : UML!LiteralUnlimitedNatural
to
t : UML!LiteralUnlimitedNatural (
value <- s.value
)
}
and unfortunately when I launched my transform in eclipse, I got the message as follows:
org.eclipse.m2m.atl.emftvm.util.VMException: java.lang.IllegalArgumentException: The class 'ValueSpecification' is not a valid classifier
at rule Property_Clone@applier#9(platform:/resource//name.ryan.mist.m2m.protobuf2uml/transform/UMLMerge.atl#[247:18-247:69])
Local variables: [__trace__: TRACE!TraceLink = 11a5c22:TRACE!TraceLink, s: UML!Property = reqid:UML!Property, t: UML!Property = reqid:UML!Property]
at rule Class_L@applier@0#2(platform:/resource//name.ryan.mist.m2m.protobuf2uml/transform/UMLMerge.atl#[145:25-145:53])
Local variables: [i = reqid:UML!Property]
at public org.eclipse.m2m.atl.emftvm.util.LazyList org.eclipse.m2m.atl.emftvm.util.LazyList.collect(org.eclipse.m2m.atl.emftvm.CodeBlock)
Local variables: []
at rule Class_L@applier#16(platform:/resource//name.ryan.mist.m2m.protobuf2uml/transform/UMLMerge.atl#[144:6-145:54])
Local variables: [__trace__: TRACE!TraceLink = 196d977:TRACE!TraceLink, s_l: UML!Class = DetailInfoResult:UML!Class, t: UML!Class = DetailInfoResult:UML!Class]
at static EMFTVM!ExecEnv::main() : Object(platform:/resource//name.ryan.mist.m2m.protobuf2uml/transform/UMLMerge.atl)
Local variables: []
It seems that s.lowerValue or s.upperValue which is of the type 'UML!ValueSpecification' cannot be used as the input parameter in the rule 'ValueSpecification_Clone'
And then I changed my rule 'Property_Clone' into
unique lazy rule Property_Clone {
from
s : UML!Property
to
t : UML!Property (
name <- s.name ,
lowerValue <- if s.lowerValue.oclIsTypeOf(UML!LiteralInteger)
then thisModule.LiteralInteger_Clone( s.lowerValue )
else if s.lowerValue.oclIsTypeOf(UML!LiteralString)
then thisModule.LiteralString_Clone( s.lowerValue )
else if s.lowerValue.oclIsTypeOf(UML!LiteralBoolean)
then thisModule.LiteralBoolean_Clone( s.lowerValue )
else if s.lowerValue.oclIsTypeOf(UML!LiteralReal)
then thisModule.LiteralReal_Clone( s.lowerValue )
else thisModule.LiteralUnlimitedNatural_Clone( s.lowerValue )
endif endif endif endif ,
upperValue <- if s.upperValue.oclIsTypeOf(UML!LiteralInteger)
then thisModule.LiteralInteger_Clone( s.upperValue )
else if s.upperValue.oclIsTypeOf(UML!LiteralString)
then thisModule.LiteralString_Clone( s.upperValue )
else if s.upperValue.oclIsTypeOf(UML!LiteralBoolean)
then thisModule.LiteralBoolean_Clone( s.upperValue )
else if s.upperValue.oclIsTypeOf(UML!LiteralReal)
then thisModule.LiteralReal_Clone( s.upperValue )
else thisModule.LiteralUnlimitedNatural_Clone( s.upperValue )
endif endif endif endif
)
}
In this case, I just neglect the abstract rule and call the extended rules directly,
and the error message disappeared.
Though I fixed the problem, I got a little bit confused with that code,
so my questions are:
1. Is there any problems in my usage of the 'abstract-extends' relationship in ATL?
2. Why the previous 'Property_Clone' rule doesn't work and shows the error message?
I'm hoping for your answers.
Thank you for reading.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03530 seconds