Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » GMT (Generative Modeling Technologies) » Re: [TCS] Examples that convert .tcs file to model
Re: [TCS] Examples that convert .tcs file to model [message #375967] Thu, 22 February 2007 17:34 Go to next message
Freddy Allilaire is currently offline Freddy AllilaireFriend
Messages: 130
Registered: July 2009
Senior Member
Hi Paul,

Paul Gribben a écrit :
> Hi, sorry if I've used the wrong group for this question.

Maybe this question would be better asked on the GMT newsgroup, which
I've added to the "to" list.

>
> I'm looking for any working example that converts a source .tcs file
> into a TCS conformant model file.

I have added an example here:
http://www.eclipse.org/gmt/am3/tcs/download/TCSInjector.zip
Also reachable from here: http://wiki.eclipse.org/index.php/TCS

I'd also be interested to know whether
> TCS is good choice for converting from models to concrete text (I won't
> need to go from text to model), or should I use another approach?
>

Yes, TCS provides you a bridge between models and concrete text (text to
model and model to text).

Hope this help ;-)

Regards,
Freddy.

--
Freddy Allilaire - ATLAS Group (INRIA & LINA)
http://www.sciences.univ-nantes.fr/lina/atl/contrib/allilair e
Re: [TCS] Examples that convert .tcs file to model [message #375968 is a reply to message #375967] Fri, 23 February 2007 07:56 Go to previous messageGo to next message
Paul Gribben is currently offline Paul GribbenFriend
Messages: 28
Registered: July 2009
Junior Member
Great - that's just what I was looking for. Thanks.
Re: [TCS] Examples that convert .tcs file to model [message #375973 is a reply to message #375967] Fri, 23 February 2007 10:05 Go to previous messageGo to next message
Paul Gribben is currently offline Paul GribbenFriend
Messages: 28
Registered: July 2009
Junior Member
Thanks for this sample Freddy, it works fine.

I've extended my project copy by defining a metamodel for the AddressBook
by handcrafting an AddressBook.km3 (reverse-engineered from the
AddressBook.tcs, is there a more clever way to produce the metamodel?).
I've then successfully extracted a model file (AddressBook1.ecore) to a
text file (AddressBook1.out) using the ant task am3.saveModel (with
extractor embedded element).

I then tried to transform the text file back to a model file using the
am3.loadModel with injector approach, but without success as follows:

<target name="text2model" depends="loadModels">
<am3.loadModel modelHandler="EMF" name="M" metamodel="AddressBook.tcs"
path="${path}output/AddressBook1.out">
<injector name="ebnf">
<param name="name" value="TCS"/>
<classpath>
<pathelement location="${path}TCS/TCS-importer.jar" />
</classpath>
</injector>
</am3.loadModel>

<am3.saveModel model="M"
path="${path}output/GeneratedAddressBook1.ecore"/>
</target>

... where metamodel AddressBook.tcs is defined to be the
AddressBook.tcs.ecore file.

When I execute this I get:
text2model:
[am3.loadModel] Loading of model M
[am3.loadModel] no type named 'ConcreteSyntax' in metamodel
'AddressBook.tcs'
[am3.loadModel] java.lang.NullPointerException
[am3.loadModel] at
org.atl.engine.repositories.emf4atl.ASMEMFModel.newModelElem ent(ASMEMFModel.java:206)
[am3.loadModel] at
org.atl.engine.vm.nativelib.ASMModel.newModelElement(ASMMode l.java:74)
[am3.loadModel] at
org.atl.engine.vm.nativelib.ASMModel.newModelElement(ASMMode l.java:62)
(stack continues...)

I've examined the AddressBook.tcs.ecore and it does contain the
ConcreteSyntax type, so I'm a bit confused.

Again, any help would be greatly appreciated.

Thanks
Paul
Re: [TCS] Examples that convert .tcs file to model [message #375981 is a reply to message #375973] Fri, 23 February 2007 14:14 Go to previous messageGo to next message
Hugo Bruneliere is currently offline Hugo BruneliereFriend
Messages: 674
Registered: July 2009
Senior Member
Hi Paul,

Paul Gribben a écrit :
> Thanks for this sample Freddy, it works fine.
>
> I've extended my project copy by defining a metamodel for the
> AddressBook by handcrafting an AddressBook.km3 (reverse-engineered from
> the AddressBook.tcs, is there a more clever way to produce the
> metamodel?). I've then successfully extracted a model file

You could define your metamodel directly in KM3 (which is a Domain
Specific Language or DSL for defining metamodels) and then automatically
transform it into other formats such as Ecore for example.

> (AddressBook1.ecore) to a text file (AddressBook1.out) using the ant
> task am3.saveModel (with extractor embedded element).
>
> I then tried to transform the text file back to a model file using the
> am3.loadModel with injector approach, but without success as follows:
>
> <target name="text2model" depends="loadModels">
> <am3.loadModel modelHandler="EMF" name="M" metamodel="AddressBook.tcs"
> path="${path}output/AddressBook1.out">
> <injector name="ebnf">
> <param name="name" value="TCS"/>
> <classpath>
> <pathelement location="${path}TCS/TCS-importer.jar" />
> </classpath>
> </injector>
> </am3.loadModel>

I think the error comes from the value of the "metamodel" parameter of
the am3.loadModel task. For instance, it may be metamodel="AddressBook"
if you already have loaded the AddressBook metamodel like this:
<am3.loadModel modelHandler="EMF" name="AddressBook" metamodel="MOF"
path="AddressBook.ecore" />

Regards,

Hugo

>
> <am3.saveModel model="M"
> path="${path}output/GeneratedAddressBook1.ecore"/>
> </target>
>
> .. where metamodel AddressBook.tcs is defined to be the
> AddressBook.tcs.ecore file.
>
> When I execute this I get:
> text2model:
> [am3.loadModel] Loading of model M
> [am3.loadModel] no type named 'ConcreteSyntax' in metamodel
> 'AddressBook.tcs'
> [am3.loadModel] java.lang.NullPointerException
> [am3.loadModel] at
> org.atl.engine.repositories.emf4atl.ASMEMFModel.newModelElem ent(ASMEMFModel.java:206)
>
> [am3.loadModel] at
> org.atl.engine.vm.nativelib.ASMModel.newModelElement(ASMMode l.java:74)
> [am3.loadModel] at
> org.atl.engine.vm.nativelib.ASMModel.newModelElement(ASMMode l.java:62)
> (stack continues...)
>
> I've examined the AddressBook.tcs.ecore and it does contain the
> ConcreteSyntax type, so I'm a bit confused.
>
> Again, any help would be greatly appreciated.
>
> Thanks
> Paul
>


--
--------------------------------------------------------
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/
--------------------------------------------------------


--------------------------------------------------------
Hugo Bruneliere, PhD
NaoMod team (IMT Atlantique & LS2N-CNRS)
Nantes - France
--------------------------------------------------------
Re: [TCS] Examples that convert .tcs file to model [message #375983 is a reply to message #375981] Fri, 23 February 2007 15:49 Go to previous messageGo to next message
Paul Gribben is currently offline Paul GribbenFriend
Messages: 28
Registered: July 2009
Junior Member
Hugo,

Thanks for your reply. Unfortunately changing the metamodel as you
suggested has resulted in the same type of error (no type named
'ConcreteSyntax' in metamodel 'AddressBook').
I suspect the injector is expecting to find the TCS metamodel. If that's
the case then I wonder how I can load a text file using my metamodel.

Paul
Re: [TCS] Examples that convert .tcs file to model [message #375991 is a reply to message #375973] Mon, 26 February 2007 22:11 Go to previous message
Freddy Allilaire is currently offline Freddy AllilaireFriend
Messages: 130
Registered: July 2009
Senior Member
Hi Paul,

Paul Gribben a écrit :
> Thanks for this sample Freddy, it works fine.
>
> I've extended my project copy by defining a metamodel for the
> AddressBook by handcrafting an AddressBook.km3 (reverse-engineered from
> the AddressBook.tcs, is there a more clever way to produce the
> metamodel?).

The normal process is to create first your metamodel ;-)

> I've then successfully extracted a model file
> (AddressBook1.ecore) to a text file (AddressBook1.out) using the ant
> task am3.saveModel (with extractor embedded element).
>
> I then tried to transform the text file back to a model file using the
> am3.loadModel with injector approach, but without success as follows:
>
> <target name="text2model" depends="loadModels">
> <am3.loadModel modelHandler="EMF" name="M" metamodel="AddressBook.tcs"
> path="${path}output/AddressBook1.out">
> <injector name="ebnf">
> <param name="name" value="TCS"/>
> <classpath>
> <pathelement location="${path}TCS/TCS-importer.jar" />
> </classpath>
> </injector>
> </am3.loadModel>
>
> <am3.saveModel model="M"
> path="${path}output/GeneratedAddressBook1.ecore"/>
> </target>
>
> .. where metamodel AddressBook.tcs is defined to be the
> AddressBook.tcs.ecore file.
>

In this case (text to model), you will need to generate and to use a
"specific" AddressBook injector (i.e. AddressBook-importer.jar).

I have created a complete TCS use case for AddressBook available here:
http://www.eclipse.org/gmt/am3/tcs/download/TCSSample.zip

And I have also started a tutorial:
http://wiki.eclipse.org/index.php/TCS/TCS_Toolkit_Tutorial

For the moment, this wiki page is only a stub. But I hope this can help
you :-)

Regards,
Freddy.


> When I execute this I get:
> text2model:
> [am3.loadModel] Loading of model M
> [am3.loadModel] no type named 'ConcreteSyntax' in metamodel
> 'AddressBook.tcs'
> [am3.loadModel] java.lang.NullPointerException
> [am3.loadModel] at
> org.atl.engine.repositories.emf4atl.ASMEMFModel.newModelElem ent(ASMEMFModel.java:206)
>
> [am3.loadModel] at
> org.atl.engine.vm.nativelib.ASMModel.newModelElement(ASMMode l.java:74)
> [am3.loadModel] at
> org.atl.engine.vm.nativelib.ASMModel.newModelElement(ASMMode l.java:62)
> (stack continues...)
>
> I've examined the AddressBook.tcs.ecore and it does contain the
> ConcreteSyntax type, so I'm a bit confused.
>
> Again, any help would be greatly appreciated.
>
> Thanks
> Paul
>
Re: [TCS] Examples that convert .tcs file to model [message #571593 is a reply to message #375967] Fri, 23 February 2007 07:56 Go to previous message
Paul Gribben is currently offline Paul GribbenFriend
Messages: 28
Registered: July 2009
Junior Member
Great - that's just what I was looking for. Thanks.
Re: [TCS] Examples that convert .tcs file to model [message #571690 is a reply to message #375967] Fri, 23 February 2007 10:05 Go to previous message
Paul Gribben is currently offline Paul GribbenFriend
Messages: 28
Registered: July 2009
Junior Member
Thanks for this sample Freddy, it works fine.

I've extended my project copy by defining a metamodel for the AddressBook
by handcrafting an AddressBook.km3 (reverse-engineered from the
AddressBook.tcs, is there a more clever way to produce the metamodel?).
I've then successfully extracted a model file (AddressBook1.ecore) to a
text file (AddressBook1.out) using the ant task am3.saveModel (with
extractor embedded element).

I then tried to transform the text file back to a model file using the
am3.loadModel with injector approach, but without success as follows:

<target name="text2model" depends="loadModels">
<am3.loadModel modelHandler="EMF" name="M" metamodel="AddressBook.tcs"
path="${path}output/AddressBook1.out">
<injector name="ebnf">
<param name="name" value="TCS"/>
<classpath>
<pathelement location="${path}TCS/TCS-importer.jar" />
</classpath>
</injector>
</am3.loadModel>

<am3.saveModel model="M"
path="${path}output/GeneratedAddressBook1.ecore"/>
</target>

... where metamodel AddressBook.tcs is defined to be the
AddressBook.tcs.ecore file.

When I execute this I get:
text2model:
[am3.loadModel] Loading of model M
[am3.loadModel] no type named 'ConcreteSyntax' in metamodel
'AddressBook.tcs'
[am3.loadModel] java.lang.NullPointerException
[am3.loadModel] at
org.atl.engine.repositories.emf4atl.ASMEMFModel.newModelElem ent(ASMEMFModel.java:206)
[am3.loadModel] at
org.atl.engine.vm.nativelib.ASMModel.newModelElement(ASMMode l.java:74)
[am3.loadModel] at
org.atl.engine.vm.nativelib.ASMModel.newModelElement(ASMMode l.java:62)
(stack continues...)

I've examined the AddressBook.tcs.ecore and it does contain the
ConcreteSyntax type, so I'm a bit confused.

Again, any help would be greatly appreciated.

Thanks
Paul
Re: [TCS] Examples that convert .tcs file to model [message #571777 is a reply to message #375973] Fri, 23 February 2007 14:14 Go to previous message
Hugo Bruneliere is currently offline Hugo BruneliereFriend
Messages: 674
Registered: July 2009
Senior Member
Hi Paul,

Paul Gribben a écrit :
> Thanks for this sample Freddy, it works fine.
>
> I've extended my project copy by defining a metamodel for the
> AddressBook by handcrafting an AddressBook.km3 (reverse-engineered from
> the AddressBook.tcs, is there a more clever way to produce the
> metamodel?). I've then successfully extracted a model file

You could define your metamodel directly in KM3 (which is a Domain
Specific Language or DSL for defining metamodels) and then automatically
transform it into other formats such as Ecore for example.

> (AddressBook1.ecore) to a text file (AddressBook1.out) using the ant
> task am3.saveModel (with extractor embedded element).
>
> I then tried to transform the text file back to a model file using the
> am3.loadModel with injector approach, but without success as follows:
>
> <target name="text2model" depends="loadModels">
> <am3.loadModel modelHandler="EMF" name="M" metamodel="AddressBook.tcs"
> path="${path}output/AddressBook1.out">
> <injector name="ebnf">
> <param name="name" value="TCS"/>
> <classpath>
> <pathelement location="${path}TCS/TCS-importer.jar" />
> </classpath>
> </injector>
> </am3.loadModel>

I think the error comes from the value of the "metamodel" parameter of
the am3.loadModel task. For instance, it may be metamodel="AddressBook"
if you already have loaded the AddressBook metamodel like this:
<am3.loadModel modelHandler="EMF" name="AddressBook" metamodel="MOF"
path="AddressBook.ecore" />

Regards,

Hugo

>
> <am3.saveModel model="M"
> path="${path}output/GeneratedAddressBook1.ecore"/>
> </target>
>
> .. where metamodel AddressBook.tcs is defined to be the
> AddressBook.tcs.ecore file.
>
> When I execute this I get:
> text2model:
> [am3.loadModel] Loading of model M
> [am3.loadModel] no type named 'ConcreteSyntax' in metamodel
> 'AddressBook.tcs'
> [am3.loadModel] java.lang.NullPointerException
> [am3.loadModel] at
> org.atl.engine.repositories.emf4atl.ASMEMFModel.newModelElem ent(ASMEMFModel.java:206)
>
> [am3.loadModel] at
> org.atl.engine.vm.nativelib.ASMModel.newModelElement(ASMMode l.java:74)
> [am3.loadModel] at
> org.atl.engine.vm.nativelib.ASMModel.newModelElement(ASMMode l.java:62)
> (stack continues...)
>
> I've examined the AddressBook.tcs.ecore and it does contain the
> ConcreteSyntax type, so I'm a bit confused.
>
> Again, any help would be greatly appreciated.
>
> Thanks
> Paul
>


--
--------------------------------------------------------
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/
--------------------------------------------------------


--------------------------------------------------------
Hugo Bruneliere, PhD
NaoMod team (IMT Atlantique & LS2N-CNRS)
Nantes - France
--------------------------------------------------------
Re: [TCS] Examples that convert .tcs file to model [message #571812 is a reply to message #375981] Fri, 23 February 2007 15:49 Go to previous message
Paul Gribben is currently offline Paul GribbenFriend
Messages: 28
Registered: July 2009
Junior Member
Hugo,

Thanks for your reply. Unfortunately changing the metamodel as you
suggested has resulted in the same type of error (no type named
'ConcreteSyntax' in metamodel 'AddressBook').
I suspect the injector is expecting to find the TCS metamodel. If that's
the case then I wonder how I can load a text file using my metamodel.

Paul
Re: [TCS] Examples that convert .tcs file to model [message #571952 is a reply to message #375973] Mon, 26 February 2007 22:11 Go to previous message
Freddy Allilaire is currently offline Freddy AllilaireFriend
Messages: 130
Registered: July 2009
Senior Member
Hi Paul,

Paul Gribben a écrit :
> Thanks for this sample Freddy, it works fine.
>
> I've extended my project copy by defining a metamodel for the
> AddressBook by handcrafting an AddressBook.km3 (reverse-engineered from
> the AddressBook.tcs, is there a more clever way to produce the
> metamodel?).

The normal process is to create first your metamodel ;-)

> I've then successfully extracted a model file
> (AddressBook1.ecore) to a text file (AddressBook1.out) using the ant
> task am3.saveModel (with extractor embedded element).
>
> I then tried to transform the text file back to a model file using the
> am3.loadModel with injector approach, but without success as follows:
>
> <target name="text2model" depends="loadModels">
> <am3.loadModel modelHandler="EMF" name="M" metamodel="AddressBook.tcs"
> path="${path}output/AddressBook1.out">
> <injector name="ebnf">
> <param name="name" value="TCS"/>
> <classpath>
> <pathelement location="${path}TCS/TCS-importer.jar" />
> </classpath>
> </injector>
> </am3.loadModel>
>
> <am3.saveModel model="M"
> path="${path}output/GeneratedAddressBook1.ecore"/>
> </target>
>
> .. where metamodel AddressBook.tcs is defined to be the
> AddressBook.tcs.ecore file.
>

In this case (text to model), you will need to generate and to use a
"specific" AddressBook injector (i.e. AddressBook-importer.jar).

I have created a complete TCS use case for AddressBook available here:
http://www.eclipse.org/gmt/am3/tcs/download/TCSSample.zip

And I have also started a tutorial:
http://wiki.eclipse.org/index.php/TCS/TCS_Toolkit_Tutorial

For the moment, this wiki page is only a stub. But I hope this can help
you :-)

Regards,
Freddy.


> When I execute this I get:
> text2model:
> [am3.loadModel] Loading of model M
> [am3.loadModel] no type named 'ConcreteSyntax' in metamodel
> 'AddressBook.tcs'
> [am3.loadModel] java.lang.NullPointerException
> [am3.loadModel] at
> org.atl.engine.repositories.emf4atl.ASMEMFModel.newModelElem ent(ASMEMFModel.java:206)
>
> [am3.loadModel] at
> org.atl.engine.vm.nativelib.ASMModel.newModelElement(ASMMode l.java:74)
> [am3.loadModel] at
> org.atl.engine.vm.nativelib.ASMModel.newModelElement(ASMMode l.java:62)
> (stack continues...)
>
> I've examined the AddressBook.tcs.ecore and it does contain the
> ConcreteSyntax type, so I'm a bit confused.
>
> Again, any help would be greatly appreciated.
>
> Thanks
> Paul
>
Previous Topic:[GEMS] Re: Interoperability?
Next Topic:[GEMS] Re: Interoperability?
Goto Forum:
  


Current Time: Wed Apr 24 16:46:50 GMT 2024

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

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

Back to the top