Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] How to create a new model element that contains a text.
[ATL] How to create a new model element that contains a text. [message #43058] Wed, 30 May 2007 13:51 Go to next message
Eclipse UserFriend
Originally posted by: erik_becker.gmx.de

Hi all,

for my transformation I need to create a model element that references
some elements that contain only text, e. g.:
<packageHeader>
<xpdlVersion>2.0</xpdlVersion>
..
</packageHeader>

I want to do this by called rule because there's no matching element in
my source model.
For the creation I wrote the following rule:

rule CreatePackageHeader() {
to
packageHeader : XPDL!PackageHeader(
xpdlVersion <- '2.0',
...
)
}

if I call the rule in the binding section of a matched rule to bind the
'packageHeader' to a reference I get an error:

A.main() : ??#26 null
local variables = {self=aml2xpdl : ASMModule}
local stack = []
A.__exec__() : ??#8 null
local variables = {self=aml2xpdl : ASMModule, e=TransientLink {rule =
'CreatePackage', sourceElements = {root = IN!AML}, targetElements =
{package = OUT!PackageName}, variables = {}}}
local stack = []
A.__applyCreatePackage(1 : NTransientLink;) : ??#30 17:42-17:74
local variables = {package=OUT!PackageName, root=IN!AML, self=aml2xpdl
: ASMModule, link=TransientLink {rule = 'CreatePackage', sourceElements
= {root = IN!AML}, targetElements = {package = OUT!PackageName},
variables = {}}}
local stack = [OUT!PackageName, OUT!PackageName, aml2xpdl : ASMModule]
A.CreatePackageHeader() : ??#13 24:25-24:50
local variables = {self=aml2xpdl : ASMModule, packageHeader=OUT!<unnamed>}
local stack = [OUT!<unnamed>]
****** END Stack Trace
Execution terminated due to error (see launch configuration to allow
continuation after errors).

Because I'm (at the moment) not very familiar with ATL I don't
understand what the failure. Can anyone help?

Greetings

Erik
Re: [ATL] How to create a new model element that contains a text. [message #43092 is a reply to message #43058] Wed, 30 May 2007 14:08 Go to previous messageGo to next message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hi Erik,

You cut the stack trace after the error message, this may be why you do
not understand it ;-).

Your problem does not seem to be with ATL, but with the XML metamodel
(or with XML in general, since this metamodel is very close to the XML DOM).

To have text nodes, you need to create a Text element, which value is
the text you want to have.


On another matter: I am very surprised that you need to use a called
rule. I can understand that there is no matching element for
packageHeader, but there is probably a matching element for "package"?
Then you could create the packageHeader, xpdlVersion, and Text node as
additional elements of the rule matching "package" ;-).


Regards,

Frédéric Jouault


Erik Becker wrote:
> Hi all,
>
> for my transformation I need to create a model element that references
> some elements that contain only text, e. g.:
> <packageHeader>
> <xpdlVersion>2.0</xpdlVersion>
> ..
> </packageHeader>
>
> I want to do this by called rule because there's no matching element in
> my source model.
> For the creation I wrote the following rule:
>
> rule CreatePackageHeader() {
> to
> packageHeader : XPDL!PackageHeader(
> xpdlVersion <- '2.0',
> ...
> )
> }
>
> if I call the rule in the binding section of a matched rule to bind the
> 'packageHeader' to a reference I get an error:
>
> A.main() : ??#26 null
> local variables = {self=aml2xpdl : ASMModule}
> local stack = []
> A.__exec__() : ??#8 null
> local variables = {self=aml2xpdl : ASMModule, e=TransientLink {rule
> = 'CreatePackage', sourceElements = {root = IN!AML}, targetElements =
> {package = OUT!PackageName}, variables = {}}}
> local stack = []
> A.__applyCreatePackage(1 : NTransientLink;) : ??#30 17:42-17:74
> local variables = {package=OUT!PackageName, root=IN!AML,
> self=aml2xpdl : ASMModule, link=TransientLink {rule = 'CreatePackage',
> sourceElements = {root = IN!AML}, targetElements = {package =
> OUT!PackageName}, variables = {}}}
> local stack = [OUT!PackageName, OUT!PackageName, aml2xpdl : ASMModule]
> A.CreatePackageHeader() : ??#13 24:25-24:50
> local variables = {self=aml2xpdl : ASMModule,
> packageHeader=OUT!<unnamed>}
> local stack = [OUT!<unnamed>]
> ****** END Stack Trace
> Execution terminated due to error (see launch configuration to allow
> continuation after errors).
>
> Because I'm (at the moment) not very familiar with ATL I don't
> understand what the failure. Can anyone help?
>
> Greetings
>
> Erik
Re: [ATL] How to create a new model element that contains a text. [message #43106 is a reply to message #43092] Wed, 30 May 2007 14:23 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: erik_becker.gmx.de

Hi Frédéric,

my target model is not XML it's XPDL. I use the XPDL meta model from the
altlantic zoo, which I extended because it doesn't cover the full XPDL.

I know how to create a text node in model instances of XML meta model
but isn't there a possibility to have in arbitrary model elements?
I would like to have in my XPDL model something like listed below.

Greets

Erik


Frédéric Jouault schrieb:
> Hi Erik,
>
> You cut the stack trace after the error message, this may be why you do
> not understand it ;-).
>
> Your problem does not seem to be with ATL, but with the XML metamodel
> (or with XML in general, since this metamodel is very close to the XML
> DOM).
>
> To have text nodes, you need to create a Text element, which value is
> the text you want to have.
>
>
> On another matter: I am very surprised that you need to use a called
> rule. I can understand that there is no matching element for
> packageHeader, but there is probably a matching element for "package"?
> Then you could create the packageHeader, xpdlVersion, and Text node as
> additional elements of the rule matching "package" ;-).

Should I create the 'packageHeader' in the 'do' section of this rule?
Is there a disadvantage in using a called rule?

>
>
> Regards,
>
> Frédéric Jouault
>
>
> Erik Becker wrote:
>> Hi all,
>>
>> for my transformation I need to create a model element that references
>> some elements that contain only text, e. g.:
>> <packageHeader>
>> <xpdlVersion>2.0</xpdlVersion>
>> ..
>> </packageHeader>
>>
>> I want to do this by called rule because there's no matching element
>> in my source model.
>> For the creation I wrote the following rule:
>>
>> rule CreatePackageHeader() {
>> to
>> packageHeader : XPDL!PackageHeader(
>> xpdlVersion <- '2.0',
>> ...
>> )
>> }
>>
>> if I call the rule in the binding section of a matched rule to bind
>> the 'packageHeader' to a reference I get an error:
>>
>> A.main() : ??#26 null
>> local variables = {self=aml2xpdl : ASMModule}
>> local stack = []
>> A.__exec__() : ??#8 null
>> local variables = {self=aml2xpdl : ASMModule, e=TransientLink
>> {rule = 'CreatePackage', sourceElements = {root = IN!AML},
>> targetElements = {package = OUT!PackageName}, variables = {}}}
>> local stack = []
>> A.__applyCreatePackage(1 : NTransientLink;) : ??#30 17:42-17:74
>> local variables = {package=OUT!PackageName, root=IN!AML,
>> self=aml2xpdl : ASMModule, link=TransientLink {rule = 'CreatePackage',
>> sourceElements = {root = IN!AML}, targetElements = {package =
>> OUT!PackageName}, variables = {}}}
>> local stack = [OUT!PackageName, OUT!PackageName, aml2xpdl :
>> ASMModule]
>> A.CreatePackageHeader() : ??#13 24:25-24:50
>> local variables = {self=aml2xpdl : ASMModule,
>> packageHeader=OUT!<unnamed>}
>> local stack = [OUT!<unnamed>]
>> ****** END Stack Trace
>> Execution terminated due to error (see launch configuration to allow
>> continuation after errors).
>>
>> Because I'm (at the moment) not very familiar with ATL I don't
>> understand what the failure. Can anyone help?
>>
>> Greetings
>>
>> Erik
Re: [ATL] How to create a new model element that contains a text. [message #43145 is a reply to message #43106] Wed, 30 May 2007 15:32 Go to previous messageGo to next message
Ã?ric Vépa is currently offline Ã?ric VépaFriend
Messages: 16
Registered: July 2009
Junior Member
Hi Erik,

What Fred' is trying to say, is that you may have a rule which generates
a XPDL!Package. In the XPDL metamodel from the Zoo, the packageHeader is
mandatory. So the XPDL!PackageHeader must be created at the same time
(especially if you have no matching input model element to create it).

With this, you can avoid using non-declarative rules. :-)

Erik Becker wrote:
> Hi Frédéric,
>
> my target model is not XML it's XPDL. I use the XPDL meta model from the
> altlantic zoo, which I extended because it doesn't cover the full XPDL.
>
> I know how to create a text node in model instances of XML meta model
> but isn't there a possibility to have in arbitrary model elements?
> I would like to have in my XPDL model something like listed below.
>
> Greets
>
> Erik
>
>
> Frédéric Jouault schrieb:
>> Hi Erik,
>>
>> You cut the stack trace after the error message, this may be why you
>> do not understand it ;-).
>>
>> Your problem does not seem to be with ATL, but with the XML metamodel
>> (or with XML in general, since this metamodel is very close to the XML
>> DOM).
>>
>> To have text nodes, you need to create a Text element, which value is
>> the text you want to have.
>>
>>
>> On another matter: I am very surprised that you need to use a called
>> rule. I can understand that there is no matching element for
>> packageHeader, but there is probably a matching element for "package"?
>> Then you could create the packageHeader, xpdlVersion, and Text node as
>> additional elements of the rule matching "package" ;-).
>
> Should I create the 'packageHeader' in the 'do' section of this rule?
> Is there a disadvantage in using a called rule?
>
>>
>>
>> Regards,
>>
>> Frédéric Jouault
>>
>>
>> Erik Becker wrote:
>>> Hi all,
>>>
>>> for my transformation I need to create a model element that
>>> references some elements that contain only text, e. g.:
>>> <packageHeader>
>>> <xpdlVersion>2.0</xpdlVersion>
>>> ..
>>> </packageHeader>
>>>
>>> I want to do this by called rule because there's no matching element
>>> in my source model.
>>> For the creation I wrote the following rule:
>>>
>>> rule CreatePackageHeader() {
>>> to
>>> packageHeader : XPDL!PackageHeader(
>>> xpdlVersion <- '2.0',
>>> ...
>>> )
>>> }
>>>
>>> if I call the rule in the binding section of a matched rule to bind
>>> the 'packageHeader' to a reference I get an error:
>>>
>>> A.main() : ??#26 null
>>> local variables = {self=aml2xpdl : ASMModule}
>>> local stack = []
>>> A.__exec__() : ??#8 null
>>> local variables = {self=aml2xpdl : ASMModule, e=TransientLink
>>> {rule = 'CreatePackage', sourceElements = {root = IN!AML},
>>> targetElements = {package = OUT!PackageName}, variables = {}}}
>>> local stack = []
>>> A.__applyCreatePackage(1 : NTransientLink;) : ??#30 17:42-17:74
>>> local variables = {package=OUT!PackageName, root=IN!AML,
>>> self=aml2xpdl : ASMModule, link=TransientLink {rule =
>>> 'CreatePackage', sourceElements = {root = IN!AML}, targetElements =
>>> {package = OUT!PackageName}, variables = {}}}
>>> local stack = [OUT!PackageName, OUT!PackageName, aml2xpdl :
>>> ASMModule]
>>> A.CreatePackageHeader() : ??#13 24:25-24:50
>>> local variables = {self=aml2xpdl : ASMModule,
>>> packageHeader=OUT!<unnamed>}
>>> local stack = [OUT!<unnamed>]
>>> ****** END Stack Trace
>>> Execution terminated due to error (see launch configuration to allow
>>> continuation after errors).
>>>
>>> Because I'm (at the moment) not very familiar with ATL I don't
>>> understand what the failure. Can anyone help?
>>>
>>> Greetings
>>>
>>> Erik


--
Éric Vépa

SODIUS
6, rue de la Cornouaille - BP 91941
44319 Nantes, France
Email: evepa@sodius.com

www.mdworkbench.com
Draw more value from your models
Re: [ATL] How to create a new model element that contains a text. [message #43158 is a reply to message #43145] Wed, 30 May 2007 18:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: erik_becker.gmx.de

Hi Erik,

thanks for your reply. You're right the packageHeader is mandatory and
could be created with the package.
Unfortunately this doesn't solve my problems:
- Where (in my rule) to create the packageHeader?
- How to create an packageHeader that contains elements containg text?

As you might have read in my other postings I try to transform a model
encoded in XML-based language called AML (a export from a BPM tool) to a
XPDL process model. So both, source and target model, are encoded in XML.

I hoped to be able to transform these both models with ATL by simply
specifying the both meta models and developing a transformation from my
source model (AML) to my target model (XPDL).

Unfortunately it seems to be much more difficult as I thought. As far as
I understood to I need to produce 3 transformations to solve my problem:
1) A Transformation from XML to my AML meta model that transforms the
exported and injected (to XML meta model) XML model to an instance of my
ATL-understandable instance of my AML meta model.
2) A Transformation that transforms instances of the AML meta model to
instances of the XPDL meta model.
3) A Transformation to transform instances of the XPDL meta model to
appropriate instances of the XML meta model to extract the wanted XML
encoding the XPDL document.

That's much more complicated than I've expected!
At the moment the easiest solution to my problem seems to use XSLT
Transformation instead of ATL or to use ATL for transforming the AML to
XPDL by developing a transformation from AML as XML meta model instance
to XPDL as instance of the XML metamodel. :-(

Regards

Erik

Éric Vépa schrieb:
> Hi Erik,
>
> What Fred' is trying to say, is that you may have a rule which generates
> a XPDL!Package. In the XPDL metamodel from the Zoo, the packageHeader is
> mandatory. So the XPDL!PackageHeader must be created at the same time
> (especially if you have no matching input model element to create it).
>
> With this, you can avoid using non-declarative rules. :-)
>
> Erik Becker wrote:
>> Hi Frédéric,
>>
>> my target model is not XML it's XPDL. I use the XPDL meta model from
>> the altlantic zoo, which I extended because it doesn't cover the full
>> XPDL.
>>
>> I know how to create a text node in model instances of XML meta model
>> but isn't there a possibility to have in arbitrary model elements?
>> I would like to have in my XPDL model something like listed below.
>>
>> Greets
>>
>> Erik
>>
>>
>> Frédéric Jouault schrieb:
>>> Hi Erik,
>>>
>>> You cut the stack trace after the error message, this may be why you
>>> do not understand it ;-).
>>>
>>> Your problem does not seem to be with ATL, but with the XML metamodel
>>> (or with XML in general, since this metamodel is very close to the
>>> XML DOM).
>>>
>>> To have text nodes, you need to create a Text element, which value is
>>> the text you want to have.
>>>
>>>
>>> On another matter: I am very surprised that you need to use a called
>>> rule. I can understand that there is no matching element for
>>> packageHeader, but there is probably a matching element for
>>> "package"? Then you could create the packageHeader, xpdlVersion, and
>>> Text node as additional elements of the rule matching "package" ;-).
>>
>> Should I create the 'packageHeader' in the 'do' section of this rule?
>> Is there a disadvantage in using a called rule?
>>
>>>
>>>
>>> Regards,
>>>
>>> Frédéric Jouault
>>>
>>>
>>> Erik Becker wrote:
>>>> Hi all,
>>>>
>>>> for my transformation I need to create a model element that
>>>> references some elements that contain only text, e. g.:
>>>> <packageHeader>
>>>> <xpdlVersion>2.0</xpdlVersion>
>>>> ..
>>>> </packageHeader>
>>>>
>>>> I want to do this by called rule because there's no matching element
>>>> in my source model.
>>>> For the creation I wrote the following rule:
>>>>
>>>> rule CreatePackageHeader() {
>>>> to
>>>> packageHeader : XPDL!PackageHeader(
>>>> xpdlVersion <- '2.0',
>>>> ...
>>>> )
>>>> }
>>>>
>>>> if I call the rule in the binding section of a matched rule to bind
>>>> the 'packageHeader' to a reference I get an error:
>>>>
>>>> A.main() : ??#26 null
>>>> local variables = {self=aml2xpdl : ASMModule}
>>>> local stack = []
>>>> A.__exec__() : ??#8 null
>>>> local variables = {self=aml2xpdl : ASMModule, e=TransientLink
>>>> {rule = 'CreatePackage', sourceElements = {root = IN!AML},
>>>> targetElements = {package = OUT!PackageName}, variables = {}}}
>>>> local stack = []
>>>> A.__applyCreatePackage(1 : NTransientLink;) : ??#30 17:42-17:74
>>>> local variables = {package=OUT!PackageName, root=IN!AML,
>>>> self=aml2xpdl : ASMModule, link=TransientLink {rule =
>>>> 'CreatePackage', sourceElements = {root = IN!AML}, targetElements =
>>>> {package = OUT!PackageName}, variables = {}}}
>>>> local stack = [OUT!PackageName, OUT!PackageName, aml2xpdl :
>>>> ASMModule]
>>>> A.CreatePackageHeader() : ??#13 24:25-24:50
>>>> local variables = {self=aml2xpdl : ASMModule,
>>>> packageHeader=OUT!<unnamed>}
>>>> local stack = [OUT!<unnamed>]
>>>> ****** END Stack Trace
>>>> Execution terminated due to error (see launch configuration to allow
>>>> continuation after errors).
>>>>
>>>> Because I'm (at the moment) not very familiar with ATL I don't
>>>> understand what the failure. Can anyone help?
>>>>
>>>> Greetings
>>>>
>>>> Erik
>
>
Re: [ATL] How to create a new model element that contains a text. [message #43169 is a reply to message #43158] Wed, 30 May 2007 19:38 Go to previous message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hello Erik,

> thanks for your reply. You're right the packageHeader is mandatory and
> could be created with the package.
> Unfortunately this doesn't solve my problems:
> - Where (in my rule) to create the packageHeader?

You should create it as an additional target element (target elements
are separated by comas).

> - How to create an packageHeader that contains elements containg text?

This depends on your metamodel.

However, because you are not using an XML metamodel, you are probably
not going to create "an element containing text". This is a concrete
syntax issue, that should, for instance, be dealt with in the XPDL2XML
transformation.

You simply need to find out where the information you want to specify is
in the metamodel, without taking care about the concrete syntax.

It is also possible that the metamodel you are using does not already
have an attribute to specify this, in which case you may need to extend it.


In any case, the metamodel should look like this:

class Package {
reference header container : PackageHeader;
}

class PackageHeader {
attribute version : String;
}

then, the target pattern of your rule would look like:

to
t : XPDL!Package (
header <- h
),
h : XPDL!PackageHeader (
version <- '2.0'
)

This separation between Package and PackageHeader may even be considered
as purely syntactical, in which case the metamodel may look like:

class Package {
attribute version : String;
}


and the target pattern like:

to
t : XPDL!Package (
version <- '2.0'
)


Because we are not dealing with syntactical issues in the core
transformation, it is quite simple and concise.


> As you might have read in my other postings I try to transform a model
> encoded in XML-based language called AML (a export from a BPM tool) to a
> XPDL process model. So both, source and target model, are encoded in XML.
>
> I hoped to be able to transform these both models with ATL by simply
> specifying the both meta models and developing a transformation from my
> source model (AML) to my target model (XPDL).

Yes, you can do this transformation, but then you should *not* think
about the XML-related issues (e.g., elements, text nodes) in the core
transformation, only in the XML2AML and XPDL2XML transformations.


> Unfortunately it seems to be much more difficult as I thought. As far as
> I understood to I need to produce 3 transformations to solve my problem:
> 1) A Transformation from XML to my AML meta model that transforms the
> exported and injected (to XML meta model) XML model to an instance of my
> ATL-understandable instance of my AML meta model.
> 2) A Transformation that transforms instances of the AML meta model to
> instances of the XPDL meta model.
> 3) A Transformation to transform instances of the XPDL meta model to
> appropriate instances of the XML meta model to extract the wanted XML
> encoding the XPDL document.
>
> That's much more complicated than I've expected!
> At the moment the easiest solution to my problem seems to use XSLT
> Transformation instead of ATL or to use ATL for transforming the AML to
> XPDL by developing a transformation from AML as XML meta model instance
> to XPDL as instance of the XML metamodel. :-(

XML2Something and Something2XML transformations are usually very simple,
although they sometimes require many rules. Because they are so simple,
it should be possible to automate their creation in the future.

Once these syntactic transformations have been written, the core
transformation is much simpler, and concise.


Regards,

Frédéric Jouault
Previous Topic:[ATL] Getting the text of a xml element
Next Topic:[ATL] An internal error occurred during: "Launching".
Goto Forum:
  


Current Time: Fri Mar 29 05:55:12 GMT 2024

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

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

Back to the top