[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.modeling.m2m] [ATL]problems with called rules
|
Hello all, i have a problem with this ATL code. The scope of this program is
to derive the references from one class to all subclasses.
Where is the problem?
Is possible to generate an target model with a helper?
Where is the guide to use lazy-rules?
Thanks in advance
Migert Kapaj
create OUT : KM3 from IN : KM3;
helper def: relazioni(inp : KM3!Reference) : Set(KM3!Reference) =
thisModule.all_subclasses(inp.owner)->iterate(iter; acc:
Set(KM3!Reference)=Set{} |
acc->union(Set{thisModule.creaRelazione(inp,iter,inp.type)})
);
rule creaRelazione
{
from rel: KM3!Reference, owner1: KM3!Class, type1: KM3!Class
to relazione : KM3!Reference(
isContainer <- rel.isContainer,
--opposite <- rel.opposite,
name <- rel.name,--.concat(type.name),
location <- rel.location,
lower <- rel.lower,
upper <- rel.upper,
isOrdered <- rel.isOrdered,
isUnique <- rel.isUnique,
type <- type1,
owner <- owner1
)
}
rule CopyReference {
from
s : KM3!Reference(if s.opposite.oclIsUndefined() then
true
else
false
endif
)
to
t : distinct KM3!Reference foreach(c in
thisModule.relazioni(s))--relazioni(s))
(
isContainer <- s.isContainer,
--opposite <- c.opposite,
name <- s.name,
location <- s.location,
lower <- s.lower,
upper <- s.upper,
isOrdered <- s.isOrdered,
isUnique <- s.isUnique,
type <- s.type,
owner <- c
)
}
... other rules are OK
GRAVE: ****** BEGIN Stack Trace
GRAVE: message: cannot set feature KM3!Reference.owner to value
org.eclipse.emf.ecore.impl.DynamicEObjectImpl@1261ef2 (eClass:
org.eclipse.emf.ecore.impl.EClassImpl@1b529d6 (name: Reference)
(instanceClassName: null) (abstract: false, interface: false))
GRAVE: exception:
GRAVE: The value of type 'org.eclipse.emf.ecore.impl.EClassImpl@1b529d6
(name: Reference) (instanceClassName: null) (abstract: false, interface:
false)' must be of type 'org.eclipse.emf.ecore.impl.EClassImpl@7f6155 (name:
Class) (instanceClassName: null) (abstract: false, interface: false)'
java.lang.ClassCastException: The value of type
'org.eclipse.emf.ecore.impl.EClassImpl@1b529d6 (name: Reference)
(instanceClassName: null) (abstract: false, interface: false)' must be of
type 'org.eclipse.emf.ecore.impl.EClassImpl@7f6155 (name: Class)
(instanceClassName: null) (abstract: false, interface: false)'
at
org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSettingDelegateSingleContainer.dynamicSet(EStructuralFeatureImpl.java:1824)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicSet(BasicEObjectImpl.java:1116)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjectImpl.java:1090)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjectImpl.java:1061)
at
org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.set(ASMEMFModelElement.java:264)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:292)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:325)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation.java:161)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:133)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:91)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:230)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:325)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation.java:161)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:133)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:91)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:230)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation.java:161)
at
org.eclipse.m2m.atl.engine.vm.ASMInterpreter.<init>(ASMInterpreter.java:289)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.java:155)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.java:105)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.java:81)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLauncher(AtlRegularVM.java:351)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLauncher(AtlRegularVM.java:453)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.launch(AtlRegularVM.java:425)
at
org.eclipse.m2m.atl.adt.launching.AtlLaunchConfigurationDelegate.launch(AtlLaunchConfigurationDelegate.java:35)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:766)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:608)
at
org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:899)
at
org.eclipse.debug.internal.ui.DebugUIPlugin$7.run(DebugUIPlugin.java:1102)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
GRAVE: A.main() : ??#24 null
GRAVE: local variables = {self=KM3Pulito : ASMModule}
GRAVE: local stack = []
GRAVE: A.__exec__() : ??#38 null
GRAVE: local variables = {e=TransientLink {rule = 'CopyReference',
sourceElements = {s = IN!literals}, targetElements = {t = Sequence
{OUT!literals}}, variables = {}}, self=KM3Pulito : ASMModule}
GRAVE: local stack = []
GRAVE: A.__applyCopyReference(1 : NTransientLink;) : ??#145 182:8-182:18
GRAVE: local variables = {t=Sequence {OUT!literals}, s=IN!literals,
link=TransientLink {rule = 'CopyReference', sourceElements = {s =
IN!literals}, targetElements = {t = Sequence {OUT!literals}}, variables =
{}}, self=KM3Pulito : ASMModule, c=OUT!literals, collection=Sequence
{OUT!literals, OUT!literals}, counter=1}
GRAVE: local stack = [OUT!literals]
GRAVE: ****** END Stack Trace
INFO: Execution terminated due to error (see launch configuration to allow
continuation after errors).
GRAVE: cannot set feature KM3!Reference.owner to value
org.eclipse.emf.ecore.impl.DynamicEObjectImpl@1261ef2 (eClass:
org.eclipse.emf.ecore.impl.EClassImpl@1b529d6 (name: Reference)
(instanceClassName: null) (abstract: false, interface: false))
java.lang.RuntimeException: cannot set feature KM3!Reference.owner to value
org.eclipse.emf.ecore.impl.DynamicEObjectImpl@1261ef2 (eClass:
org.eclipse.emf.ecore.impl.EClassImpl@1b529d6 (name: Reference)
(instanceClassName: null) (abstract: false, interface: false))
at
org.eclipse.m2m.atl.engine.vm.SimpleDebugger.error(SimpleDebugger.java:185)
at
org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(StackFrame.java:85)
at
org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.set(ASMEMFModelElement.java:267)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:292)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:325)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation.java:161)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:133)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:91)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:230)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:325)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation.java:161)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:133)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASMOclAny.java:91)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOperation.java:230)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation.java:161)
at
org.eclipse.m2m.atl.engine.vm.ASMInterpreter.<init>(ASMInterpreter.java:289)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.java:155)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.java:105)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.java:81)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLauncher(AtlRegularVM.java:351)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLauncher(AtlRegularVM.java:453)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.launch(AtlRegularVM.java:425)
at
org.eclipse.m2m.atl.adt.launching.AtlLaunchConfigurationDelegate.launch(AtlLaunchConfigurationDelegate.java:35)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:766)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:608)
at
org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:899)
at
org.eclipse.debug.internal.ui.DebugUIPlugin$7.run(DebugUIPlugin.java:1102)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.lang.ClassCastException: The value of type
'org.eclipse.emf.ecore.impl.EClassImpl@1b529d6 (name: Reference)
(instanceClassName: null) (abstract: false, interface: false)' must be of
type 'org.eclipse.emf.ecore.impl.EClassImpl@7f6155 (name: Class)
(instanceClassName: null) (abstract: false, interface: false)'
at
org.eclipse.emf.ecore.impl.EStructuralFeatureImpl$InternalSettingDelegateSingleContainer.dynamicSet(EStructuralFeatureImpl.java:1824)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicSet(BasicEObjectImpl.java:1116)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjectImpl.java:1090)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjectImpl.java:1061)
at
org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.set(ASMEMFModelElement.java:264)
... 25 more