Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Difference in Schema Location and Xpand
Difference in Schema Location and Xpand [message #638492] Thu, 11 November 2010 13:42 Go to next message
Tom Brandenburg is currently offline Tom BrandenburgFriend
Messages: 58
Registered: October 2010
Location: Abstatt, Germany
Today is my question day Smile

I have the following UML file and want to generate code out of it:

<?xml version="1.0" encoding="ISO-8859-1"?>
<uml:Model xmi:version="2.1" xmlns:xmi="" xmlns:uml="" xmi:id="themodel" name="UMLTest">
  <packagedElement xmi:type="uml:Package" xmi:id="_Y9XL8O2VEd-XTo9qEVpn9A" name="Package">
    <packagedElement xmi:type="uml:Class" xmi:id="_bU6SIO2VEd-XTo9qEVpn9A" name="Class"/>

With the following workflow:

<?xml version="1.0"?>
    <!-- Set Properties -->
    <property name="model" value="src/model/bouml.uml" />
    <property name="dump" value="src/model/test_dump.uml" />
    <property name="src-gen" value="src-gen" />
    <!-- Set UML environment -->
    <bean class="org.eclipse.xtend.typesystem.uml2.Setup" standardUML2Setup="true"/>
    <!-- Read in the model -->
    <component class="org.eclipse.emf.mwe.utils.Reader">
        <modelSlot value="model"/>
        <uri value="${model}"/>

    <!-- Write the model -->
    <component class="org.eclipse.emf.mwe.utils.Writer">
        <modelSlot value="model"/>
        <uri value="${dump}"/>
    <!-- Generate code -->
    <component id="generator" class="org.eclipse.xpand2.Generator" skipOnErrors="true">
        <metaModel class="org.eclipse.xtend.typesystem.uml2.UML2MetaModel"/>
        <expand value="templates::Root::Root FOR model"/>
        <fileEncoding value="ISO-8859-1"/>
        <outlet path="src-gen">
            <postprocessor class="org.eclipse.xpand2.output.JavaBeautifier"/>
        <resourceManager class ="org.eclipse.xtend.expression.ResourceManagerDefaultImpl">
            <fileEncoding value="ISO-8859-1"/>

With the template:

«DEFINE Root FOR uml::Model»
    «EXPAND PackageRoot FOREACH allOwnedElements().typeSelect(uml::Package)»

«DEFINE PackageRoot FOR uml::Package»
    «EXPAND ClassRoot FOREACH ownedType.typeSelect(uml::Class)»

«DEFINE ClassRoot FOR uml::Class»
    «FILE name+".java"»
        public class «name» {}

I get these workflow output:

16   INFO  WorkflowRunner     - running workflow: C:/Programme/Eclipse_Modeling/Workspace/
16   INFO  WorkflowRunner     - 
1360 INFO  CompositeComponent - Reader: Loading model from src/model/bouml.uml
3766 INFO  CompositeComponent - Writer: Writing model to src/model/test_dump.uml
3844 INFO  CompositeComponent - Generator(generator): generating 'templates::Root::Root FOR model' => src-gen
3938 ERROR AbstractExpressionsUsingWorkflowComponent - Error in Component generator of type org.eclipse.xpand2.Generator: 
	EvaluationException : No Definition 'templates::Root::Root for null::Model' found!
	[23,38] on line 1 'EXPAND templates::Root::Root FOR model'

3938 ERROR WorkflowRunner     - Workflow interrupted. Reason: No Definition 'templates::Root::Root for null::Model' found!
3938 WARN  WorkflowRunner     - [WARNING]: the element in slot 'model' is already contained in a resource and will be taken out of that resource!(Element: -UNKNOWN-; Reported by: Writer: Writing model to src/model/test_dump.uml)
3938 ERROR WorkflowRunner     - [ERROR]: No Definition 'templates::Root::Root for null::Model' found!(Element: EXPAND templates::Root::Root FOR model; Reported by: Generator(generator): generating 'templates::Root::Root FOR model' => src-gen)

And if I modify the following line
<uml:Model xmi:version="2.1" xmlns:xmi="" xmlns:uml="" xmi:id="themodel" name="UMLTest">

<uml:Model xmi:version="2.1" xmlns:xmi="" xmlns:uml="" xmi:id="themodel" name="UMLTest">

The workflow ends up with no errors. What is the reason for this and how I can change the schema location by code rather than by hand? Maybe I havn't understood the sense behind schema locations yet...

Thanks in advance and bye
Tom Smile

[Updated on: Thu, 11 November 2010 13:45]

Report message to a moderator

Re: Difference in Schema Location and Xpand [message #643896 is a reply to message #638492] Wed, 08 December 2010 16:10 Go to previous message
Rafael Chaves is currently offline Rafael ChavesFriend
Messages: 161
Registered: July 2009
Senior Member
Hi Tom,

This is a question for the Xpand folks (eclipse.modeling.m2t?).


Previous Topic:Types of an UML profile are not recognised
Next Topic:Drawing Associations with Eclipse UML2
Goto Forum:

Current Time: Sat May 26 12:21:41 GMT 2018

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

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

Back to the top