Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » XPand Multiplicity
icon9.gif  XPand Multiplicity [message #671290] Tue, 17 May 2011 11:52 Go to next message
st oehm is currently offline st oehmFriend
Messages: 79
Registered: October 2009
Member
hi everyone,

i am using XPand to generate code from UML to java. i do this using emf as meta-metamodel and the uml-specification as metamodel
(short: i'm using an uml.ecore as metamodel)
now i am trying to have access to the upper and lower multiplicities of properties, but it doesn't work. i tried property.upper, property.upper.toString(),
uppervalue(), upperbound and so on. sometimes i get an exception and sometimes i just get one for upper and lower, although i set another value.
even worse: when i set the upper to * i get this:

org.eclipse.emf.ecore.xmi.IllegalValueException: Value '*' is not legal

i have no idea why this doesn't work, the other things like classes, interfaces, operations, etc. work very well.
every hint is welcome.

best regards,
stoehm Twisted Evil
Re: XPand Multiplicity [message #671358 is a reply to message #671290] Tue, 17 May 2011 15:25 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33138
Registered: July 2009
Senior Member
I'm not sure your questions are about Ecore's API... The name of the
bound features of ETypedElement are upperBound and lowerBound.
Unbounded (displayed as *) is represented as the value -1.


stoehm wrote:
> hi everyone,
>
> i am using XPand to generate code from UML to java. i do
> this using emf as meta-metamodel and the uml-specification
> as metamodel (short: i'm using an uml.ecore as metamodel)
> now i am trying to have access to the upper and lower
> multiplicities of properties, but it doesn't work. i tried
> property.upper, property.upper.toString(),
> uppervalue(), upperbound and so on. sometimes i get an
> exception and sometimes i just get one for upper and lower,
> although i set another value.
> even worse: when i set the upper to * i get this:
>
> org.eclipse.emf.ecore.xmi.IllegalValueException: Value '*'
> is not legal
>
> i have no idea why this doesn't work, the other things like
> classes, interfaces, operations, etc. work very well.
> every hint is welcome.
>
> best regards,
> stoehm :twisted:


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: XPand Multiplicity [message #671563 is a reply to message #671358] Wed, 18 May 2011 10:21 Go to previous messageGo to next message
st oehm is currently offline st oehmFriend
Messages: 79
Registered: October 2009
Member
hallo ed merks

thank you for your reply!
the problem is, i tried already upperBound (and lowerbBound) but then i get the following exception:


2375 ERROR AbstractExpressionsUsingWorkflowComponent - java.lang.NoSuchMethodException: org.eclipse.emf.ecore.impl.DynamicEObjectImpl.lowerBound()
java.lang.RuntimeException: java.lang.NoSuchMethodException: org.eclipse.emf.ecore.impl.DynamicEObjectImpl.lowerBound()
at org.eclipse.xtend.typesystem.emf.EClassType$2.evaluateIntern al(EClassType.java:127)
at org.eclipse.internal.xtend.type.baseimpl.OperationImpl.evalu ate(OperationImpl.java:36)
at org.eclipse.internal.xtend.expression.ast.OperationCall.eval uate(OperationCall.java:342)
at org.eclipse.internal.xtend.expression.ast.OperationCall.eval uateInternal(OperationCall.java:95)
at org.eclipse.internal.xtend.expression.ast.Expression.evaluat e(Expression.java:50)
at org.eclipse.internal.xpand2.ast.ExpressionStatement.evaluate Internal(ExpressionStatement.java:45)
at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement .java:41)
at org.eclipse.internal.xpand2.ast.ForEachStatement.evaluateInt ernal(ForEachStatement.java:121)
at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement .java:41)
at org.eclipse.internal.xpand2.ast.FileStatement.evaluateIntern al(FileStatement.java:86)
at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement .java:41)
at org.eclipse.internal.xpand2.ast.ForEachStatement.evaluateInt ernal(ForEachStatement.java:121)
at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement .java:41)
at org.eclipse.internal.xpand2.ast.ForEachStatement.evaluateInt ernal(ForEachStatement.java:121)
at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement .java:41)
at org.eclipse.internal.xpand2.ast.AbstractDefinition.evaluate( AbstractDefinition.java:180)
at org.eclipse.internal.xpand2.ast.ExpandStatement.invokeDefini tion(ExpandStatement.java:246)
at org.eclipse.internal.xpand2.ast.ExpandStatement.evaluateInte rnal(ExpandStatement.java:226)
at org.eclipse.internal.xpand2.ast.Statement.evaluate(Statement .java:41)
at org.eclipse.xpand2.Generator.invokeInternal2(Generator.java: 333)
at org.eclipse.xtend.expression.AbstractExpressionsUsingWorkflo wComponent.invokeInternal(AbstractExpressionsUsingWorkflowCo mponent.java:239)
at org.eclipse.emf.mwe.core.lib.AbstractWorkflowComponent.invok e(AbstractWorkflowComponent.java:126)
at org.eclipse.emf.mwe.core.container.CompositeComponent.intern alInvoke(CompositeComponent.java:104)
at org.eclipse.emf.mwe.core.container.CompositeComponent.invoke (CompositeComponent.java:89)
at org.eclipse.emf.mwe.core.WorkflowRunner.executeWorkflow(Work flowRunner.java:408)
at org.eclipse.emf.mwe.core.WorkflowRunner.run(WorkflowRunner.j ava:293)
at org.eclipse.emf.mwe.core.WorkflowRunner.main(WorkflowRunner. java:241)
Caused by: java.lang.NoSuchMethodException: org.eclipse.emf.ecore.impl.DynamicEObjectImpl.lowerBound()
at java.lang.Class.getMethod(Unknown Source)
at org.eclipse.xtend.typesystem.emf.EClassType$2.evaluateIntern al(EClassType.java:123)
... 26 more
2375 ERROR AbstractExpressionsUsingWorkflowComponent - Error in Component of type org.eclipse.xpand2.Generator:
EvaluationException : java.lang.NoSuchMethodException: org.eclipse.emf.ecore.impl.DynamicEObjectImpl.lowerBound()
template::Template.xpt[528,14] on line 21 'a.lowerBound()'
[23,41] on line 1 'EXPAND template::Template::main FOR model'

2375 ERROR WorkflowRunner - Workflow interrupted. Reason: java.lang.NoSuchMethodException: org.eclipse.emf.ecore.impl.DynamicEObjectImpl.lowerBound()
2375 ERROR WorkflowRunner - [ERROR]: java.lang.NoSuchMethodException: org.eclipse.emf.ecore.impl.DynamicEObjectImpl.lowerBound()(E lement: a.lowerBound(); Reported by: Generator: generating 'template::Template::main FOR model' => src-gen)
2375 ERROR WorkflowRunner - [ERROR]: java.lang.NoSuchMethodException: org.eclipse.emf.ecore.impl.DynamicEObjectImpl.lowerBound()(E lement: EXPRESSION: a.lowerBound(); Reported by: Generator: generating 'template::Template::main FOR model' => src-gen)
2375 ERROR WorkflowRunner - [ERROR]: java.lang.NoSuchMethodException: org.eclipse.emf.ecore.impl.DynamicEObjectImpl.lowerBound()(E lement: org.eclipse.internal.xpand2.ast.ForEachStatement@b7b3f9; Reported by: Generator: generating 'template::Template::main FOR model' => src-gen)
2375 ERROR WorkflowRunner - [ERROR]: java.lang.NoSuchMethodException: org.eclipse.emf.ecore.impl.DynamicEObjectImpl.lowerBound()(E lement: org.eclipse.internal.xpand2.ast.FileStatement@88df60; Reported by: Generator: generating 'template::Template::main FOR model' => src-gen)
2375 ERROR WorkflowRunner - [ERROR]: java.lang.NoSuchMethodException: org.eclipse.emf.ecore.impl.DynamicEObjectImpl.lowerBound()(E lement: org.eclipse.internal.xpand2.ast.ForEachStatement@1318b; Reported by: Generator: generating 'template::Template::main FOR model' => src-gen)
2375 ERROR WorkflowRunner - [ERROR]: java.lang.NoSuchMethodException: org.eclipse.emf.ecore.impl.DynamicEObjectImpl.lowerBound()(E lement: org.eclipse.internal.xpand2.ast.ForEachStatement@5bb966; Reported by: Generator: generating 'template::Template::main FOR model' => src-gen)
2375 ERROR WorkflowRunner - [ERROR]: java.lang.NoSuchMethodException: org.eclipse.emf.ecore.impl.DynamicEObjectImpl.lowerBound()(E lement: main : Package; Reported by: Generator: generating 'template::Template::main FOR model' => src-gen)
2375 ERROR WorkflowRunner - [ERROR]: java.lang.NoSuchMethodException: org.eclipse.emf.ecore.impl.DynamicEObjectImpl.lowerBound()(E lement: EXPAND template::Template::main FOR model; Reported by: Generator: generating 'template::Template::main FOR model' => src-gen)

i also looked up in the model file, but there are upper and lower values for example in this attribute:

<ownedAttribute xmi:id="_5F68wIEiEeC9E-8eSOfGQw" name="i">
<type xmi:type="uml:PrimitiveType" href="pathmap://UML_METAMODELS/UML.metamodel.uml#Integer"/>
<upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_HHuDkIEjEeC9E-8eSOfGQw" value="10"/>
<lowerValue xmi:type="uml:LiteralInteger" xmi:id="_RNO7AIEjEeC9E-8eSOfGQw" value="5"/>
</ownedAttribute>

i get the same problem, when i want to acess the full qualified name!
maybe the problem is another and caused by the metamodel and metametamodel im using!

as i mentioned above as a metamodel i am using an ecore file, which describes the uml. then i am using a model, which is a *.uml file and not a *.xmi file.
(the problem is i have to use *.uml, cause the editor i use just generate files like this, and this is why the upperValue ist * for unbounded even if i type
-1)

i hope now the problem can be found
thanks for help

best regards
Re: XPand Multiplicity [message #671604 is a reply to message #671290] Wed, 18 May 2011 12:52 Go to previous message
st oehm is currently offline st oehmFriend
Messages: 79
Registered: October 2009
Member
so i found now a very easy solution for my problem (i just made things too complicated)
i just did it the same way like in the xpand tutorial about the UML2Example
so i don't need an ecore file which represents the uml-specification, which makes things a lot easier
Previous Topic:[Acceleo] Advices for unit testing ?
Next Topic:[ACCELEO] fonction standard (fonction prédefinis)
Goto Forum:
  


Current Time: Sat Apr 20 07:34:55 GMT 2024

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

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

Back to the top