|
Re: what is the root for all UML models? [message #1065427 is a reply to message #1065278] |
Tue, 25 June 2013 16:29 |
Rafael Chaves Messages: 161 Registered: July 2009 |
Senior Member |
|
|
It could be uml:Package or uml:Model or uml:Profile, depending on the kind of top level package it has.
The serialization format is a different question: if your model has no stereotypes applied, it will be uml:Package, uml:Model etc:
<?xml version="1.0" encoding="UTF-8"?>
<uml:Package xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmi:version="20110701" xmi:id="_0" name="customers" URI="I-sandbox-test/customers">
<packageImport xmi:id="_packageImport.0" />
<packagedElement xmi:type="uml:Class" xmi:id="Customer" name="Customer">
</packagedElement>
<profileApplication xmi:id="_profileApplication.0">
<eAnnotations xmi:id="_profileApplication.0-_http2F2Fwww.eclipse.org2Fuml22F2.0.02FUML" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="platform:/plugin/com.abstratt.kirra.mdd.core/models/kirra.uml#_http2F2Fwww.eclipse.org2Fuml22F2.0.02FUML-kirra" />
</eAnnotations>
<appliedProfile href="platform:/plugin/com.abstratt.kirra.mdd.core/models/kirra.uml#_0" />
</profileApplication>
</uml:Package>
If it has stereotypes applied, then the stereotype applications will be top-level as well, and since XML admits only one root element, a xmi:XMI element becomes the XML root element, to wrap the proper root elements:
<?xml version="1.0" encoding="UTF-8"?>
<xmi:XMI xmlns:xmi="http://www.omg.org/spec/XMI/20110701" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:kirra="models/kirra" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML" xmi:version="20110701" xsi:schemaLocation="models/kirra platform:/plugin/com.abstratt.kirra.mdd.core/models/kirra.uml#_http2F2Fwww.eclipse.org2Fuml22F2.0.02FUML-kirra">
<uml:Package xmi:id="_0" name="customers" URI="I-sandbox-test/customers">
<packageImport xmi:id="_packageImport.0" />
<packagedElement xmi:type="uml:Class" xmi:id="Customer" name="Customer">
</packagedElement>
<profileApplication xmi:id="_profileApplication.0">
<eAnnotations xmi:id="_profileApplication.0-_http2F2Fwww.eclipse.org2Fuml22F2.0.02FUML" source="http://www.eclipse.org/uml2/2.0.0/UML">
<references xmi:type="ecore:EPackage" href="platform:/plugin/com.abstratt.kirra.mdd.core/models/kirra.uml#_http2F2Fwww.eclipse.org2Fuml22F2.0.02FUML-kirra" />
</eAnnotations>
<appliedProfile href="platform:/plugin/com.abstratt.kirra.mdd.core/models/kirra.uml#_0" />
</profileApplication>
</uml:Package>
<kirra:Entity xmi:id="_1" base_Class="Customer" />
</xmi:XMI>
I am not 100% positive, but it may be possible to serialize multiple top-level packages in a file, and that would require a root wrapper element as well.
Also, UML2 supports different serialization formats/versions of XMI that may behave differently.
Rafael
http://abstratt.com
[Updated on: Tue, 25 June 2013 16:35] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.02964 seconds