Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [MOFScript] Problem with metamodel setting in Java integration
[MOFScript] Problem with metamodel setting in Java integration [message #47048] Mon, 16 June 2008 21:56 Go to next message
Anderson Ledo is currently offline Anderson LedoFriend
Messages: 13
Registered: July 2009
Junior Member
Hi,

I'm defining some textual tranformations for models based on the
JavaAbstractSyntax metamodel. It works fine! However, when I try to
integrate my MOFScript transformation in a Java environment, using the
example given in the MOFScript User Guide v0.6, it doesn't work.

The following line
**int errorCount = ParserUtil.getModelChecker().getErrorCount();**
returns 85 erros. They are all concerning the lack of a metamodel
definition.

I see that the exemple in the User Guide doesn't present a means of
setting the metamodel before calling
**execMgr.executeTransformation();**
So, the errors are expected.

Although I've searched a lot, I have not found any way of setting the
metamodel, any kind of MOFScript API and any other kind of ducumentation.

Has anyone had the same problem? May someone help me?

Best regards!

---
The output I get from my Java program is this:
Parsing result: 85 errors
: Error: MTTParseError: Illegal/unknown context: jast, line: 484,
column: 0
: Error: MTTParseError: Can't find feature 'interface' for type
'TypeDeclaration'., line: 28, column: 5
: Error: MTTParseError: Type not found: 'FieldDeclaration' in metamodel
'null', line: 0, column: 0
: Error: MTTParseError: Can't find feature 'bodyDeclarations' for type
'TypeDeclaration'., line: 31, column: 2
: Error: MTTParseError: Type not found: 'MethodDeclaration' in
metamodel 'null', line: 0, column: 0
.
.
.
.
---
jast is a reference to the metamodel.


Anderson Ledo
Campina Grande, Brazil
Re: [MOFScript] Problem with metamodel setting in Java integration [message #47108 is a reply to message #47048] Thu, 19 June 2008 11:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: catiux.gmail.com

Hi,

I think I have hust had the same problem, what I think you should do, is
to register the metamodel you are using.

It would be something like the following:

File metamodel = new File("the metamodel location");
ResourceSet rsSource = new ResourceSetImpl();
rsSource.getResourceFactoryRegistry().getExtensionToFactoryM ap().put( "*",
new XMIResourceFactoryImpl());
Resource resSource =
rsSource.getResource(URI.createFileURI(metamodel.getAbsolute Path()), true);
EPackage paquete = (EPackage) resSource.getContents().get(0);
EPackage.Registry.INSTANCE.put("Uri of the metamodel", paquete);

Good Luck!
Re: [MOFScript] Problem with metamodel setting in Java integration [message #47138 is a reply to message #47048] Thu, 19 June 2008 12:47 Go to previous messageGo to next message
Paul Elder is currently offline Paul ElderFriend
Messages: 849
Registered: July 2009
Senior Member
Anderson:

I'm cross posting this to eclipse.modeling.gmt. This is the home of
MOFScript
"Anderson Ledo" <anderson.ledo@gmail.com> wrote in message
news:165401cdc2f9ca2d9dcacc024e0d6cfe$1@www.eclipse.org...
> Hi,
>
> I'm defining some textual tranformations for models based on the
> JavaAbstractSyntax metamodel. It works fine! However, when I try to
> integrate my MOFScript transformation in a Java environment, using the
> example given in the MOFScript User Guide v0.6, it doesn't work.
>
> The following line
> **int errorCount = ParserUtil.getModelChecker().getErrorCount();**
> returns 85 erros. They are all concerning the lack of a metamodel
> definition.
>
> I see that the exemple in the User Guide doesn't present a means of
> setting the metamodel before calling **execMgr.executeTransformation();**
> So, the errors are expected.
>
> Although I've searched a lot, I have not found any way of setting the
> metamodel, any kind of MOFScript API and any other kind of ducumentation.
>
> Has anyone had the same problem? May someone help me?
>
> Best regards!
>
> ---
> The output I get from my Java program is this:
> Parsing result: 85 errors
> : Error: MTTParseError: Illegal/unknown context: jast, line: 484, column:
> 0
> : Error: MTTParseError: Can't find feature 'interface' for type
> 'TypeDeclaration'., line: 28, column: 5
> : Error: MTTParseError: Type not found: 'FieldDeclaration' in metamodel
> 'null', line: 0, column: 0
> : Error: MTTParseError: Can't find feature 'bodyDeclarations' for type
> 'TypeDeclaration'., line: 31, column: 2
> : Error: MTTParseError: Type not found: 'MethodDeclaration' in metamodel
> 'null', line: 0, column: 0
> .
> .
> .
> .
> ---
> jast is a reference to the metamodel.
>
Re: [MOFScript] Problem with metamodel setting in Java integration [message #47967 is a reply to message #47108] Thu, 17 July 2008 17:40 Go to previous message
Anderson Ledo is currently offline Anderson LedoFriend
Messages: 13
Registered: July 2009
Junior Member
Very thanks !
It worked !


Anderson Ledo
Campina Grande, Brazil
Previous Topic:iteration over an iterable object not a select
Next Topic:XML extraction problem
Goto Forum:
  


Current Time: Fri Dec 19 01:30:28 GMT 2014

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

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