Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMT (Generative Modeling Technologies) » [MOFScript] Multiple nsURIs in metamodel breaks things?
[MOFScript] Multiple nsURIs in metamodel breaks things? [message #606577] Mon, 13 August 2007 13:41
Eclipse User
Originally posted by: matt.mcgill.gmail.com

Hello all,

I've been looking at MOFScript for only about an hour now, so pardon me
if I'm missing something obvious.

I'm hoping to write a MOFScript spec to generate some code from a UML
1.4 model created in ArgoUML. ArgoUML (as I'm sure you know) serializes
its models to XMI by way of MDR. Happily, I found that the Acceleo
Eclipse plugin has provided an Ecore implementation of UML 1.4 and a
converter to take MDR-based UML 1.4 to EMF-based UML 1.4 models.

Unfortunately, I ran into trouble straight-away when trying to generate
code from a converted model using MOFScript. When I try to compile the
following MOFScript:

texttransformation ExampleTransformation (in
uml:"http://www.obeo.fr/acceleo/uml14") {

uml.Class::main () {
'testing...'
}
}

I receive the following output from the compiler:
## Compiling 'broken2.m2t' (Using repository path:
plugins/org.sintef.mofscript.editor_1.2.4/repository\metamod els)
## Parsing 'broken2.m2t'
## Finished Compiling.
## No errors
Error: MTTParseError: Undefined type for metamodel ( uml ): Class, line:
0, column: 0

This is despite having Class show up via code completion. Here's a
second transformation that might help shine further light:

texttransformation ExampleTransformation (in
uml:"http://www.obeo.fr/acceleo/uml14") {

uml.Model::main() {
self.ownedElement->forEach(c:uml.ModelElement) {
'model element: ' c.name
newline(1)
}
self.ownedElement->forEach(c) {
'untyped'
newline(1)
}
}

}

This compiles without error, and produces the following output when
executed on a trivial input model with one Class and three DataTypes
nested directly under the root Model element (no packages, in other words):

untyped
untyped
untyped
untyped

Clearly something is amiss. My best guess is this: in the Ecore version
of the UML 1.4 metamodel supplied by Acceleo, different nsURIs are
supplied for the various subpackages that contain all of the UML
elements. ModelElement, for example, is in the subpackage 'core' with
nsURI "http://www.obeo.fr/acceleo/uml14/core". In fact, the *only* UML
element defined in the Ecore metamodel is Model. For whatever reason,
part of the MOFScript code (the part that handles autocomplete in the
editor, for example) is OK with multiple nsURIs, and part of it (the
important part) is not.

I haven't started code-spelunking yet, but that's the next step. Could
one of the devs/users perhaps provide an explanation and/or simple
work-around, and save me the trouble of digging through the source myself?

Thanks,
-Matt McGill
Previous Topic:[Mofscript] The context http://www.eclipse.org/uml2/2.0.0/UML is not found ...
Next Topic:[MOFScript] Multiple nsURIs in metamodel breaks things?
Goto Forum:
  


Current Time: Wed Aug 20 03:07:48 EDT 2014

Powered by FUDForum. Page generated in 0.01567 seconds