| Forum: ATL |
|---|
| Topic: toString helper |
|---|
| toString helper [message #1059487] |
Sun, 19 May 2013 13:04 |
Basma Moukhtar Messages: 21 Registered: June 2010 |
Junior Member |
|
|
Dears,
I have a helper that's defined as this:
helper context MyPackage!MyClass def: toString() : String = 'Self To String;'
But I need to set a boolean attribute in self (MyPackage!MyClass) to true when the "toString" function is called.
I can't write self.myAttibute=true because my helper returns string.
How can I do this?
|
|
|
| Topic: XML2XML |
|---|
| XML2XML [message #1059470] |
Sun, 19 May 2013 06:23 |
samar sousou Messages: 42 Registered: March 2013 |
Member |
|
|
Hi every body,
I have a problem when i want to transform an XML to another XML in ATL.
When i want to translate a root vers the other root, i have this error "Cannot set feature children to value [org.eclipse.emf.ecore.impl.DynamicEObjectImpl@106c28e (eClass: org.eclipse.emf.ecore.impl.EClassImpl@45a13b (name: Attribute) (instanceClassName: null) (abstract: false, interface: false)), org.eclipse.emf.ecore.impl.DynamicEObjectImpl@22610b (eClass: org.eclipse.emf.ecore.impl.EClassImpl@15c4245 (name: Text) (instanceClassName: null) (abstract: false, interface: false)), org.eclipse.emf.ecore.impl.DynamicEObjectImpl@cf16e8 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@e25e24 (name: Element) (instanceClassName: null) (abstract: false, interface: false)), org.eclipse.emf.ecore.impl.DynamicEObjectImpl@1112380 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@15c4245 (name: Text) (instanceClassName: null) (abstract: false, interface: false)), org.eclipse.emf.ecore.impl.DynamicEObjectImpl@122d2ad (eClass: org.eclipse.emf.ecore.impl.EClassImpl@e25e24 (name: Element) (instanceClassName: null) (abstract: false, interface: false)), org.eclipse.emf.ecore.impl.DynamicEObjectImpl@31d83c (eClass: org.eclipse.emf.ecore.impl.EClassImpl@15c4245 (name: Text) (instanceClassName: null) (abstract: false, interface: false)), org.eclipse.emf.ecore.impl.DynamicEObjectImpl@1a71ca6 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@e25e24 (name: Element) (instanceClassName: null) (abstract: false, interface: false)), org.eclipse.emf.ecore.impl.DynamicEObjectImpl@6b5372 (eClass: org.eclipse.emf.ecore.impl.EClassImpl@15c4245 (name: Text) (instanceClassName: null) (abstract: false, interface: false))], inter-model references are forbidden. Configure launching options to allow them."
I didn't understand this error.
So, i need your help and this is my Root rule.
rule ROOT {
from
i : XMLS!Root
to
o: XMLC!Root (
name <- 'donneesMUDU',
startLine <- i.startLine,
startColumn <- i.startColumn,
endLine <- i.endLine,
endColumn <- i.endColumn,
children <- i.children
)
}
what should i do!
Thank you,
Samar
|
|
|
| Topic: Resolved: Uml2Uml: dynamic packagedElement Creation |
|---|
| Resolved: Uml2Uml: dynamic packagedElement Creation [message #1059003] |
Thu, 16 May 2013 03:49 |
Stefan L Messages: 5 Registered: July 2012 |
Junior Member |
|
|
Hi,
I'm desperately trying to generate packagedElements in my target model via my model rule for each class elements of my source model.
A simple code I found works with static code:
rule Model {
from s : UML2!"uml::Model"
to t : UML2!"uml::Model" (
name <- s.name,
packagedElement <- OrderedSet {services, information, processes}
),
services: UML2!"uml::Class" (
name <- 'asdf'
),
information: UML2!"uml::Class" (
name <- 'information view'
),
processes: UML2!"uml::Class" (
name <- 'services view'
)
}
But actually I want to do something like this, to generate multiple classes as packagedElements within the model scope:
rule Model {
from s : UML2!"uml::Model"
to t : UML2!"uml::Model" (
name <- s.name,
packagedElement <- OrderedSet {UML2!"uml::Class".allInstances()}
)
}
This gives me the following error:
Exception in thread "main" org.eclipse.m2m.atl.emftvm.util.VMException: java.lang.ClassCastException: org.eclipse.m2m.atl.emftvm.util.LazyList$UnionList cannot be cast to org.eclipse.emf.ecore.EObject
at rule Model@applier#12(../AtlTransform/test/test.atl#[65:3-65:70])
Local variables: [__trace__: TRACE!TraceLink = 25ea22df:TRACE!TraceLink, s: UML2!uml::Model = model:UML2!Model, t: UML2!uml::Model = model:UML2!Model]
at static EMFTVM!ExecEnv::main() : Object(../AtlTransform/test/test.atl)
Local variables: []
at org.eclipse.m2m.atl.emftvm.impl.CodeBlockImpl.internalExecute(CodeBlockImpl.java:989)
...
Whereas the static try works just fine. I don't know how i should interpret this EObject thingy.
Nevertheless, I would appreciate some hint/help here. Thanks.
Stefan
EDIT: ohmygod, now i actually have seen the error 
rule Model {
from s : UML2!"uml::Model"
to t : UML2!"uml::Model" (
name <- s.name,
packagedElement <- UML2!"uml::Class".allInstances()
)
}
I just removed the OrderedSet.
[Updated on: Thu, 16 May 2013 03:55] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.01828 seconds