Instance of ECore Model [message #656737] |
Mon, 28 February 2011 11:20 |
Dharam Messages: 18 Registered: December 2010 |
Junior Member |
|
|
Hello,
(Sample Example)
My ECore model's textual format looks like this,
<?xml version="1.0" encoding="UTF-8"?>
<ecore:EPackage xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="mymodel"
nsURI="http://mymodel/1.0" nsPrefix="mymodel">
<eClassifiers xsi:type="ecore:EClass" name="Order">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="id" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="customer" lowerBound="1"
eType="#//Customer" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="articles" upperBound="-1"
eType="#//Article" containment="true"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Customer">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="address" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="Article">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="price" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloat"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="OrderSystem">
<eStructuralFeatures xsi:type="ecore:EReference" name="customers" upperBound="-1"
eType="#//Customer" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="orders" upperBound="-1"
eType="#//Order" containment="true"/>
<eStructuralFeatures xsi:type="ecore:EReference" name="articles" upperBound="-1"
eType="#//Article" containment="true"/>
</eClassifiers>
</ecore:EPackage>
Now I want to create an XMI instance of above MyModel.ecore.
But it asks me only for particular object only as an example OrederSystem.
In fact I want to create something like this,
XML ECORE prolog....
<OrderSystem xmi:id="123"..../>
<Customer xmi:id="123" />
<Article xmi:id="123"/>
So that later in this XMI file I can refer customer with id 123...
Is it posssible? If yes then what should be XML Prolog? As I am somewhat new to this, improve me if I am wrong anywhere..
[Updated on: Mon, 28 February 2011 11:50] Report message to a moderator
|
|
|
Re: Instance of ECore Model [message #656795 is a reply to message #656737] |
Mon, 28 February 2011 15:55 |
Ed Merks Messages: 33141 Registered: July 2009 |
Senior Member |
|
|
Dharam,
Comments below.
Dharam wrote:
> Hello,
>
> (Sample Example)
> My ECore model's textual format looks like this,
>
> <?xml version="1.0" encoding="UTF-8"?>
> <ecore:EPackage xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" name="mymodel"
> nsURI="http://mymodel/1.0" nsPrefix="mymodel">
> <eClassifiers xsi:type="ecore:EClass" name="Order">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="id"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="customer"
> lowerBound="1"
> eType="#//Customer" containment="true"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="articles"
> upperBound="-1"
> eType="#//Article" containment="true"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Customer">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="name"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="address"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="Article">
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="description"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
> <eStructuralFeatures xsi:type="ecore:EAttribute" name="price"
> eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EFloat"/>
> </eClassifiers>
> <eClassifiers xsi:type="ecore:EClass" name="OrderSystem">
> <eStructuralFeatures xsi:type="ecore:EReference" name="customers"
> upperBound="-1"
> eType="#//Customer" containment="true"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="orders"
> upperBound="-1"
> eType="#//Order" containment="true"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="articles"
> upperBound="-1"
> eType="#//Article" containment="true"/>
> </eClassifiers>
> </ecore:EPackage>
>
> Now I want to create an XMI instance of above MyModel.ecore.
> But it asks me only for particular object only as an example
> OrederSystem.
> In fact I want to create something like this,
>
> XML ECORE prolog....
> <OrderSystem xmi:id="123"..../>
OrderSystems contain customers, so I'm not sure why you're expecting to
keep them at the root of the XML. You can create them as children of
OrderSystem from the context menu for the initial OrderSystem you create.
> <Customer xmi:id="123" />
> <Article cmi:id="123"/>
>
> So that later in this XMI file I can refer customer with id 123...
>
> Is it posssible? If yes then what should be XML Prolog? As I am
> somewhat new to this, improve me if I am wrong anywhere..
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03481 seconds