Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » How to get meta-model of UML design model
How to get meta-model of UML design model [message #596219] Tue, 23 February 2010 12:45 Go to next message
Yu-Hsin Lin is currently offline Yu-Hsin LinFriend
Messages: 10
Registered: February 2010
Junior Member
Dear All,
I have a project which is a code generator based on Papyrus.
But I want to add some feature on the meta-model and need
to extend the .uml file. For example, a segment of code is attached
in a tag. The problem is that the extension should not violate
the parse and restore process from the source file while reopening
a project. Can anyone of you show me how to get the meta-model
of UML design model in Papyrus so that I can correctly restore
original project which the source file is modified and added by
additional information for our code generator.
Re: How to get meta-model of UML design model [message #596225 is a reply to message #596219] Tue, 23 February 2010 16:20 Go to previous messageGo to next message
Vlad Varnica is currently offline Vlad VarnicaFriend
Messages: 546
Registered: July 2009
Location: Milton Keynes - UK
Senior Member
The model is in memory so you can not access it directly or modify it in order to add tag information.
The only thing you can do it to query the GMF in-memory model calling a method and adding a code generation condition depending on the result of the query. Don't ask me where is the class because I don't use this tool and therefore don't know.
Re: How to get meta-model of UML design model [message #598589 is a reply to message #596225] Sun, 28 February 2010 08:39 Go to previous messageGo to next message
Yu-Hsin Lin is currently offline Yu-Hsin LinFriend
Messages: 10
Registered: February 2010
Junior Member
Thanks for your reply :)

Sorry, what I described above is too complicated and vague.
Actually, I just wanna to get the XML schema of Papyrus.
Since I'm a newbie to Eclipse and Papyrus, I have no idea to find it.

When I draw UML diagrams on Papyrus, it will generate XML files after saving it.
And what I want is to get the rules how UML metamodels transform into XML format.
Where can I get this information?

Thanks in advance!
Yu-Hsin
Re: How to get meta-model of UML design model [message #598595 is a reply to message #598589] Sun, 28 February 2010 11:47 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31357
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020800060507070905010602
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Yu-Hsin,

There is no reasonable XML Schema for the UML2 serialization; XML schema
doesn't support multiple inheritance yet the UML2 model relies heavily
on it. UML2 and the diagrams themselves, i.e., the Notation model, both
use XMI serialization which is driven directly from their respective
Ecore models. I can't imagine how you would get any value from trying
to process the XML directly. It's still not even clear what exactly
you're trying to do. Likely you should be extending UML using profiles
and should look at the documentation here:
<http://wiki.eclipse.org/index.php/MDT-UML2>

http://wiki.eclipse.org/index.php/MDT-UML2



Yu-Hsin Lin wrote:
> Thanks for your reply :)
> Sorry, what I described above is too complicated and vague.
> Actually, I just wanna to get the XML schema of Papyrus.
> Since I'm a newbie to Eclipse and Papyrus, I have no idea to find it.
>
> When I draw UML diagrams on Papyrus, it will generate XML files after
> saving it.
> And what I want is to get the rules how UML metamodels transform into
> XML format.
> Where can I get this information?
>
> Thanks in advance!
> Yu-Hsin

--------------020800060507070905010602
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Yu-Hsin,<br>
<br>
There is no reasonable XML Schema for the UML2 serialization; XML
schema doesn't support multiple inheritance yet the UML2 model relies
heavily on it.  UML2 and the diagrams themselves, i.e., the Notation
model, both use XMI serialization which is driven directly from their
respective Ecore models.  I can't imagine how you would get any value
from trying to process the XML directly.  It's still not even clear
what exactly you're trying to do.  Likely you should be extending UML
using profiles and should look at the documentation here:<a
href="http://wiki.eclipse.org/index.php/MDT-UML2"><br>
</a>
<blockquote><a href="http://wiki.eclipse.org/index.php/MDT-UML2">http://wiki.eclipse.org/index.php/MDT-UML2</a><br>
</blockquote>
<br>
<br>
Yu-Hsin Lin wrote:
<blockquote cite="mid:hmda41$3rl$1@build.eclipse.org" type="cite">Thanks
for your reply  :) <br>
Sorry, what I described above is too complicated and vague.
<br>
Actually, I just wanna to get the XML schema of Papyrus.
<br>
Since I'm a newbie to Eclipse and Papyrus, I have no idea to find it.
<br>
<br>
When I draw UML diagrams on Papyrus, it will generate XML files after
saving it.
<br>
And what I want is to get the rules how UML metamodels transform into
XML format.
<br>
Where can I get this information?
<br>
<br>
Thanks in advance!
<br>
Yu-Hsin
<br>
</blockquote>
</body>
</html>

--------------020800060507070905010602--


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: How to get meta-model of UML design model [message #598603 is a reply to message #598595] Mon, 01 March 2010 09:14 Go to previous messageGo to next message
Yu-Hsin Lin is currently offline Yu-Hsin LinFriend
Messages: 10
Registered: February 2010
Junior Member
Hi,

Please allow me to take a simple example to descibe my problem.

If I draw a class called "MyClass" on Papyrus, then the content of .uml file should be:

<?xml version="1.0" encoding="UTF-8"?>
<uml:Model xmi:version="2.1" xmlns:xmi="..." xmlns:ecore="..." xmlns:uml="..." xmi:id="..." name="UMLModel">
<packageImport xmi:id="...">
<importedPackage xmi:type="uml:Model" href="..."/>
</packageImport>
<packagedElement xmi:type="uml:Class" xmi:id="..." name="MyClass"/>
<profileApplication xmi:id="...">
<eAnnotations xmi:id="..." source="...">
<references xmi:type="ecore:EPackage" href="..."/>
</eAnnotations>
<appliedProfile href="..."/>
</profileApplication>
</uml:Model>

The basic structure of above xml file is supposed to be as follows:

<packageImport>
<importedPackage xmi:type="uml:Model">
</packageImport>
<packagedElement xmi:type="uml:Class" name="MyClass"/>
<profileApplication>
<eAnnotations>
<references xmi:type="ecore:EPackage" />
</eAnnotations>
<appliedProfile />
</profileApplication>


So, I just want to get the rules or definitions that how Papyrus translates into XML format when users draw some metamodels on this kind of MDT.
It is certainly a stupid problem :blush:, but has bothered me for a long time.

Thanks in advance!
Yu-Hsin
Re: How to get meta-model of UML design model [message #598607 is a reply to message #598603] Mon, 01 March 2010 09:49 Go to previous messageGo to next message
Vlad Varnica is currently offline Vlad VarnicaFriend
Messages: 546
Registered: July 2009
Location: Milton Keynes - UK
Senior Member
This is ggod question Yu-Hsin but your idea is impossible to develop because we always need to use Ecore and EMF for serialization.

The question could be: Is there any smarter way to serialize my UML editors than what is suggested today by Papyrus ?
Re: How to get meta-model of UML design model [message #598613 is a reply to message #598607] Mon, 01 March 2010 11:48 Go to previous messageGo to next message
Yu-Hsin Lin is currently offline Yu-Hsin LinFriend
Messages: 10
Registered: February 2010
Junior Member
It seems that Papyrus uses Ecore and EMF for serialization. (I'm not sure.)
Since it's impossible to get the XML schema of Papyrus, is it feasible to trace the source code of Ecore and EMF? (Java code?)

Yu-Hsin
Re: How to get meta-model of UML design model [message #598618 is a reply to message #598603] Mon, 01 March 2010 11:50 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31357
Registered: July 2009
Senior Member
Yu-Hsin,

Comments below.


Yu-Hsin Lin wrote:
> Hi,
>
> Please allow me to take a simple example to descibe my problem.
>
> If I draw a class called "MyClass" on Papyrus, then the content of
> .uml file should be:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <uml:Model xmi:version="2.1" xmlns:xmi="..." xmlns:ecore="..."
> xmlns:uml="..." xmi:id="..." name="UMLModel">
> <packageImport xmi:id="...">
> <importedPackage xmi:type="uml:Model" href="..."/>
> </packageImport>
> <packagedElement xmi:type="uml:Class" xmi:id="..." name="MyClass"/>
> <profileApplication xmi:id="...">
> <eAnnotations xmi:id="..." source="...">
> <references xmi:type="ecore:EPackage" href="..."/>
> </eAnnotations>
> <appliedProfile href="..."/>
> </profileApplication>
> </uml:Model>
>
> The basic structure of above xml file is supposed to be as follows:
>
> <packageImport>
> <importedPackage xmi:type="uml:Model">
> </packageImport>
> <packagedElement xmi:type="uml:Class" name="MyClass"/>
> <profileApplication>
> <eAnnotations>
> <references xmi:type="ecore:EPackage" />
> </eAnnotations>
> <appliedProfile />
> </profileApplication>
>
>
> So, I just want to get the rules or definitions that how Papyrus
> translates into XML format when users draw some metamodels on this
> kind of MDT.
> It is certainly a stupid problem :blush:, but has bothered me for a
> long time.
Yes, if you look at the Ecore model for UML (the one whose nsURI matches
the namespace in xmlns:uml="..." ) all is evident there. I.e., you'll
find an EClass called Model; that's the name of the root element.
Model inherits from Package, which inherits from Namespace,
PackageableElement, and TemplateableElement. Namespace has a feature
called packageImport so you'll expect to see elements called
packageImport. Package has a profileApplication feature, so you should
expect that too. All UML Elements extend EModelElement from Ecore
itself, which supports an eAnnotations feature, so you see that as well.

So you see that despite Vlad nonsense commentary about the impossibility
to determine the serialization rules, they're very simply defined by the
(meta)model of UML itself, i.e., by the Ecore model of UML. Note that
Ecore is isomorphic to the OMG's EMOF model; Ecore predates EMOF. At
the root, the name of the EClass is used, and below that, all element
and attribute names correspond to feature names within the class of the
instance. This is the basis for any XMI serialization, so if you want
to understand the rules, look closely at the OMG's XMI specification
which defines how any instance of an EMOF model is serialized. We'll
wait patiently for someone like Vlad to come up with a smarter way,
i.e., to reinvent XMI and to convince the OMG that his solution is
superior to the established standard. However, you have to wonder,
given the fact that he's reusing UML and EMF in Omondo and hence that
he's relying on the same mechanism as Papyrus for serialization, why he
spouts the nonsense that he does. No doubt he has little better to do.
> Thanks in advance!
> Yu-Hsin


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: How to get meta-model of UML design model [message #598625 is a reply to message #598613] Mon, 01 March 2010 11:55 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 31357
Registered: July 2009
Senior Member
Yu-Hsin,

As I mentioned already, you can't properly describe the serialization of
UML with an XML Schema. You need to think of the Ecore/EMOF model as a
simple and more powerful XML Schema.

Unfortunately Vlad is not here on this forum to help nor to answer your
questions. He's here for the sole purpose of getting people to use
Omondo, so you should expect him to tell you that everything you want to
do is impossible unless you use Omondo, and then it will be simple. It's
best to ignore him.


Yu-Hsin Lin wrote:
> It seems that Papyrus uses Ecore and EMF for serialization. (I'm not
> sure.)
> Since it's impossible to get the XML schema of Papyrus, is it feasible
> to trace the source code of Ecore and EMF? (Java code?)
>
> Yu-Hsin


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[Announce] Eclipse/OMG Symposium 2010
Next Topic:How to get meta-model of UML design model
Goto Forum:
  


Current Time: Sat Aug 08 01:20:45 GMT 2020

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

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

Back to the top