Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL]problems with called rules
[ATL]problems with called rules [message #79677] Mon, 21 April 2008 17:30 Go to next message
Migert Kapaj is currently offline Migert KapajFriend
Messages: 2
Registered: July 2009
Junior Member
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$InternalSe ttingDelegateSingleContainer.dynamicSet(EStructuralFeatureIm pl.java:1824)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicSet(Basi cEObjectImpl.java:1116)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjec tImpl.java:1090)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjec tImpl.java:1061)
at
org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.set(A SMEMFModelElement.java:264)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:292)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:325)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:133)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:91)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:230)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:325)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:133)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:91)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.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.ja va:155)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:105)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:81)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:351)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:453)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.launch(AtlReg ularVM.java:425)
at
org.eclipse.m2m.atl.adt.launching.AtlLaunchConfigurationDele gate.launch(AtlLaunchConfigurationDelegate.java:35)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:766)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:608)
at
org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:899)
at
org.eclipse.debug.internal.ui.DebugUIPlugin$7.run(DebugUIPlu gin.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(SimpleDeb ugger.java:185)
at
org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:85)
at
org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.set(A SMEMFModelElement.java:267)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:292)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:325)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:133)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:91)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:230)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:325)
at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:133)
at
org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:91)
at
org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.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.ja va:155)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:105)
at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:81)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:351)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:453)
at
org.eclipse.m2m.atl.adt.launching.AtlRegularVM.launch(AtlReg ularVM.java:425)
at
org.eclipse.m2m.atl.adt.launching.AtlLaunchConfigurationDele gate.launch(AtlLaunchConfigurationDelegate.java:35)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:766)
at
org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:608)
at
org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:899)
at
org.eclipse.debug.internal.ui.DebugUIPlugin$7.run(DebugUIPlu gin.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$InternalSe ttingDelegateSingleContainer.dynamicSet(EStructuralFeatureIm pl.java:1824)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicSet(Basi cEObjectImpl.java:1116)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjec tImpl.java:1090)
at
org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjec tImpl.java:1061)
at
org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.set(A SMEMFModelElement.java:264)
... 25 more
Re: [ATL]problems with called rules [message #79770 is a reply to message #79677] Tue, 22 April 2008 09:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: Hugo.Bruneliere.univ-nantes.fr

Hi Migert,

Migert Kapaj a écrit :
> 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?

The problem is that you're trying to call a matched rule (which is not
callable) from an helper (which is not possible). Indeed, the goal of an
helper is to navigate the input model(s) in order to retrieve and/or
compute useful information to be used in the rules which build the
output model elements. Thus, you cannot create output model element from
an helper.

> Where is the guide to use lazy-rules?

You can find from
http://wiki.eclipse.org/ATL_Language_Troubleshooter#ATL_matc hed.2C_called_and_lazy_rules:_differences
more detailed information on lazy rules and on how to call them.
As lazy rules are also declarative ones, it's recommended using them (if
really needed of course).

Best regards,

Hugo

>
> 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$InternalSe ttingDelegateSingleContainer.dynamicSet(EStructuralFeatureIm pl.java:1824)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicSet(Basi cEObjectImpl.java:1116)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjec tImpl.java:1090)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjec tImpl.java:1061)
>
> at
> org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.set(A SMEMFModelElement.java:264)
>
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:292)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:325)
> at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:133)
>
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:91)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:230)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:325)
> at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:133)
>
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:91)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.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.ja va:155)
> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:105)
> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:81)
> at
> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:351)
>
> at
> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:453)
>
> at
> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.launch(AtlReg ularVM.java:425)
>
> at
> org.eclipse.m2m.atl.adt.launching.AtlLaunchConfigurationDele gate.launch(AtlLaunchConfigurationDelegate.java:35)
>
> at
> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:766)
>
> at
> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:608)
>
> at
> org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:899)
>
> at
> org.eclipse.debug.internal.ui.DebugUIPlugin$7.run(DebugUIPlu gin.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(SimpleDeb ugger.java:185)
> at
> org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:85)
>
> at
> org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.set(A SMEMFModelElement.java:267)
>
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:292)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:325)
> at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:133)
>
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:91)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:230)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:325)
> at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:133)
>
> at
> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:91)
> at
> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.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.ja va:155)
> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:105)
> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:81)
> at
> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:351)
>
> at
> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:453)
>
> at
> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.launch(AtlReg ularVM.java:425)
>
> at
> org.eclipse.m2m.atl.adt.launching.AtlLaunchConfigurationDele gate.launch(AtlLaunchConfigurationDelegate.java:35)
>
> at
> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:766)
>
> at
> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:608)
>
> at
> org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:899)
>
> at
> org.eclipse.debug.internal.ui.DebugUIPlugin$7.run(DebugUIPlu gin.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$InternalSe ttingDelegateSingleContainer.dynamicSet(EStructuralFeatureIm pl.java:1824)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicSet(Basi cEObjectImpl.java:1116)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjec tImpl.java:1090)
>
> at
> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjec tImpl.java:1061)
>
> at
> org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.set(A SMEMFModelElement.java:264)
>
> ... 25 more
>


--
--------------------------------------------------------
Hugo Bruneliere - R&D Engineer
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssiniere
44322 Nantes Cedex 3 - France
office +33 2 51 12 58 10 /\ cell.+33 6 07 42 45 30
EMail: Hugo.Bruneliere@univ-nantes.fr
http://www.sciences.univ-nantes.fr/lina/atl/
--------------------------------------------------------
Re: [ATL]problems with called rules [message #79890 is a reply to message #79770] Wed, 23 April 2008 14:33 Go to previous message
Migert Kapaj is currently offline Migert KapajFriend
Messages: 2
Registered: July 2009
Junior Member
Hi Hugo, thanks for your answer. The solution of my problem is to use two
foreach statement
foreach( a in thisModule.all_subclasses(source.owner))
for( b in thisModule.all_subclasses(a))
...........
this is possible in atl?



rule CopyReference {
from
s : KM3!Reference(if s.opposite.oclIsUndefined() then
true
else
false
endif
)
to
t : distinct KM3!Reference foreach(c in
thisModule.all_subclasses(s.owner))
for(b in thisModule.all_subclasses(s.type))
(
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 <- b,
owner <- c
)
}

Thank you,

Migert

"Hugo Bruneliere" <Hugo.Bruneliere@univ-nantes.fr> ha scritto nel messaggio
news:fukaq3$oc0$1@build.eclipse.org...
> Hi Migert,
>
> Migert Kapaj a écrit :
>> 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?
>
> The problem is that you're trying to call a matched rule (which is not
> callable) from an helper (which is not possible). Indeed, the goal of an
> helper is to navigate the input model(s) in order to retrieve and/or
> compute useful information to be used in the rules which build the output
> model elements. Thus, you cannot create output model element from an
> helper.
>
>> Where is the guide to use lazy-rules?
>
> You can find from
> http://wiki.eclipse.org/ATL_Language_Troubleshooter#ATL_matc hed.2C_called_and_lazy_rules:_differences
> more detailed information on lazy rules and on how to call them.
> As lazy rules are also declarative ones, it's recommended using them (if
> really needed of course).
>
> Best regards,
>
> Hugo
>
>>
>> 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$InternalSe ttingDelegateSingleContainer.dynamicSet(EStructuralFeatureIm pl.java:1824)
>> at
>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicSet(Basi cEObjectImpl.java:1116)
>> at
>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjec tImpl.java:1090)
>> at
>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjec tImpl.java:1061)
>> at
>> org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.set(A SMEMFModelElement.java:264)
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:292)
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:325)
>> at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)
>> at
>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:133)
>> at
>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:91)
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:230)
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:325)
>> at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)
>> at
>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:133)
>> at
>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:91)
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.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.ja va:155)
>> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:105)
>> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:81)
>> at
>> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:351)
>> at
>> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:453)
>> at
>> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.launch(AtlReg ularVM.java:425)
>> at
>> org.eclipse.m2m.atl.adt.launching.AtlLaunchConfigurationDele gate.launch(AtlLaunchConfigurationDelegate.java:35)
>> at
>> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:766)
>> at
>> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:608)
>> at
>> org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:899)
>> at
>> org.eclipse.debug.internal.ui.DebugUIPlugin$7.run(DebugUIPlu gin.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(SimpleDeb ugger.java:185)
>> at
>> org.eclipse.m2m.atl.engine.vm.StackFrame.printStackTrace(Sta ckFrame.java:85)
>> at
>> org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.set(A SMEMFModelElement.java:267)
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:292)
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:325)
>> at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)
>> at
>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:133)
>> at
>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:91)
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:230)
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.java:325)
>> at org.eclipse.m2m.atl.engine.vm.ASMOperation.exec(ASMOperation .java:161)
>> at
>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:133)
>> at
>> org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.invoke(ASM OclAny.java:91)
>> at
>> org.eclipse.m2m.atl.engine.vm.ASMOperation.realExec(ASMOpera tion.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.ja va:155)
>> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:105)
>> at org.eclipse.m2m.atl.engine.AtlLauncher.launch(AtlLauncher.ja va:81)
>> at
>> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:351)
>> at
>> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.runAtlLaunche r(AtlRegularVM.java:453)
>> at
>> org.eclipse.m2m.atl.adt.launching.AtlRegularVM.launch(AtlReg ularVM.java:425)
>> at
>> org.eclipse.m2m.atl.adt.launching.AtlLaunchConfigurationDele gate.launch(AtlLaunchConfigurationDelegate.java:35)
>> at
>> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:766)
>> at
>> org.eclipse.debug.internal.core.LaunchConfiguration.launch(L aunchConfiguration.java:608)
>> at
>> org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(D ebugUIPlugin.java:899)
>> at
>> org.eclipse.debug.internal.ui.DebugUIPlugin$7.run(DebugUIPlu gin.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$InternalSe ttingDelegateSingleContainer.dynamicSet(EStructuralFeatureIm pl.java:1824)
>> at
>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eDynamicSet(Basi cEObjectImpl.java:1116)
>> at
>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjec tImpl.java:1090)
>> at
>> org.eclipse.emf.ecore.impl.BasicEObjectImpl.eSet(BasicEObjec tImpl.java:1061)
>> at
>> org.eclipse.m2m.atl.drivers.emf4atl.ASMEMFModelElement.set(A SMEMFModelElement.java:264)
>> ... 25 more
>>
>
>
> --
> --------------------------------------------------------
> Hugo Bruneliere - R&D Engineer
> ATLAS Group (INRIA & LINA) - University of Nantes
> 2, rue de la Houssiniere
> 44322 Nantes Cedex 3 - France
> office +33 2 51 12 58 10 /\ cell.+33 6 07 42 45 30
> EMail: Hugo.Bruneliere@univ-nantes.fr
> http://www.sciences.univ-nantes.fr/lina/atl/
> --------------------------------------------------------
Previous Topic:[ATL] ATLTransformations
Next Topic:[QVTO]string operations and blackboxes
Goto Forum:
  


Current Time: Tue May 21 19:04:21 GMT 2019

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

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

Back to the top