Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » How to get diagram information from XMI2.1 file exported by Enterprise Architect
How to get diagram information from XMI2.1 file exported by Enterprise Architect [message #871471] Mon, 14 May 2012 02:39 Go to next message
jy zhang is currently offline jy zhang
Messages: 19
Registered: May 2012
Junior Member
I've got model information from xmi2.1 file exported by EA successfully.
But when I want to get diagram information from the xmi2.1 file,
I can only get extensionMap(EObject,AnyType),
and no idea how to get the diagram from the extensionMap.
should I analyse the extensionMap by myself?

anybody can help me? Thanks!

	public static void main(String[] args) {
		ResourceSet resourceSet = createResourceSet();
		URI uri = URI.createURI("er.xmi");
		Package model = UML2Util.load(resourceSet, uri, UMLPackage.Literals.PACKAGE);

		//try to get diagram and notation information
		XMIResource res = (XMIResource) resourceSet.getResource(uri, true);
		Map<EObject, AnyType> extensionMap = res.getEObjectToExtensionMap();
		
        }


er.xmi contains extension like below:
<xmi:Extension extender="Enterprise Architect" extenderID="6.5">
  <elements></elements>
  <connectors></connectors>
  <primitivetypes></primitivetypes>
  <profiles/>
  <diagrams></diagrams>
</xmi:Extension>
  • Attachment: er.xmi
    (Size: 10.34KB, Downloaded 89 times)

[Updated on: Mon, 14 May 2012 06:40]

Report message to a moderator

Re: How to get diagram information from XMI2.1 file exported by Enterprise Architect [message #872381 is a reply to message #871471] Wed, 16 May 2012 02:16 Go to previous messageGo to next message
jy zhang is currently offline jy zhang
Messages: 19
Registered: May 2012
Junior Member
I tried to anylyse and parse the AnyTypeImpl of the EA extension information.
It seems OK but a little complex.
Re: How to get diagram information from XMI2.1 file exported by Enterprise Architect [message #873197 is a reply to message #872381] Thu, 17 May 2012 16:57 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4098
Registered: July 2009
Senior Member
Hi

I've no idea what you're really asking.

In my experience, AnyTypeImpl's are often unresolved proxies, so far
from OK.

Diagram Interchange is not supported between UML tools. UML 2.5 will
introduce a UML DI model.

Since DI is based on GMF Notation, and Papyrus uses GMF Notation, it may
not be too hard for Papyrus to support the eventual UML 2.5 DI.

Regards

Ed Willink

On 16/05/2012 03:16, jy zhang wrote:
> I tried to anylyse and parse the AnyTypeImpl of the EA extension
> information.
> It seems OK but a little complex.
Re: How to get diagram information from XMI2.1 file exported by Enterprise Architect [message #873380 is a reply to message #873197] Fri, 18 May 2012 05:15 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26141
Registered: July 2009
Senior Member
Ed,

AnyTypeImpl's are generally used to represent unrecognized content
(something that couldn't be matched to a model), or things like XMI
extensions for which there is no corresponding model). They're not
likely to be proxies; object of the feature's expected type with a proxy
URI will appear for that...

On 17/05/2012 6:57 PM, Ed Willink wrote:
> Hi
>
> I've no idea what you're really asking.
>
> In my experience, AnyTypeImpl's are often unresolved proxies, so far
> from OK.
>
> Diagram Interchange is not supported between UML tools. UML 2.5 will
> introduce a UML DI model.
>
> Since DI is based on GMF Notation, and Papyrus uses GMF Notation, it
> may not be too hard for Papyrus to support the eventual UML 2.5 DI.
>
> Regards
>
> Ed Willink
>
> On 16/05/2012 03:16, jy zhang wrote:
>> I tried to anylyse and parse the AnyTypeImpl of the EA extension
>> information.
>> It seems OK but a little complex.
>
Re: How to get diagram information from XMI2.1 file exported by Enterprise Architect [message #873385 is a reply to message #873380] Fri, 18 May 2012 05:27 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4098
Registered: July 2009
Senior Member
Hi Ed

I'm not sure what you mean. The original message had a follow on message
containing:

"When I load the xmi file, it seems it didn't dealt Integer as EClass
(general of EA "int").
org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Value
mailto:'org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@5c0662
(eProxyURI: http:||schema.omg.org/spec/UML/2.1/uml.xml#Integer eClass:
mailto:org.eclipse.emf.ecore.impl.EClassImpl@1a728d6 (name: Classifier)
(instanceClassName: null) (abstract: false, interface: false))' is not
legal.
at
org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)"

which is what I call an unresolved proxy. Is my terminology incorrect?

Regards

Ed



On 18/05/2012 06:15, Ed Merks wrote:
> Ed,
>
> AnyTypeImpl's are generally used to represent unrecognized content
> (something that couldn't be matched to a model), or things like XMI
> extensions for which there is no corresponding model). They're not
> likely to be proxies; object of the feature's expected type with a
> proxy URI will appear for that...
>
> On 17/05/2012 6:57 PM, Ed Willink wrote:
>> Hi
>>
>> I've no idea what you're really asking.
>>
>> In my experience, AnyTypeImpl's are often unresolved proxies, so far
>> from OK.
>>
>> Diagram Interchange is not supported between UML tools. UML 2.5 will
>> introduce a UML DI model.
>>
>> Since DI is based on GMF Notation, and Papyrus uses GMF Notation, it
>> may not be too hard for Papyrus to support the eventual UML 2.5 DI.
>>
>> Regards
>>
>> Ed Willink
>>
>> On 16/05/2012 03:16, jy zhang wrote:
>>> I tried to anylyse and parse the AnyTypeImpl of the EA extension
>>> information.
>>> It seems OK but a little complex.
>>
Re: How to get diagram information from XMI2.1 file exported by Enterprise Architect [message #873387 is a reply to message #873385] Fri, 18 May 2012 05:36 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26141
Registered: July 2009
Senior Member
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Ed,<br>
<br>
I see code like this that's dealing with extensions.<br>
<br>
<pre wrap=""> //try to get diagram and notation information
XMIResource res = (XMIResource) resourceSet.getResource(uri, true);
Map&lt;EObject, AnyType&gt; extensionMap = res.getEObjectToExtensionMap();

And XMI the looks like this:

&lt;xmi:Extension extender="Enterprise Architect" extenderID="6.5"&gt;
&lt;elements&gt;&lt;/elements&gt;
&lt;connectors&gt;&lt;/connectors&gt;
&lt;primitivetypes&gt;&lt;/primitivetypes&gt;
&lt;profiles/&gt;
&lt;diagrams&gt;&lt;/diagrams&gt;
&lt;/xmi:Extension&gt;
</pre>
<br>
This article is useful for understanding how AnyType is analogous to
DOM Element.<b><br>
</b>
<blockquote><a target="_out"
href="http://www.theserverside.com/tt/articles/article.tss?l=BindingXMLJava">Binding
XML to Java</a><br>
</blockquote>
What you quote below is in a different thread titled "how to load
int generals from Integer<b>".<br>
<br>
<br>
</b>On 18/05/2012 7:27 AM, Ed Willink wrote:
<blockquote cite="mid:jp4mjh$2b0$1@xxxxxxxxe.org" type="cite">Hi
Ed
<br>
<br>
I'm not sure what you mean. The original message had a follow on
message containing:
<br>
<br>
"When I load the xmi file, it seems it didn't dealt Integer as
EClass (general of EA "int").
<br>
org.eclipse.emf.ecore.resource.Resource$IOWrappedException: Value
<a class="moz-txt-link-freetext" href="mailto:'org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@5c0662">mailto:'org.eclipse.emf.ecore.xml.type.impl.AnyTypeImpl@5c0662</a>
(eProxyURI: http:||schema.omg.org/spec/UML/2.1/uml.xml#Integer
eClass: <a class="moz-txt-link-freetext" href="mailto:org.eclipse.emf.ecore.impl.EClassImpl@1a728d6">mailto:org.eclipse.emf.ecore.impl.EClassImpl@1a728d6</a>
(name: Classifier) (instanceClassName: null) (abstract: false,
interface: false))' is not legal.
<br>
    at
org.eclipse.emf.ecore.xmi.impl.XMLLoadImpl.handleErrors(XMLLoadImpl.java:83)"<br>
<br>
which is what I call an unresolved proxy. Is my terminology
incorrect?
<br>
<br>
    Regards
<br>
<br>
        Ed
<br>
<br>
<br>
<br>
On 18/05/2012 06:15, Ed Merks wrote:
<br>
<blockquote type="cite">Ed,
<br>
<br>
AnyTypeImpl's are generally used to represent unrecognized
content (something that couldn't be matched to a model), or
things like XMI extensions for which there is no corresponding
model). They're not likely to be proxies; object of the
feature's expected type with a proxy URI will appear for that...
<br>
<br>
On 17/05/2012 6:57 PM, Ed Willink wrote:
<br>
<blockquote type="cite">Hi
<br>
<br>
I've no idea what you're really asking.
<br>
<br>
In my experience, AnyTypeImpl's are often unresolved proxies,
so far from OK.
<br>
<br>
Diagram Interchange is not supported between UML tools. UML
2.5 will introduce a UML DI model.
<br>
<br>
Since DI is based on GMF Notation, and Papyrus uses GMF
Notation, it may not be too hard for Papyrus to support the
eventual UML 2.5 DI.
<br>
<br>
    Regards
<br>
<br>
        Ed Willink
<br>
<br>
On 16/05/2012 03:16, jy zhang wrote:
<br>
<blockquote type="cite">I tried to anylyse and parse the
AnyTypeImpl of the EA extension information.
<br>
It seems OK but a little complex.
<br>
</blockquote>
<br>
</blockquote>
</blockquote>
<br>
</blockquote>
</body>
</html>
Re: How to get diagram information from XMI2.1 file exported by Enterprise Architect [message #873468 is a reply to message #873387] Fri, 18 May 2012 09:57 Go to previous messageGo to next message
jy zhang is currently offline jy zhang
Messages: 19
Registered: May 2012
Junior Member
Hi Ed and Ed ^-^,

Yes, I want to get notation information of the XMI2.1 file exported by EA.
and such information exists in xmi.extension. When i load with my standalone code, it creates ModelImp for the root uml model, and AnyTypeImpl for the xmi.extension.

It seems I need to parse mixed and anyAttribute of the AnyTypeImpl to get the notation information. I did like this and it seems it's OK but a little complex.

Thanks again for your kindly help, and best regards!
Re: How to get diagram information from XMI2.1 file exported by Enterprise Architect [message #1271523 is a reply to message #873468] Sat, 15 March 2014 11:38 Go to previous messageGo to next message
Aaron Kampichler is currently offline Aaron Kampichler
Messages: 9
Registered: February 2014
Junior Member
Hallo jy zhang.

Did you manage to get a "readable" modelstructure?
I also tried to read and process an xmi2.1 file from EA, but as everything seemed to be AnyType I couldn't access (not even parse or cast) the elements.

We're now trying to read the file via SAX parser and an xmi-transformation similar to XSLT, but if it works with EMF that would be better I think.

I'd be happy about an answer on this old thread Wink
Re: How to get diagram information from XMI2.1 file exported by Enterprise Architect [message #1271534 is a reply to message #1271523] Sat, 15 March 2014 12:14 Go to previous message
Ed Willink is currently offline Ed Willink
Messages: 4098
Registered: July 2009
Senior Member
Hi

You are unlikely to get an answer on this old thread since it was far
from clear what the problem was. I certainly dismiss it as a user
problem not a tool problem.

If you have a problem provide a repro.

Regards

Ed Willink


On 15/03/2014 11:38, Aaron Kampichler wrote:
> Hallo jy zhang.
>
> Did you manage to get a "readable" modelstructure?
> I also tried to read and process an xmi2.1 file from EA, but as
> everything seemed to be AnyType I couldn't access (not even parse or
> cast) the elements.
>
> We're now trying to read the file via SAX parser and an
> xmi-transformation similar to XSLT, but if it works with EMF that
> would be better I think.
>
> I'd be happy about an answer on this old thread ;)
Previous Topic:Diagramming options
Next Topic:stereotypes not found on model reload
Goto Forum:
  


Current Time: Sat Oct 25 20:53:18 GMT 2014

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

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