|
Re: how to query xmi model-file [message #479196 is a reply to message #479173] |
Mon, 10 August 2009 09:06 |
|
Hi,
I'm not sure if this help you but here is a tutorial which uses an EMF
model, access different model elements and creates HTML as output.
Perhaps it gives you some hints for want you want to do.
http://www.vogella.de/articles/EclipseJET/article.html
Best regards, Lars
aart matsinger wrote:
> Hi,
>
> I try to apply Jet on a very basic model containing orders with related
> customers and attributes. How could I retrieve for a specific order(or
> for all orders) the related customer (+ customer attributes) and the
> related articles (+ article attributes). My xmi model and ecore
> meta-model are included below. Any help would be very welcome.
>
> kind regards
> Aart
>
> My xmi model is:
> <?xml version="1.0" encoding="ASCII"?>
> <OrderSystem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns="www.acceleo.org/myDemo"
> xsi:schemaLocation="www.acceleo.org/myDemo myDemo.ecore">
> <orders id="XYZ001" customer="//@customers.0" articles="//@articles.0
> //@articles.2 //@articles.3"/>
> <orders id="XYZ002" customer="//@customers.2" articles="//@articles.2
> //@articles.3"/>
> <orders id="XYZ003" customer="//@customers.1" articles="//@articles.0
> //@articles.3"/>
> <orders id="XYZ004" customer="//@customers.0" articles="//@articles.2
> //@articles.3 //@articles.1"/>
> <customers name="customer 1" address="address of customer 1"/>
> <customers name="customer 2" address="address of customer 2"/>
> <customers name="customer 3" address="address of customer 3"/>
> <articles description="article 1" price="25.0"/>
> <articles description="article 2" price="12.5"/>
> <articles description="article 3" price="35.0"/>
> <articles description="article 4" price="49.95"/>
> </OrderSystem>
>
> My ecore model is: <?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="myDemo"
> nsURI="www.acceleo.org/myDemo" nsPrefix="">
> <eClassifiers xsi:type="ecore:EClass" name="OrderSystem">
> <eStructuralFeatures xsi:type="ecore:EReference" name="orders"
> upperBound="-1"
> eType="#//Order" containment="true"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="customers"
> upperBound="-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="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"/>
> <eStructuralFeatures xsi:type="ecore:EReference" name="articles"
> upperBound="-1"
> eType="#//Article"/>
> </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>
> </ecore:EPackage>
>
--
http://www.vogella.de/ - Eclipse plugin and Eclipse RCP Tutorials
http://www.twitter.com/vogella - vogella on Twitter
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04225 seconds