Home » Archived » GMT (Generative Modeling Technologies) » [MOFScript] executing transformation
[MOFScript] executing transformation [message #376943] |
Thu, 03 May 2007 07:00  |
Eclipse User |
|
|
|
I'm trying to generate text from a model based on the
SQLDDL metamodel (from the AM3 Atlantic zoo). I have
an ecore version of the SQLDDL.km3 file and have put
this into a directory that I have set as the repository
directory in the MOFScript preferences. When a compile
my MOFScript, this is found and the script compiles
without errors.
When I attempt to execute the script I get the following error
Resource error: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package
with uri 'SQLDDL' not found. (file:/C:/andy/mdsd/Domain2Persistence/xxx.xmi,
2, 133)
I've produced the genmodel for the ecore model and generated
the model code for this (in its own plugin). However, the above
error persists.
It appears that the problem may be associated with the execution
classpath, but I can't see how to set the MOFScript execution
classpath.
Any ideas?
thanks Andy.
--
-- ------------------------------------------------------------ -------------
Dr Andy Carpenter
School of Computer Science,
University of Manchester, Manchester M13 9PL, UK
Email: Andy.Carpenter@manchester.ac.uk
Tel: +44 161 275 6168
Fax: +44 161 275 6280
|
|
|
Re: [MOFScript][TCS] executing transformation [message #376944 is a reply to message #376943] |
Thu, 03 May 2007 09:26   |
Eclipse User |
|
|
|
Hello,
Are you using MOFSCRIPT to generate actual SQL DDL code from your SQLDDL
model?
If so, you may simply use the SQLDDL TCS projector available from the
following AMW use case:
http://www.eclipse.org/gmt/amw/usecases/modelgen/
and more precisely in file:
http://www.eclipse.org/gmt/amw/examples/AMW_KM32SQL/AMW_KM32 SQL.zip
There is a usage example in the /AMW_KM32SQL/scripts/executeAll.xml ant
script contained in the AMW_KM32SQL.zip file. The extraction code is
located below the line:
<echo message="Preparing SQL extraction.."/>
This solution already works, and can do: program-to-model and
model-to-program :-).
Regards,
Frédéric Jouault
Andy Carpenter wrote:
> I'm trying to generate text from a model based on the
> SQLDDL metamodel (from the AM3 Atlantic zoo). I have
> an ecore version of the SQLDDL.km3 file and have put
> this into a directory that I have set as the repository
> directory in the MOFScript preferences. When a compile
> my MOFScript, this is found and the script compiles
> without errors.
>
> When I attempt to execute the script I get the following error
>
> Resource error: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package
> with uri 'SQLDDL' not found. (file:/C:/andy/mdsd/Domain2Persistence/xxx.xmi,
> 2, 133)
>
> I've produced the genmodel for the ecore model and generated
> the model code for this (in its own plugin). However, the above
> error persists.
>
> It appears that the problem may be associated with the execution
> classpath, but I can't see how to set the MOFScript execution
> classpath.
>
> Any ideas?
>
> thanks Andy.
|
|
| |
Re: [MOFScript][TCS] executing transformation [message #377461 is a reply to message #376949] |
Thu, 03 May 2007 13:33   |
Eclipse User |
|
|
|
Hello,
Because "SQL DDL model" to "SQL DDL code" is already implemented in TCS,
it makes sense to reuse it if this is your objective.
However, using TCS will probably not help you evaluating MOFScript :-).
Although MOFScript (a model-to-text tool) and TCS (a projector between
Model Engineering and Grammarware) are quite different tools, they may
both be used for the "SQL DDL model" to "SQL DDL code" scenario.
It would therefore be interesting for us to have a look at your
MOFScript implementation, which would provide a basis for comparing both
approaches, in the case when they can both be used for the same purpose :-).
Regards,
Frédéric Jouault
Andy Carpenter wrote:
> Thanks for the response, generating SQL DDL from an SQLDDL
> model was part of what I wanted to do and I'll have a look at the AMW
> use case that you mention.
>
> The other part of want I was doing was evaluating a pim -> psm -> text
> flow and was assessing the use of a MOFScript on the output of an ATL
> transformation. By using a modified version of the KM32EMF transformation
> that supported metadata on KM3!DataType and annotating nsPrefix, nsURI and
> instanceClassNames into the sqlddl.km3 file I had managed to generate an
> sqlddl.ecore for which an implementation could be generated. However, as
> mentioned earlier, I have failed to use this to allow an sqlddl model to be
> transformed by a MOFScript.
>
> regards
> Andy.
>
>
>
> "Frédéric Jouault" <frederic.jouault@univ-nantes.fr> wrote in message
> news:f1cnut$4mq$1@build.eclipse.org...
>> Hello,
>>
>> Are you using MOFSCRIPT to generate actual SQL DDL code from your SQLDDL
>> model?
>>
>> If so, you may simply use the SQLDDL TCS projector available from the
>> following AMW use case:
>> http://www.eclipse.org/gmt/amw/usecases/modelgen/
>> and more precisely in file:
>> http://www.eclipse.org/gmt/amw/examples/AMW_KM32SQL/AMW_KM32 SQL.zip
>>
>> There is a usage example in the /AMW_KM32SQL/scripts/executeAll.xml ant
>> script contained in the AMW_KM32SQL.zip file. The extraction code is
>> located below the line:
>> <echo message="Preparing SQL extraction.."/>
>>
>>
>> This solution already works, and can do: program-to-model and
>> model-to-program :-).
>>
>>
>> Regards,
>>
>> Frédéric Jouault
>>
>>
>> Andy Carpenter wrote:
>>> I'm trying to generate text from a model based on the
>>> SQLDDL metamodel (from the AM3 Atlantic zoo). I have
>>> an ecore version of the SQLDDL.km3 file and have put
>>> this into a directory that I have set as the repository
>>> directory in the MOFScript preferences. When a compile
>>> my MOFScript, this is found and the script compiles
>>> without errors.
>>>
>>> When I attempt to execute the script I get the following error
>>>
>>> Resource error: org.eclipse.emf.ecore.xmi.PackageNotFoundException:
>>> Package with uri 'SQLDDL' not found.
>>> (file:/C:/andy/mdsd/Domain2Persistence/xxx.xmi, 2, 133)
>>>
>>> I've produced the genmodel for the ecore model and generated
>>> the model code for this (in its own plugin). However, the above
>>> error persists.
>>>
>>> It appears that the problem may be associated with the execution
>>> classpath, but I can't see how to set the MOFScript execution
>>> classpath.
>>>
>>> Any ideas?
>>>
>>> thanks Andy.
>
>
|
|
| | | |
Re: [MOFScript][TCS] executing transformation [message #377708 is a reply to message #377497] |
Tue, 15 May 2007 02:03  |
Eclipse User |
|
|
|
Hello,
> I've attached my MOFScript for producing SQL DDL code from
> an SQL DDL model. As the mapping is mainly one-to-one there is
> nothing very noteworthy in this code. The caveat is that I've not
> applied it to many test cases, so it may contain mistakes.
Ok. Thank you very much, this is very interesting. I wrote my comment
below, after the TCS excerpt.
> I've attempted to have a look at the KM32SQL projects that you
> mentioned. However, as the downloads for these appear to only contain
> the technical space transformations and not the TCS definitions, I've
> not been able to examine them for the functionality that I've been
> trying to achieve.
The TCS definition is in file AMW_KM32SQL/scripts/SQLDDL-TCS.ecore of
the zip archive, and is an injected version of SQLDDL.tcs. You can of
course extract it using the TCS tools.
Here is an excerpt from SQLDDL.tcs (to save you the extraction ;-)):
template Database main context
: tables
;
template Table context addToContext
: "CREATE" "TABLE" name "(" [
elements{separator = ","}
] ")" parameters ";"
;
-- @begin Table Elements
template TableElement abstract;
template Column addToContext
: name type
(canBeNull ? : "NOT" "NULL")
(isDefined(default) ? "default" default{as =
stringSymbol})
;
template Key abstract;
template SimpleKey
: (isUnique ? "UNIQUE")
"KEY" (isDefined(name) ? name) "("
columns{refersTo = name, separator = ","} ")"
;
template PrimaryKey
: "PRIMARY" (isUnique ? "UNIQUE")
"KEY" (isDefined(name) ? name) "("
columns{refersTo = name, separator = ","} ")"
;
template ForeignKey
: "FOREIGN" (isUnique ? "UNIQUE")
"KEY" (isDefined(name) ? name) "("
columns{refersTo = name, separator = ","} ")"
"REFERENCES" referencedTable{refersTo = name}
"(" referencedColumns{separator = ",", refersTo = name,
lookIn = referencedTable} ")"
;
-- @end Table Elements
template Type
: name (isDefined(length) ? "(" length{separator
= ","} ")") (isUnsigned ? "unsigned")
;
template Parameter
: name (isDefined(value) ? "=" value)
;
-- @begin Values
template Value abstract;
template IntegerVal
: value
;
template NullVal
: "NULL"
;
template StringVal
: value{as = stringSymbol}
;
-- @end Values
Note that this excerpt is actually the only part of the code that you
really have to write, the rest being primitive type templates (reused
as-is in most TCS files) and the lexer (only required for injection, and
reused as-is in most TCS files as well).
Here is my analysis of the comparison between the two approaches
(anyone, feel free to comment):
The TCS definition is bidirectional (i.e., SQL code to model, *and* SQL
model to code), is comparatively more concise than your MOFScript
solution (mostly because iteration is implicit in TCS), and handles
indentation and symbols spacing automatically.
If there were operators in the language, TCS would even automatically
handle parenthesizing based on operator priorities.
I must admit that I am not at all surprised by this result, because TCS
is especially tuned for DSLs (like SQL DDL).
Conversely, solutions like MOFScript are especially relevant when there
is a large gap between the metamodel and the syntax (e.g., UML to Java).
You can indeed accommodate for this gap by using complex expressions
and/or statements, which are not available in TCS (to keep definitions
bidirectional!).
That being said, I believe that, in some cases, this gap issue can
probably be solved while using TCS by using an intermediate metamodel
(i.e., closer to the syntax), and model transformations between the
actual and intermediate metamodels. This seems to be a very interesting
research topic, which outcome would be especially helpful if we managed
to show that parts of this process can be automated ;-).
Best regards,
Frédéric Jouault
|
|
|
Re: [MOFScript][TCS] executing transformation [message #581714 is a reply to message #376943] |
Thu, 03 May 2007 09:26  |
Eclipse User |
|
|
|
Hello,
Are you using MOFSCRIPT to generate actual SQL DDL code from your SQLDDL
model?
If so, you may simply use the SQLDDL TCS projector available from the
following AMW use case:
http://www.eclipse.org/gmt/amw/usecases/modelgen/
and more precisely in file:
http://www.eclipse.org/gmt/amw/examples/AMW_KM32SQL/AMW_KM32 SQL.zip
There is a usage example in the /AMW_KM32SQL/scripts/executeAll.xml ant
script contained in the AMW_KM32SQL.zip file. The extraction code is
located below the line:
<echo message="Preparing SQL extraction.."/>
This solution already works, and can do: program-to-model and
model-to-program :-).
Regards,
Frédéric Jouault
Andy Carpenter wrote:
> I'm trying to generate text from a model based on the
> SQLDDL metamodel (from the AM3 Atlantic zoo). I have
> an ecore version of the SQLDDL.km3 file and have put
> this into a directory that I have set as the repository
> directory in the MOFScript preferences. When a compile
> my MOFScript, this is found and the script compiles
> without errors.
>
> When I attempt to execute the script I get the following error
>
> Resource error: org.eclipse.emf.ecore.xmi.PackageNotFoundException: Package
> with uri 'SQLDDL' not found. (file:/C:/andy/mdsd/Domain2Persistence/xxx.xmi,
> 2, 133)
>
> I've produced the genmodel for the ecore model and generated
> the model code for this (in its own plugin). However, the above
> error persists.
>
> It appears that the problem may be associated with the execution
> classpath, but I can't see how to set the MOFScript execution
> classpath.
>
> Any ideas?
>
> thanks Andy.
|
|
|
Re: [MOFScript][TCS] executing transformation [message #581799 is a reply to message #376944] |
Thu, 03 May 2007 12:02  |
Eclipse User |
|
|
|
Thanks for the response, generating SQL DDL from an SQLDDL
model was part of what I wanted to do and I'll have a look at the AMW
use case that you mention.
The other part of want I was doing was evaluating a pim -> psm -> text
flow and was assessing the use of a MOFScript on the output of an ATL
transformation. By using a modified version of the KM32EMF transformation
that supported metadata on KM3!DataType and annotating nsPrefix, nsURI and
instanceClassNames into the sqlddl.km3 file I had managed to generate an
sqlddl.ecore for which an implementation could be generated. However, as
mentioned earlier, I have failed to use this to allow an sqlddl model to be
transformed by a MOFScript.
regards
Andy.
"Fr
|
|
|
Re: [MOFScript][TCS] executing transformation [message #581820 is a reply to message #376949] |
Thu, 03 May 2007 13:33  |
Eclipse User |
|
|
|
Hello,
Because "SQL DDL model" to "SQL DDL code" is already implemented in TCS,
it makes sense to reuse it if this is your objective.
However, using TCS will probably not help you evaluating MOFScript :-).
Although MOFScript (a model-to-text tool) and TCS (a projector between
Model Engineering and Grammarware) are quite different tools, they may
both be used for the "SQL DDL model" to "SQL DDL code" scenario.
It would therefore be interesting for us to have a look at your
MOFScript implementation, which would provide a basis for comparing both
approaches, in the case when they can both be used for the same purpose :-).
Regards,
Frédéric Jouault
Andy Carpenter wrote:
> Thanks for the response, generating SQL DDL from an SQLDDL
> model was part of what I wanted to do and I'll have a look at the AMW
> use case that you mention.
>
> The other part of want I was doing was evaluating a pim -> psm -> text
> flow and was assessing the use of a MOFScript on the output of an ATL
> transformation. By using a modified version of the KM32EMF transformation
> that supported metadata on KM3!DataType and annotating nsPrefix, nsURI and
> instanceClassNames into the sqlddl.km3 file I had managed to generate an
> sqlddl.ecore for which an implementation could be generated. However, as
> mentioned earlier, I have failed to use this to allow an sqlddl model to be
> transformed by a MOFScript.
>
> regards
> Andy.
>
>
>
> "Frédéric Jouault" <frederic.jouault@univ-nantes.fr> wrote in message
> news:f1cnut$4mq$1@build.eclipse.org...
>> Hello,
>>
>> Are you using MOFSCRIPT to generate actual SQL DDL code from your SQLDDL
>> model?
>>
>> If so, you may simply use the SQLDDL TCS projector available from the
>> following AMW use case:
>> http://www.eclipse.org/gmt/amw/usecases/modelgen/
>> and more precisely in file:
>> http://www.eclipse.org/gmt/amw/examples/AMW_KM32SQL/AMW_KM32 SQL.zip
>>
>> There is a usage example in the /AMW_KM32SQL/scripts/executeAll.xml ant
>> script contained in the AMW_KM32SQL.zip file. The extraction code is
>> located below the line:
>> <echo message="Preparing SQL extraction.."/>
>>
>>
>> This solution already works, and can do: program-to-model and
>> model-to-program :-).
>>
>>
>> Regards,
>>
>> Frédéric Jouault
>>
>>
>> Andy Carpenter wrote:
>>> I'm trying to generate text from a model based on the
>>> SQLDDL metamodel (from the AM3 Atlantic zoo). I have
>>> an ecore version of the SQLDDL.km3 file and have put
>>> this into a directory that I have set as the repository
>>> directory in the MOFScript preferences. When a compile
>>> my MOFScript, this is found and the script compiles
>>> without errors.
>>>
>>> When I attempt to execute the script I get the following error
>>>
>>> Resource error: org.eclipse.emf.ecore.xmi.PackageNotFoundException:
>>> Package with uri 'SQLDDL' not found.
>>> (file:/C:/andy/mdsd/Domain2Persistence/xxx.xmi, 2, 133)
>>>
>>> I've produced the genmodel for the ecore model and generated
>>> the model code for this (in its own plugin). However, the above
>>> error persists.
>>>
>>> It appears that the problem may be associated with the execution
>>> classpath, but I can't see how to set the MOFScript execution
>>> classpath.
>>>
>>> Any ideas?
>>>
>>> thanks Andy.
>
>
|
|
| | | |
Re: [MOFScript][TCS] executing transformation [message #596815 is a reply to message #377497] |
Tue, 15 May 2007 02:03  |
Eclipse User |
|
|
|
Hello,
> I've attached my MOFScript for producing SQL DDL code from
> an SQL DDL model. As the mapping is mainly one-to-one there is
> nothing very noteworthy in this code. The caveat is that I've not
> applied it to many test cases, so it may contain mistakes.
Ok. Thank you very much, this is very interesting. I wrote my comment
below, after the TCS excerpt.
> I've attempted to have a look at the KM32SQL projects that you
> mentioned. However, as the downloads for these appear to only contain
> the technical space transformations and not the TCS definitions, I've
> not been able to examine them for the functionality that I've been
> trying to achieve.
The TCS definition is in file AMW_KM32SQL/scripts/SQLDDL-TCS.ecore of
the zip archive, and is an injected version of SQLDDL.tcs. You can of
course extract it using the TCS tools.
Here is an excerpt from SQLDDL.tcs (to save you the extraction ;-)):
template Database main context
: tables
;
template Table context addToContext
: "CREATE" "TABLE" name "(" [
elements{separator = ","}
] ")" parameters ";"
;
-- @begin Table Elements
template TableElement abstract;
template Column addToContext
: name type
(canBeNull ? : "NOT" "NULL")
(isDefined(default) ? "default" default{as =
stringSymbol})
;
template Key abstract;
template SimpleKey
: (isUnique ? "UNIQUE")
"KEY" (isDefined(name) ? name) "("
columns{refersTo = name, separator = ","} ")"
;
template PrimaryKey
: "PRIMARY" (isUnique ? "UNIQUE")
"KEY" (isDefined(name) ? name) "("
columns{refersTo = name, separator = ","} ")"
;
template ForeignKey
: "FOREIGN" (isUnique ? "UNIQUE")
"KEY" (isDefined(name) ? name) "("
columns{refersTo = name, separator = ","} ")"
"REFERENCES" referencedTable{refersTo = name}
"(" referencedColumns{separator = ",", refersTo = name,
lookIn = referencedTable} ")"
;
-- @end Table Elements
template Type
: name (isDefined(length) ? "(" length{separator
= ","} ")") (isUnsigned ? "unsigned")
;
template Parameter
: name (isDefined(value) ? "=" value)
;
-- @begin Values
template Value abstract;
template IntegerVal
: value
;
template NullVal
: "NULL"
;
template StringVal
: value{as = stringSymbol}
;
-- @end Values
Note that this excerpt is actually the only part of the code that you
really have to write, the rest being primitive type templates (reused
as-is in most TCS files) and the lexer (only required for injection, and
reused as-is in most TCS files as well).
Here is my analysis of the comparison between the two approaches
(anyone, feel free to comment):
The TCS definition is bidirectional (i.e., SQL code to model, *and* SQL
model to code), is comparatively more concise than your MOFScript
solution (mostly because iteration is implicit in TCS), and handles
indentation and symbols spacing automatically.
If there were operators in the language, TCS would even automatically
handle parenthesizing based on operator priorities.
I must admit that I am not at all surprised by this result, because TCS
is especially tuned for DSLs (like SQL DDL).
Conversely, solutions like MOFScript are especially relevant when there
is a large gap between the metamodel and the syntax (e.g., UML to Java).
You can indeed accommodate for this gap by using complex expressions
and/or statements, which are not available in TCS (to keep definitions
bidirectional!).
That being said, I believe that, in some cases, this gap issue can
probably be solved while using TCS by using an intermediate metamodel
(i.e., closer to the syntax), and model transformations between the
actual and intermediate metamodels. This seems to be a very interesting
research topic, which outcome would be especially helpful if we managed
to show that parts of this process can be automated ;-).
Best regards,
Frédéric Jouault
|
|
|
Goto Forum:
Current Time: Sun Apr 20 10:16:31 EDT 2025
Powered by FUDForum. Page generated in 0.04237 seconds
|