Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Xtend/UML2] Resolving elements of a UML Profile.
[Xtend/UML2] Resolving elements of a UML Profile. [message #667499] Fri, 29 April 2011 08:12 Go to next message
Rainer  Alföldi is currently offline Rainer Alföldi
Messages: 1
Registered: April 2011
Location: Bern, Switzerland
Junior Member
Hi all,

I'm having real problems resolving imported elements of a UML Profile. primitiveTypes and steroTypes defined in the UML Model itself resolve perfectly. If imported from a UML Profile, it fails.

@Christian Dietrich: I've seen your answer to [Xpand] Issues setting up project to generate text from UML2 profile metamodel
from January 2011. My workflow file seems to match your working example.
module workflow

Workflow {
	
	bean = org.eclipse.emf.mwe.utils.StandaloneSetup {
		platformUri = ".."
	}
	
	bean = org.eclipse.xtend.typesystem.uml2.Setup {
		standardUML2Setup = true
	}
	
	component =  org.eclipse.emf.mwe.utils.Reader {
		id = "reader"
		uri = "uml/ch.alfoeldi.uml"
		modelSlot = "model"
	}
	
	component = org.eclipse.emf.mwe.utils.DirectoryCleaner {
		directory = "src-gen"
	}

	component = org.eclipse.xpand2.Generator {

		id = "generator"
		expand = "templates::Root::Root FOR model"
			
		metaModel = org.eclipse.xtend.typesystem.emf.EmfRegistryMetaModel {}
		metaModel = org.eclipse.xtend.typesystem.emf.EmfMetaModel {
			metaModelPackage = "org.eclipse.emf.ecore.EcorePackage"
		}
		metaModel = org.eclipse.xtend.typesystem.uml2.profile.ProfileMetaModel {
			profile = "platform:/resource/UML%20Generator/uml/primitiveTypes.profile.uml"
		} 
		metaModel = org.eclipse.xtend.typesystem.uml2.UML2MetaModel {}
				
		outlet = {
			fileEncoding = "UTF-8"
			path = "src-gen"
			postprocessor = org.eclipse.xpand2.output.JavaBeautifier {}
		}
		resourceManager = org.eclipse.xtend.expression.ResourceManagerDefaultImpl {
			fileEncoding = "UTF-8"
		}
		fileEncoding = "UTF-8"
	}
}

Tracing into ProfileMetaModel reveals that the profile file is read - including all components.

Nevertheless when accessing type in an xpand template type.name returns null.

The generated result looks like this (Javadocs display type.toString()):
/* org.eclipse.uml2.uml.internal.impl.PrimitiveTypeImpl@59c8b5 (eProxyURI: primitiveTypes.profile.uml#_iRiagHHCEeCLNP92l7dxhw)*/
private null _primitivAttribute;

/* org.eclipse.uml2.uml.internal.impl.StereotypeImpl@1a40247 (eProxyURI: primitiveTypes.profile.uml#_bdmbYHIsEeCcdecZAFuVOg)*/
private null _stereoTypeAttribute;

 /* org.eclipse.uml2.uml.internal.impl.PrimitiveTypeImpl@1e6978d (name: LocalPrimitiveType, visibility: <unset>) (isLeaf: false, isAbstract: false)*/
private LocalPrimitiveTyp _localPrimitiveAttribute;

I'm obviously doing something wrong. The question is what?

And while I'm at it: ProfileMetaModel seems to only pay attention to StereoTypes and Enumerations, ignoring primitiveTypes.
			if (o instanceof Stereotype) {
				final Stereotype st = (Stereotype) o;
				final String typeName = getFullName(st);
				final Type t = new StereotypeType(getTypeSystem(), typeName, st);
				stereoTypes.put(typeName, t);
			}
			else if (o instanceof Enumeration) {
				final Enumeration en = (Enumeration) o;
				final String typeName = getFullName(en);
				final Type t = new EnumType(getTypeSystem(), typeName, en);
				stereoTypes.put(typeName, t);
			}

Would this have any effect on resolving primitiveTypes - once I get the UML Profile working?

Greeting from Bern

Rainer
Re: [Xtend/UML2] Resolving elements of a UML Profile. [message #912390 is a reply to message #667499] Thu, 13 September 2012 13:30 Go to previous messageGo to next message
Daniel Margielewski is currently offline Daniel Margielewski
Messages: 5
Registered: September 2012
Junior Member
Hi,

have someone solution to this issue?

Best regards

[Updated on: Thu, 13 September 2012 15:03]

Report message to a moderator

Re: [Xtend/UML2] Resolving elements of a UML Profile. [message #912737 is a reply to message #912390] Fri, 14 September 2012 04:45 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6388
Registered: July 2009
Senior Member
Hi,

can you share a reproduceable example?
and verify that you are not affected by https://bugs.eclipse.org/bugs/show_bug.cgi?id=333605
and https://bugs.eclipse.org/bugs/show_bug.cgi?id=388232

~Christian
Re: [Xtend/UML2] Resolving elements of a UML Profile. [message #912832 is a reply to message #912737] Fri, 14 September 2012 09:09 Go to previous messageGo to next message
Daniel Margielewski is currently offline Daniel Margielewski
Messages: 5
Registered: September 2012
Junior Member
Hi Christian,

I attached example project. It is my.uml.example.

I can not resolve parameter type names of operations. For example I have "enable" operation. It has one parameter (direction return) and I can not get name of that parameter, it should be void. When I am trying to access parameter's type I am getting something like this:
org.eclipse.uml2.uml.internal.impl.PrimitiveTypeImpl@934c3b (eProxyURI: UML_Standard_Profile.MagicDraw_Profile.profile.uml#eee_1045467100323_249638_60)


Second issue is similar. Enable operation has applied stereotype but I also can not access it. Method getApplicableStereotypes() returns empty list.


And third issue is weird for me. I can run my workflow only when I import second project (org.eclipse.emf.examples.generator.validator) to workspace. Then the option Run as->MWE Workflow appears. Before importing second project I have only run configurations. Can you tell me what is missing in my.uml.example project?

Sorry if my problems are trivial but I am quite new to xpand.

Daniel
Re: [Xtend/UML2] Resolving elements of a UML Profile. [message #912867 is a reply to message #912832] Fri, 14 September 2012 09:59 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6388
Registered: July 2009
Senior Member
Hi,

there are lots of strange things in your project. which xpand version do you use?
which version of the eclipse uml plugins do you use.
which magic draw version?
i get errors even with the reader

~Christian
Re: [Xtend/UML2] Resolving elements of a UML Profile. [message #912894 is a reply to message #912867] Fri, 14 September 2012 11:12 Go to previous messageGo to next message
Daniel Margielewski is currently offline Daniel Margielewski
Messages: 5
Registered: September 2012
Junior Member
Hi,

I am using
MyEclipse 10.5 it has installed MyEclipse UML 1/2 Visual Design Tools
xpand 1.2.1
MagicDraw 17.0.2

What kind of strange things are in my project?

Daniel

[Updated on: Fri, 14 September 2012 11:13]

Report message to a moderator

Re: [Xtend/UML2] Resolving elements of a UML Profile. [message #912899 is a reply to message #912894] Fri, 14 September 2012 11:22 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6388
Registered: July 2009
Senior Member
Hi,

Eclipse Indigo says the following when reading the model

3191 ERROR VisitorCreator - java.lang.RuntimeException: org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Value 'org.eclipse.uml2.uml.internal.impl.EnumerationImpl@3436fffc (name: treeStructureEnumeration, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false)' is not legal. (platform:/resource/my.uml.example/src/UML_Standard_Profile.MagicDraw_Profile.profile.uml, 4107, 17)
java.lang.RuntimeException: java.lang.RuntimeException: org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Value 'org.eclipse.uml2.uml.internal.impl.EnumerationImpl@3436fffc (name: treeStructureEnumeration, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false)' is not legal. (platform:/resource/my.uml.example/src/UML_Standard_Profile.MagicDraw_Profile.profile.uml, 4107, 17)
at org.eclipse.emf.mwe.internal.core.ast.util.InjectorSimple.setValue(InjectorSimple.java:35)
at org.eclipse.emf.mwe.internal.core.ast.util.VisitorCreator.visitSimpleParamAST(VisitorCreator.java:201)
at org.eclipse.emf.mwe.internal.core.ast.util.VisitorBase.visit(VisitorBase.java:49)
at org.eclipse.emf.mwe.internal.core.ast.AbstractASTBase.accept(AbstractASTBase.java:44)
at org.eclipse.emf.mwe.internal.core.ast.util.VisitorCreator.createBean(VisitorCreator.java:155)
at org.eclipse.emf.mwe.internal.core.ast.util.VisitorCreator.visitComponentAST(VisitorCreator.java:116)
at org.eclipse.emf.mwe.internal.core.ast.util.VisitorBase.visit(VisitorBase.java:37)
at org.eclipse.emf.mwe.internal.core.ast.AbstractASTBase.accept(AbstractASTBase.java:44)
at org.eclipse.emf.mwe.internal.core.ast.util.VisitorCreator.createBean(VisitorCreator.java:155)
at org.eclipse.emf.mwe.internal.core.ast.util.VisitorCreator.visitComponentAST(VisitorCreator.java:116)
at org.eclipse.emf.mwe.internal.core.ast.util.VisitorBase.visit(VisitorBase.java:37)
at org.eclipse.emf.mwe.internal.core.ast.AbstractASTBase.accept(AbstractASTBase.java:44)
at org.eclipse.emf.mwe.internal.core.ast.util.VisitorCreator.createBean(VisitorCreator.java:155)
at org.eclipse.emf.mwe.internal.core.ast.util.VisitorCreator.visitComponentAST(VisitorCreator.java:116)
at org.eclipse.emf.mwe.internal.core.ast.util.VisitorBase.visit(VisitorBase.java:37)
at org.eclipse.emf.mwe.internal.core.ast.AbstractASTBase.accept(AbstractASTBase.java:44)
at org.eclipse.emf.mwe.internal.core.ast.util.WorkflowFactory.parseInitAndCreate(WorkflowFactory.java:71)
at org.eclipse.emf.mwe.internal.core.ast.util.WorkflowFactory.parseInitAndCreate(WorkflowFactory.java:50)
at org.eclipse.emf.mwe.core.WorkflowEngine.prepare(WorkflowEngine.java:92)
at org.eclipse.emf.mwe.core.WorkflowEngine.run(WorkflowEngine.java:50)
at org.eclipse.emf.mwe.core.WorkflowRunner.doRun(WorkflowRunner.java:174)
at org.eclipse.emf.mwe.core.WorkflowRunner.main(WorkflowRunner.java:70)
Caused by: java.lang.RuntimeException: org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Value 'org.eclipse.uml2.uml.internal.impl.EnumerationImpl@3436fffc (name: treeStructureEnumeration, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false)' is not legal. (platform:/resource/my.uml.example/src/UML_Standard_Profile.MagicDraw_Profile.profile.uml, 4107, 17)
at org.eclipse.xtend.typesystem.uml2.UML2Util2.loadProfile(UML2Util2.java:48)
at org.eclipse.xtend.typesystem.uml2.UML2Util2.loadProfile(UML2Util2.java:38)
at org.eclipse.xtend.typesystem.uml2.profile.ProfileMetaModel.addProfile(ProfileMetaModel.java:152)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.emf.mwe.internal.core.ast.util.InjectorSimple.setValue(InjectorSimple.java:33)
... 21 more
Caused by: org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Value 'org.eclipse.uml2.uml.internal.impl.EnumerationImpl@3436fffc (name: treeStructureEnumeration, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false)' is not legal. (platform:/resource/my.uml.example/src/UML_Standard_Profile.MagicDraw_Profile.profile.uml, 4107, 17)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:77)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:185)
at org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl.doLoad(XMLResourceImpl.java:240)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1505)
at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1284)
at org.eclipse.xtend.typesystem.uml2.UML2Util2.loadProfile(UML2Util2.java:46)
... 28 more
Caused by: org.eclipse.emf.ecore.xmi.IllegalValueException: Value 'org.eclipse.uml2.uml.internal.impl.EnumerationImpl@3436fffc (name: treeStructureEnumeration, visibility: <unset>) (isLeaf: false, isAbstract: false, isFinalSpecialization: false)' is not legal. (platform:/resource/my.uml.example/src/UML_Standard_Profile.MagicDraw_Profile.profile.uml, 4107, 17)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.setFeatureValue(XMLHandler.java:2657)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleForwardReferences(XMLHandler.java:1143)
at org.eclipse.emf.ecore.xmi.impl.XMLHandler.handleForwardReferences(XMLHandler.java:1024)
at org.eclipse.uml2.uml.internal.resource.UMLHandler.endElement(UMLHandler.java:47)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source)
at org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.load(XMLLoadImpl.java:175)
... 32 more
Re: [Xtend/UML2] Resolving elements of a UML Profile. [message #912919 is a reply to message #912899] Fri, 14 September 2012 11:52 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian Dietrich
Messages: 6388
Registered: July 2009
Senior Member
Could you please file a bugzilla with the example attached
Re: [Xtend/UML2] Resolving elements of a UML Profile. [message #915445 is a reply to message #912919] Mon, 17 September 2012 09:32 Go to previous message
Daniel Margielewski is currently offline Daniel Margielewski
Messages: 5
Registered: September 2012
Junior Member
I tried to run it on Eclipse Indigo. It is working but I still have the same problem. I reported a bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=389703

Daniel
Previous Topic:[Xtend]Allow user to add code in generated source
Next Topic:[JET]
Goto Forum:
  


Current Time: Sun Oct 26 04:37:27 GMT 2014

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

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