Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » Questions about XSD transformation
Questions about XSD transformation [message #72057] Fri, 13 April 2007 10:33 Go to next message
Eclipse UserFriend
Originally posted by: gabriel.goic.apec.fr

Hi all

Discovering the possibilities of model transformation, I want to add
some platform independency to my Java applications, and thus I want to
ask some simple questions, please find them numbered below.

One of these applications is a simple Web Services-based one, which
converts XML flow inputs to XML flow outputs. I think both can be
considered as models, as they reference their own metamodel : some XSD
files referencing XMLSchema.xsd for the input, some XML files
referencing a custom DTD file for the output.

1) XMLSchema.xsd being an ontology (defines itself) referenced by
metamodels, is it a metametamodel? if yes, how is it related to MOF? I
thought MOF was the only metametamodel but I may be wrong

At the time being, I use Sun's JAXWS & JAXB 2.1 to get the XSD
metamodels converted to Java classes, and then I am able to write
transformation rules programatically to get the input flow (as a Java
object) translated into an output as a Java object.
So, willing to untie business value (i.e these transformation rules)
from technology-specific aspects, I came to the idea of writing the
rules with a tool like ATL (to get a transformation model that would be
the real value of the organization), and then use some code generator to
make it executable on a Java platform.
But I found very few (if any) examples of working with XSD files and
putting the transformation rules at runtime execution inside a JVM

2) Does this kind of mechanism correspond to what is called "model2text"
transformation ?

3) Can this approach be called MDE (Model-driven engineering) ? or is
the name only dedicated to transforming PIM (platform-independent
models) into PSM (platform-specific models), for example starting from
UML and refining it until you get some code ?

4) What could be the quickest way to get things done, in terms of tools
to write transformation rules and generate Java code from it, possibly
without having to rewrite the entire XSD structure in a proprietary
format (like KM3 for ATL) ?

Many thanks for your answers
Gabriel
Re: Questions about XSD transformation [message #72077 is a reply to message #72057] Fri, 13 April 2007 10:55 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: merks.ca.ibm.com

This is a multi-part message in MIME format.
--------------080102020409010209050009
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Gabriel,

Comments below.


Gabriel G. wrote:
> Hi all
>
> Discovering the possibilities of model transformation, I want to add
> some platform independency to my Java applications, and thus I want to
> ask some simple questions, please find them numbered below.
>
> One of these applications is a simple Web Services-based one, which
> converts XML flow inputs to XML flow outputs. I think both can be
> considered as models, as they reference their own metamodel : some XSD
> files referencing XMLSchema.xsd for the input, some XML files
> referencing a custom DTD file for the output.
>
> 1) XMLSchema.xsd being an ontology (defines itself) referenced by
> metamodels, is it a metametamodel? if yes, how is it related to MOF? I
> thought MOF was the only metametamodel but I may be wrong
I think it's a metametamodel, because a .xml file could have a
particular .xsd as its metamodel, and that .xsd has the XMLSchema.xsd
(the XML Schema for Schemas) as its metamodel, so I suppose that makes
the XMLSchema.xsd a metametamodel. Of course the .xml file itself could
be the Ecore.ecore file, which is itself the metametamodel for all
..ecore files, which is in turn are metamodels for .xml files; in this
case the XMLSchema.xsd would a metametametametamodel. Because all this
is relative, i.e., the model of a model is a model, I will often make
the statement, a model is a model is a model, because one person's
metametamodel, will be another person's instance data. Any model that
describes other models and is capable of describing itself will have an
instance that's the self describing model, i.e., XMLSchema.xsd and
Ecore.ecore. I think MOF relates to these in a similar way to how
French and English are related.
>
> At the time being, I use Sun's JAXWS & JAXB 2.1 to get the XSD
> metamodels converted to Java classes, and then I am able to write
> transformation rules programatically to get the input flow (as a Java
> object) translated into an output as a Java object.
> So, willing to untie business value (i.e these transformation rules)
> from technology-specific aspects, I came to the idea of writing the
> rules with a tool like ATL (to get a transformation model that would
> be the real value of the organization), and then use some code
> generator to make it executable on a Java platform.
> But I found very few (if any) examples of working with XSD files and
> putting the transformation rules at runtime execution inside a JVM
One of the problems I've heard is that the XSD model is not
serializeable as XMI (it serializes using the well-defined and specified
syntax of .xsd files) and some of the transformation tools rely on the
XMI representation itself for doing transformation.
>
> 2) Does this kind of mechanism correspond to what is called
> "model2text" transformation ?
It sounds more like model to model transformation. The model2text stuff
is usually more template driven producing a text file (which could well
be the syntactic representation of something that can be parsed into a
structured model, making the distinction more subtle).
>
> 3) Can this approach be called MDE (Model-driven engineering) ? or is
> the name only dedicated to transforming PIM (platform-independent
> models) into PSM (platform-specific models), for example starting from
> UML and refining it until you get some code ?
Yes, I would certainly call it model-driven engineering. I don't think
anyone trademarked that term. :-)
>
> 4) What could be the quickest way to get things done, in terms of
> tools to write transformation rules and generate Java code from it,
> possibly without having to rewrite the entire XSD structure in a
> proprietary format (like KM3 for ATL) ?
That's a good question. I can't comment so much on the best way to
expression transformations. Certainly I've worked on things like
XSDEcoreBuilder which converts XML Schema to Ecore and
SchemaEcoreBuilder which converts Ecore back to XML Schema (with the
design goal being that Ecore -> XSD -> Ecore should be a round trip; XSD
-> Ecore -> XSD is somewhat lossy). You might be interested in this
article.

http://www.theserverside.com/tt/articles/article.tss?l=Bindi ngXMLJava

Since Ecore can be transformed (via model to text templates) to Java,
the XSD -> Java is supported via XSD -> Ecore -> Java. And since the
Ecore model can be used to read and write conforming instance of the
original XSD, this is a useful way of turning any of your data into a
structured model that's amenable to transformation and then such
transformations could be more focused on the abstract syntactic
structure specified by Ecore as opposed to the low level concrete
syntactic structure specified by XML Schema.
>
> Many thanks for your answers
> Gabriel


--------------080102020409010209050009
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Gabriel,<br>
<br>
Comments below.<br>
<br>
<br>
Gabriel G. wrote:
<blockquote cite="midevnmb0$jk3$1@build.eclipse.org" type="cite">Hi all
<br>
<br>
Discovering the possibilities of model transformation, I want to add
some platform independency to my Java applications, and thus I want to
ask some simple questions, please find them numbered below.
<br>
<br>
One of these applications is a simple Web Services-based one, which
converts XML flow inputs to XML flow outputs. I think both can be
considered as models, as they reference their own metamodel : some XSD
files referencing XMLSchema.xsd for the input, some XML files
referencing a custom DTD file for the output.
<br>
<br>
1) XMLSchema.xsd being an ontology (defines itself) referenced by
metamodels, is it a metametamodel? if yes, how is it related to MOF? I
thought MOF was the only metametamodel but I may be wrong
<br>
</blockquote>
I think it's a metametamodel, because a .xml file could have a
particular .xsd as its metamodel, and that .xsd has the XMLSchema.xsd
(the XML Schema for Schemas) as its metamodel, so I suppose that makes
the XMLSchema.xsd a metametamodel.&nbsp; Of course the .xml file itself
could be the Ecore.ecore file, which is itself the metametamodel for
all .ecore files, which is in turn are metamodels for .xml files; in
this case the XMLSchema.xsd would a metametametametamodel.&nbsp; Because all
this is relative, i.e., the model of a model is a model, I will often
make the statement, a model is a model is a model, because one person's
metametamodel, will be another person's instance data.&nbsp; Any model that
describes other models and is capable of describing itself will have an
instance that's the self describing model, i.e., XMLSchema.xsd and
Ecore.ecore.&nbsp; I think MOF relates to these in a similar way to how
French and English are related.<br>
<blockquote cite="midevnmb0$jk3$1@build.eclipse.org" type="cite"><br>
At the time being, I use Sun's JAXWS &amp; JAXB 2.1 to get the XSD
metamodels converted to Java classes, and then I am able to write
transformation rules programatically to get the input flow (as a Java
object) translated into an output as a Java object.
<br>
So, willing to untie business value (i.e these transformation rules)
from technology-specific aspects, I came to the idea of writing the
rules with a tool like ATL (to get a transformation model that would be
the real value of the organization), and then use some code generator
to make it executable on a Java platform.
<br>
But I found very few (if any) examples of working with XSD files and
putting the transformation rules at runtime execution inside a JVM
<br>
</blockquote>
One of the problems I've heard is that the XSD model is not
serializeable as XMI (it serializes using the well-defined and
specified syntax of .xsd files) and some of the transformation tools
rely on the XMI representation itself for doing transformation.<br>
<blockquote cite="midevnmb0$jk3$1@build.eclipse.org" type="cite"><br>
2) Does this kind of mechanism correspond to what is called
"model2text" transformation ?
<br>
</blockquote>
It sounds more like model to model transformation.&nbsp; The model2text
stuff is usually more template driven producing a text file (which
could well be the syntactic representation of something that can be
parsed into a structured model, making the distinction more subtle).<br>
<blockquote cite="midevnmb0$jk3$1@build.eclipse.org" type="cite"><br>
3) Can this approach be called MDE (Model-driven engineering) ? or is
the name only dedicated to transforming PIM (platform-independent
models) into PSM (platform-specific models), for example starting from
UML and refining it until you get some code ?
<br>
</blockquote>
Yes, I would certainly call it model-driven engineering.&nbsp; I don't think
anyone trademarked that term.&nbsp; :-)<br>
<blockquote cite="midevnmb0$jk3$1@build.eclipse.org" type="cite"><br>
4) What could be the quickest way to get things done, in terms of tools
to write transformation rules and generate Java code from it, possibly
without having to rewrite the entire XSD structure in a proprietary
format (like KM3 for ATL) ?
<br>
</blockquote>
That's a good question.&nbsp; I can't comment so much on the best way to
expression transformations.&nbsp; Certainly I've worked on things like
XSDEcoreBuilder which converts XML Schema to Ecore and
SchemaEcoreBuilder which converts Ecore back to XML Schema (with the
design goal being that Ecore -&gt; XSD -&gt; Ecore should be a round
trip; XSD -&gt; Ecore -&gt; XSD is somewhat lossy).&nbsp; You might be
interested in this article.<br>
<blockquote><a
href=" http://www.theserverside.com/tt/articles/article.tss?l=Bindi ngXMLJava"> http://www.theserverside.com/tt/articles/article.tss?l=Bindi ngXMLJava</a><br>
</blockquote>
Since Ecore can be transformed (via model to text templates) to Java,
the XSD -&gt; Java is supported via XSD -&gt; Ecore -&gt; Java.&nbsp; And
since the Ecore model can be used to read and write conforming instance
of the original XSD, this is a useful way of turning any of your data
into a structured model that's amenable to transformation and then such
transformations could be more focused on the abstract syntactic
structure specified by Ecore as opposed to the low level concrete
syntactic structure specified by XML Schema.<br>
<blockquote cite="midevnmb0$jk3$1@build.eclipse.org" type="cite"><br>
Many thanks for your answers
<br>
Gabriel
<br>
</blockquote>
<br>
</body>
</html>

--------------080102020409010209050009--
Re: Questions about XSD transformation [message #72093 is a reply to message #72077] Fri, 13 April 2007 11:47 Go to previous message
Eclipse UserFriend
Originally posted by: mikael.barbero.gmail.com

Hi guys,

See my comments below

Ed Merks wrote:
> Gabriel,
>
> Comments below.
>
>
> Gabriel G. wrote:
>> Hi all
>>
>> Discovering the possibilities of model transformation, I want to add
>> some platform independency to my Java applications, and thus I want to
>> ask some simple questions, please find them numbered below.
>>
>> One of these applications is a simple Web Services-based one, which
>> converts XML flow inputs to XML flow outputs. I think both can be
>> considered as models, as they reference their own metamodel : some XSD
>> files referencing XMLSchema.xsd for the input, some XML files
>> referencing a custom DTD file for the output.
>>
>> 1) XMLSchema.xsd being an ontology (defines itself) referenced by
>> metamodels, is it a metametamodel? if yes, how is it related to MOF? I
>> thought MOF was the only metametamodel but I may be wrong
> I think it's a metametamodel, because a .xml file could have a
> particular .xsd as its metamodel, and that .xsd has the XMLSchema.xsd
> (the XML Schema for Schemas) as its metamodel, so I suppose that makes
> the XMLSchema.xsd a metametamodel. Of course the .xml file itself could
> be the Ecore.ecore file, which is itself the metametamodel for all
> .ecore files, which is in turn are metamodels for .xml files; in this
> case the XMLSchema.xsd would a metametametametamodel. Because all this
> is relative, i.e., the model of a model is a model, I will often make
> the statement, a model is a model is a model, because one person's
> metametamodel, will be another person's instance data. Any model that
> describes other models and is capable of describing itself will have an
> instance that's the self describing model, i.e., XMLSchema.xsd and
> Ecore.ecore. I think MOF relates to these in a similar way to how
> French and English are related.

XMLSchema can certainly be considered as a metametamodel. Not to get
confused between XML and modeling stuff, we are trying to make a clear
distinction between technical spaces. I suggest you read this quite old
but good introduction position paper about technical spaces:
http://www.sciences.univ-nantes.fr/lina/atl/www/papers/Posit ionPaperKurtev.pdf

>>
>> At the time being, I use Sun's JAXWS & JAXB 2.1 to get the XSD
>> metamodels converted to Java classes, and then I am able to write
>> transformation rules programatically to get the input flow (as a Java
>> object) translated into an output as a Java object.
>> So, willing to untie business value (i.e these transformation rules)
>> from technology-specific aspects, I came to the idea of writing the
>> rules with a tool like ATL (to get a transformation model that would
>> be the real value of the organization), and then use some code
>> generator to make it executable on a Java platform.
>> But I found very few (if any) examples of working with XSD files and
>> putting the transformation rules at runtime execution inside a JVM
> One of the problems I've heard is that the XSD model is not
> serializeable as XMI (it serializes using the well-defined and specified
> syntax of .xsd files) and some of the transformation tools rely on the
> XMI representation itself for doing transformation.
>>
>> 2) Does this kind of mechanism correspond to what is called
>> "model2text" transformation ?
> It sounds more like model to model transformation. The model2text stuff
> is usually more template driven producing a text file (which could well
> be the syntactic representation of something that can be parsed into a
> structured model, making the distinction more subtle).

That's right there may be some issues with transforming models
conforming to metamodels generated from XSD. I don't know much about it.
Maybe someone that have already use this kind of transformation can help
you.

>>
>> 3) Can this approach be called MDE (Model-driven engineering) ? or is
>> the name only dedicated to transforming PIM (platform-independent
>> models) into PSM (platform-specific models), for example starting from
>> UML and refining it until you get some code ?
> Yes, I would certainly call it model-driven engineering. I don't think
> anyone trademarked that term. :-)

Totally agree !! And MDE is not trademarked but MDA(tm) is :)

>>
>> 4) What could be the quickest way to get things done, in terms of
>> tools to write transformation rules and generate Java code from it,
>> possibly without having to rewrite the entire XSD structure in a
>> proprietary format (like KM3 for ATL) ?
> That's a good question. I can't comment so much on the best way to
> expression transformations. Certainly I've worked on things like
> XSDEcoreBuilder which converts XML Schema to Ecore and
> SchemaEcoreBuilder which converts Ecore back to XML Schema (with the
> design goal being that Ecore -> XSD -> Ecore should be a round trip; XSD
> -> Ecore -> XSD is somewhat lossy). You might be interested in this
> article.
>
> http://www.theserverside.com/tt/articles/article.tss?l=Bindi ngXMLJava
>
> Since Ecore can be transformed (via model to text templates) to Java,
> the XSD -> Java is supported via XSD -> Ecore -> Java. And since the
> Ecore model can be used to read and write conforming instance of the
> original XSD, this is a useful way of turning any of your data into a
> structured model that's amenable to transformation and then such
> transformations could be more focused on the abstract syntactic
> structure specified by Ecore as opposed to the low level concrete
> syntactic structure specified by XML Schema.

As Ed said, XSD -> Ecore should be done very easily. Maybe you will have
to design your output metamodel by hand (the one from your DTD). The
transformation between those metamodels can now be designed with ATL
(taking the 2nd remark into account).
To get the output as an XML document conforming to your DTD, you may use
a metamodel to XML transformation and then our XML extractor as in this
example: http://www.eclipse.org/m2m/atl/atlTransformations/#KM32XML
Do not hesitate to ask question about those examples !

To sum up
================
You have this scenario:
- some XML documents (say {input-set.xml}) conforming to a XMLSchema
input.xsd as input
- you want to get XML documents (say {output-set.xml}) conforming to a
DTD output.dtd as output

You can do for inputs:
- Use EMF facilities to transform input.xsd to input.ecore
- Then you can load each document from {input-set.xml} with EMF
facilities and have models conforming to input.ecore
For your outputs:
- Define by hand your output.ecore metamodel (should be structurally
quite similar to output.dtd)
- Define an ATL transformation between output.ecore and the XML
metamodel (as in the KM32XML example). This transformation must produce
an XML structure conforming to the DTD
- Use the XML extractor to serialize a model from {output-set.xml}

Then:
- Define the ATL transformation between input.ecore and output.ecore.
(after having checked you can use the input.ecore from input.xsd with ATL)

>>
>> Many thanks for your answers
>> Gabriel
>


Best regards,
Mikael


PS: KM3 should help you to define your output.ecore metamodel, as it is
a very simple concrete syntax to define metamodel. It is not a
proprietary format and can be transformed into Ecore, MOF 1.4 etc..

--
Mikaël Barbero - PhD Candidate
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssinière
44322 Nantes Cedex 3 - France
tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00
email: Mikael.Barbero@{gmail.com, univ-nantes.fr}
http://www.sciences.univ-nantes.fr/lina/atl/
Re: Questions about XSD transformation [message #602293 is a reply to message #72057] Fri, 13 April 2007 10:55 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080102020409010209050009
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Gabriel,

Comments below.


Gabriel G. wrote:
> Hi all
>
> Discovering the possibilities of model transformation, I want to add
> some platform independency to my Java applications, and thus I want to
> ask some simple questions, please find them numbered below.
>
> One of these applications is a simple Web Services-based one, which
> converts XML flow inputs to XML flow outputs. I think both can be
> considered as models, as they reference their own metamodel : some XSD
> files referencing XMLSchema.xsd for the input, some XML files
> referencing a custom DTD file for the output.
>
> 1) XMLSchema.xsd being an ontology (defines itself) referenced by
> metamodels, is it a metametamodel? if yes, how is it related to MOF? I
> thought MOF was the only metametamodel but I may be wrong
I think it's a metametamodel, because a .xml file could have a
particular .xsd as its metamodel, and that .xsd has the XMLSchema.xsd
(the XML Schema for Schemas) as its metamodel, so I suppose that makes
the XMLSchema.xsd a metametamodel. Of course the .xml file itself could
be the Ecore.ecore file, which is itself the metametamodel for all
..ecore files, which is in turn are metamodels for .xml files; in this
case the XMLSchema.xsd would a metametametametamodel. Because all this
is relative, i.e., the model of a model is a model, I will often make
the statement, a model is a model is a model, because one person's
metametamodel, will be another person's instance data. Any model that
describes other models and is capable of describing itself will have an
instance that's the self describing model, i.e., XMLSchema.xsd and
Ecore.ecore. I think MOF relates to these in a similar way to how
French and English are related.
>
> At the time being, I use Sun's JAXWS & JAXB 2.1 to get the XSD
> metamodels converted to Java classes, and then I am able to write
> transformation rules programatically to get the input flow (as a Java
> object) translated into an output as a Java object.
> So, willing to untie business value (i.e these transformation rules)
> from technology-specific aspects, I came to the idea of writing the
> rules with a tool like ATL (to get a transformation model that would
> be the real value of the organization), and then use some code
> generator to make it executable on a Java platform.
> But I found very few (if any) examples of working with XSD files and
> putting the transformation rules at runtime execution inside a JVM
One of the problems I've heard is that the XSD model is not
serializeable as XMI (it serializes using the well-defined and specified
syntax of .xsd files) and some of the transformation tools rely on the
XMI representation itself for doing transformation.
>
> 2) Does this kind of mechanism correspond to what is called
> "model2text" transformation ?
It sounds more like model to model transformation. The model2text stuff
is usually more template driven producing a text file (which could well
be the syntactic representation of something that can be parsed into a
structured model, making the distinction more subtle).
>
> 3) Can this approach be called MDE (Model-driven engineering) ? or is
> the name only dedicated to transforming PIM (platform-independent
> models) into PSM (platform-specific models), for example starting from
> UML and refining it until you get some code ?
Yes, I would certainly call it model-driven engineering. I don't think
anyone trademarked that term. :-)
>
> 4) What could be the quickest way to get things done, in terms of
> tools to write transformation rules and generate Java code from it,
> possibly without having to rewrite the entire XSD structure in a
> proprietary format (like KM3 for ATL) ?
That's a good question. I can't comment so much on the best way to
expression transformations. Certainly I've worked on things like
XSDEcoreBuilder which converts XML Schema to Ecore and
SchemaEcoreBuilder which converts Ecore back to XML Schema (with the
design goal being that Ecore -> XSD -> Ecore should be a round trip; XSD
-> Ecore -> XSD is somewhat lossy). You might be interested in this
article.

http://www.theserverside.com/tt/articles/article.tss?l=Bindi ngXMLJava

Since Ecore can be transformed (via model to text templates) to Java,
the XSD -> Java is supported via XSD -> Ecore -> Java. And since the
Ecore model can be used to read and write conforming instance of the
original XSD, this is a useful way of turning any of your data into a
structured model that's amenable to transformation and then such
transformations could be more focused on the abstract syntactic
structure specified by Ecore as opposed to the low level concrete
syntactic structure specified by XML Schema.
>
> Many thanks for your answers
> Gabriel


--------------080102020409010209050009
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Gabriel,<br>
<br>
Comments below.<br>
<br>
<br>
Gabriel G. wrote:
<blockquote cite="midevnmb0$jk3$1@build.eclipse.org" type="cite">Hi all
<br>
<br>
Discovering the possibilities of model transformation, I want to add
some platform independency to my Java applications, and thus I want to
ask some simple questions, please find them numbered below.
<br>
<br>
One of these applications is a simple Web Services-based one, which
converts XML flow inputs to XML flow outputs. I think both can be
considered as models, as they reference their own metamodel : some XSD
files referencing XMLSchema.xsd for the input, some XML files
referencing a custom DTD file for the output.
<br>
<br>
1) XMLSchema.xsd being an ontology (defines itself) referenced by
metamodels, is it a metametamodel? if yes, how is it related to MOF? I
thought MOF was the only metametamodel but I may be wrong
<br>
</blockquote>
I think it's a metametamodel, because a .xml file could have a
particular .xsd as its metamodel, and that .xsd has the XMLSchema.xsd
(the XML Schema for Schemas) as its metamodel, so I suppose that makes
the XMLSchema.xsd a metametamodel.&nbsp; Of course the .xml file itself
could be the Ecore.ecore file, which is itself the metametamodel for
all .ecore files, which is in turn are metamodels for .xml files; in
this case the XMLSchema.xsd would a metametametametamodel.&nbsp; Because all
this is relative, i.e., the model of a model is a model, I will often
make the statement, a model is a model is a model, because one person's
metametamodel, will be another person's instance data.&nbsp; Any model that
describes other models and is capable of describing itself will have an
instance that's the self describing model, i.e., XMLSchema.xsd and
Ecore.ecore.&nbsp; I think MOF relates to these in a similar way to how
French and English are related.<br>
<blockquote cite="midevnmb0$jk3$1@build.eclipse.org" type="cite"><br>
At the time being, I use Sun's JAXWS &amp; JAXB 2.1 to get the XSD
metamodels converted to Java classes, and then I am able to write
transformation rules programatically to get the input flow (as a Java
object) translated into an output as a Java object.
<br>
So, willing to untie business value (i.e these transformation rules)
from technology-specific aspects, I came to the idea of writing the
rules with a tool like ATL (to get a transformation model that would be
the real value of the organization), and then use some code generator
to make it executable on a Java platform.
<br>
But I found very few (if any) examples of working with XSD files and
putting the transformation rules at runtime execution inside a JVM
<br>
</blockquote>
One of the problems I've heard is that the XSD model is not
serializeable as XMI (it serializes using the well-defined and
specified syntax of .xsd files) and some of the transformation tools
rely on the XMI representation itself for doing transformation.<br>
<blockquote cite="midevnmb0$jk3$1@build.eclipse.org" type="cite"><br>
2) Does this kind of mechanism correspond to what is called
"model2text" transformation ?
<br>
</blockquote>
It sounds more like model to model transformation.&nbsp; The model2text
stuff is usually more template driven producing a text file (which
could well be the syntactic representation of something that can be
parsed into a structured model, making the distinction more subtle).<br>
<blockquote cite="midevnmb0$jk3$1@build.eclipse.org" type="cite"><br>
3) Can this approach be called MDE (Model-driven engineering) ? or is
the name only dedicated to transforming PIM (platform-independent
models) into PSM (platform-specific models), for example starting from
UML and refining it until you get some code ?
<br>
</blockquote>
Yes, I would certainly call it model-driven engineering.&nbsp; I don't think
anyone trademarked that term.&nbsp; :-)<br>
<blockquote cite="midevnmb0$jk3$1@build.eclipse.org" type="cite"><br>
4) What could be the quickest way to get things done, in terms of tools
to write transformation rules and generate Java code from it, possibly
without having to rewrite the entire XSD structure in a proprietary
format (like KM3 for ATL) ?
<br>
</blockquote>
That's a good question.&nbsp; I can't comment so much on the best way to
expression transformations.&nbsp; Certainly I've worked on things like
XSDEcoreBuilder which converts XML Schema to Ecore and
SchemaEcoreBuilder which converts Ecore back to XML Schema (with the
design goal being that Ecore -&gt; XSD -&gt; Ecore should be a round
trip; XSD -&gt; Ecore -&gt; XSD is somewhat lossy).&nbsp; You might be
interested in this article.<br>
<blockquote><a
href=" http://www.theserverside.com/tt/articles/article.tss?l=Bindi ngXMLJava"> http://www.theserverside.com/tt/articles/article.tss?l=Bindi ngXMLJava</a><br>
</blockquote>
Since Ecore can be transformed (via model to text templates) to Java,
the XSD -&gt; Java is supported via XSD -&gt; Ecore -&gt; Java.&nbsp; And
since the Ecore model can be used to read and write conforming instance
of the original XSD, this is a useful way of turning any of your data
into a structured model that's amenable to transformation and then such
transformations could be more focused on the abstract syntactic
structure specified by Ecore as opposed to the low level concrete
syntactic structure specified by XML Schema.<br>
<blockquote cite="midevnmb0$jk3$1@build.eclipse.org" type="cite"><br>
Many thanks for your answers
<br>
Gabriel
<br>
</blockquote>
<br>
</body>
</html>

--------------080102020409010209050009--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Questions about XSD transformation [message #602299 is a reply to message #72077] Fri, 13 April 2007 11:47 Go to previous message
Eclipse UserFriend
Originally posted by: mikael.barbero.gmail.com

Hi guys,

See my comments below

Ed Merks wrote:
> Gabriel,
>
> Comments below.
>
>
> Gabriel G. wrote:
>> Hi all
>>
>> Discovering the possibilities of model transformation, I want to add
>> some platform independency to my Java applications, and thus I want to
>> ask some simple questions, please find them numbered below.
>>
>> One of these applications is a simple Web Services-based one, which
>> converts XML flow inputs to XML flow outputs. I think both can be
>> considered as models, as they reference their own metamodel : some XSD
>> files referencing XMLSchema.xsd for the input, some XML files
>> referencing a custom DTD file for the output.
>>
>> 1) XMLSchema.xsd being an ontology (defines itself) referenced by
>> metamodels, is it a metametamodel? if yes, how is it related to MOF? I
>> thought MOF was the only metametamodel but I may be wrong
> I think it's a metametamodel, because a .xml file could have a
> particular .xsd as its metamodel, and that .xsd has the XMLSchema.xsd
> (the XML Schema for Schemas) as its metamodel, so I suppose that makes
> the XMLSchema.xsd a metametamodel. Of course the .xml file itself could
> be the Ecore.ecore file, which is itself the metametamodel for all
> .ecore files, which is in turn are metamodels for .xml files; in this
> case the XMLSchema.xsd would a metametametametamodel. Because all this
> is relative, i.e., the model of a model is a model, I will often make
> the statement, a model is a model is a model, because one person's
> metametamodel, will be another person's instance data. Any model that
> describes other models and is capable of describing itself will have an
> instance that's the self describing model, i.e., XMLSchema.xsd and
> Ecore.ecore. I think MOF relates to these in a similar way to how
> French and English are related.

XMLSchema can certainly be considered as a metametamodel. Not to get
confused between XML and modeling stuff, we are trying to make a clear
distinction between technical spaces. I suggest you read this quite old
but good introduction position paper about technical spaces:
http://www.sciences.univ-nantes.fr/lina/atl/www/papers/Posit ionPaperKurtev.pdf

>>
>> At the time being, I use Sun's JAXWS & JAXB 2.1 to get the XSD
>> metamodels converted to Java classes, and then I am able to write
>> transformation rules programatically to get the input flow (as a Java
>> object) translated into an output as a Java object.
>> So, willing to untie business value (i.e these transformation rules)
>> from technology-specific aspects, I came to the idea of writing the
>> rules with a tool like ATL (to get a transformation model that would
>> be the real value of the organization), and then use some code
>> generator to make it executable on a Java platform.
>> But I found very few (if any) examples of working with XSD files and
>> putting the transformation rules at runtime execution inside a JVM
> One of the problems I've heard is that the XSD model is not
> serializeable as XMI (it serializes using the well-defined and specified
> syntax of .xsd files) and some of the transformation tools rely on the
> XMI representation itself for doing transformation.
>>
>> 2) Does this kind of mechanism correspond to what is called
>> "model2text" transformation ?
> It sounds more like model to model transformation. The model2text stuff
> is usually more template driven producing a text file (which could well
> be the syntactic representation of something that can be parsed into a
> structured model, making the distinction more subtle).

That's right there may be some issues with transforming models
conforming to metamodels generated from XSD. I don't know much about it.
Maybe someone that have already use this kind of transformation can help
you.

>>
>> 3) Can this approach be called MDE (Model-driven engineering) ? or is
>> the name only dedicated to transforming PIM (platform-independent
>> models) into PSM (platform-specific models), for example starting from
>> UML and refining it until you get some code ?
> Yes, I would certainly call it model-driven engineering. I don't think
> anyone trademarked that term. :-)

Totally agree !! And MDE is not trademarked but MDA(tm) is :)

>>
>> 4) What could be the quickest way to get things done, in terms of
>> tools to write transformation rules and generate Java code from it,
>> possibly without having to rewrite the entire XSD structure in a
>> proprietary format (like KM3 for ATL) ?
> That's a good question. I can't comment so much on the best way to
> expression transformations. Certainly I've worked on things like
> XSDEcoreBuilder which converts XML Schema to Ecore and
> SchemaEcoreBuilder which converts Ecore back to XML Schema (with the
> design goal being that Ecore -> XSD -> Ecore should be a round trip; XSD
> -> Ecore -> XSD is somewhat lossy). You might be interested in this
> article.
>
> http://www.theserverside.com/tt/articles/article.tss?l=Bindi ngXMLJava
>
> Since Ecore can be transformed (via model to text templates) to Java,
> the XSD -> Java is supported via XSD -> Ecore -> Java. And since the
> Ecore model can be used to read and write conforming instance of the
> original XSD, this is a useful way of turning any of your data into a
> structured model that's amenable to transformation and then such
> transformations could be more focused on the abstract syntactic
> structure specified by Ecore as opposed to the low level concrete
> syntactic structure specified by XML Schema.

As Ed said, XSD -> Ecore should be done very easily. Maybe you will have
to design your output metamodel by hand (the one from your DTD). The
transformation between those metamodels can now be designed with ATL
(taking the 2nd remark into account).
To get the output as an XML document conforming to your DTD, you may use
a metamodel to XML transformation and then our XML extractor as in this
example: http://www.eclipse.org/m2m/atl/atlTransformations/#KM32XML
Do not hesitate to ask question about those examples !

To sum up
================
You have this scenario:
- some XML documents (say {input-set.xml}) conforming to a XMLSchema
input.xsd as input
- you want to get XML documents (say {output-set.xml}) conforming to a
DTD output.dtd as output

You can do for inputs:
- Use EMF facilities to transform input.xsd to input.ecore
- Then you can load each document from {input-set.xml} with EMF
facilities and have models conforming to input.ecore
For your outputs:
- Define by hand your output.ecore metamodel (should be structurally
quite similar to output.dtd)
- Define an ATL transformation between output.ecore and the XML
metamodel (as in the KM32XML example). This transformation must produce
an XML structure conforming to the DTD
- Use the XML extractor to serialize a model from {output-set.xml}

Then:
- Define the ATL transformation between input.ecore and output.ecore.
(after having checked you can use the input.ecore from input.xsd with ATL)

>>
>> Many thanks for your answers
>> Gabriel
>


Best regards,
Mikael


PS: KM3 should help you to define your output.ecore metamodel, as it is
a very simple concrete syntax to define metamodel. It is not a
proprietary format and can be transformed into Ecore, MOF 1.4 etc..

--
Mikaël Barbero - PhD Candidate
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssinière
44322 Nantes Cedex 3 - France
tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00
email: Mikael.Barbero@{gmail.com, univ-nantes.fr}
http://www.sciences.univ-nantes.fr/lina/atl/
Previous Topic:Questions about XSD transformation
Next Topic:problems at pattern facet creation/validation
Goto Forum:
  


Current Time: Fri Mar 29 01:14:53 GMT 2024

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

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

Back to the top