Example
The spacing in the xml files below divides the information into dynamic and more resuable sections. For example in the Project pod example, only the title and activities are really dynamic. The rest of the stuff is really part of the type.
These xml files are instances of ecore models. Those models are included at the end. To keep the self contained nature of our currnet Pods the ecore definition of the Pod should be included with the Pod. In this example the ecore definitions of the Pods are all located in pas.ecore. The sailpod.ecore is included so you have the full picture. This would probably not need to be included in a curnit, it would instead be included in the sail-emf-pod library for dealing with this format.
AirbagsProject.xmi
<pas:Project xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:pas="http://www.telscenter.org/2006/pas" xmlns:sailpod="http://sail.sf.net/2006/sailpod" xsi:schemaLocation="http://www.telscenter.org/2006/pas ../models/pas.ecore http://sail.sf.net/2006/sailpod ../models/sailpod.ecore" title="Airbags"> <activities href="AirbagsActivity1.xmi#//@activity"/> <project bean="//@beans.0" address="/"/> <beans xsi:type="sailpod:BasicBean" beanClass="org.telscenter.pas.beans.PasProject"/> <mappings> <beanReference bean="//@beans.0" address="/activities"/> <podReference href="../models/pas.ecore#//Project/activities"/> </mappings> <mappings> <beanReference bean="//@beans.0" address="/title"/> <podReference href="../models/pas.ecore#//Project/title"/> </mappings> </pas:Project>
AirbagsActivity1.xmi
<pas:Activity xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pas="http://www.telscenter.org/2006/pas" xmlns:sailpod="http://sail.sf.net/2006/sailpod" xsi:schemaLocation="http://www.telscenter.org/2006/pas ../models/pas.ecore http://sail.sf.net/2006/sailpod ../models/sailpod.ecore" title="Airbags Activity 1"> <steps href="AirbagsEvidence1.xmi#//@evidence"/> <steps href="AirbagsNote1.xmi#//@note"/> <activity bean="//@beans.0" address="/"/> <beans xsi:type="sailpod:BasicBean" beanClass="org.telscenter.pas.beans.PasActivity"/> <mappings> <beanReference bean="//@beans.0" address="/steps"/> <podReference href="../models/pas.ecore#//Activity/steps"/> </mappings> <mappings> <beanReference bean="//@beans.0" address="/title"/> <podReference href="../models/pas.ecore#//Activity/title"/> </mappings> </pas:Activity>
AirbagsEvidence1.xmi
<pas:Evidence xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pas="http://www.telscenter.org/2006/pas" xmlns:sailpod="http://sail.sf.net/2006/sailpod" xsi:schemaLocation="http://www.telscenter.org/2006/pas ../models/pas.ecore http://sail.sf.net/2006/sailpod ../models/sailpod.ecore" title="Evidence1"> <evidence bean="//@beans.0" address="/"/> <beans xsi:type="sailpod:BasicBean" beanClass="org.telscenter.pas.steps.Evidence"/> <mappings> <beanReference bean="//@beans.0" address="/title"/> <podReference href="../models/pas.ecore#//Project/title"/> </mappings> </pas:Evidence>
AirbagsNote1.xmi
<pas:Note xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pas="http://www.telscenter.org/2006/pas" xmlns:sailpod="http://sail.sf.net/2006/sailpod" xsi:schemaLocation="http://www.telscenter.org/2006/pas ../models/pas.ecore http://sail.sf.net/2006/sailpod ../models/sailpod.ecore" title="Note1"> <note bean="//@beans.0" address="/"/> <beans xsi:type="sailpod:BasicBean" beanClass="org.telscenter.pas.steps.Note"/> <mappings> <beanReference bean="//@beans.0" address="/title"/> <podReference href="../models/pas.ecore#//Project/title"/> </mappings> </pas:Note>
pas.ecore
<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="pas" nsURI="http://www.telscenter.org/2006/pas" nsPrefix="pas"> <eClassifiers xsi:type="ecore:EClass" name="PasPod" eSuperTypes="sailpod.ecore#//Pod"> <eStructuralFeatures xsi:type="ecore:EAttribute" name="title" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="Project" eSuperTypes="#//PasPod"> <eStructuralFeatures xsi:type="ecore:EReference" name="activities" upperBound="-1" eType="ecore:EClass sailpod.ecore#//BeanReference"/> <eStructuralFeatures xsi:type="ecore:EReference" name="project" eType="ecore:EClass sailpod.ecore#//BeanReference" containment="true"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="Activity" eSuperTypes="#//PasPod"> <eStructuralFeatures xsi:type="ecore:EReference" name="steps" upperBound="-1" eType="ecore:EClass sailpod.ecore#//BeanReference"/> <eStructuralFeatures xsi:type="ecore:EReference" name="activity" eType="ecore:EClass sailpod.ecore#//BeanReference" containment="true"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="Evidence" eSuperTypes="#//PasPod"> <eStructuralFeatures xsi:type="ecore:EReference" name="evidence" eType="ecore:EClass sailpod.ecore#//BeanReference" containment="true"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="Note" eSuperTypes="#//PasPod"> <eStructuralFeatures xsi:type="ecore:EReference" name="note" eType="ecore:EClass sailpod.ecore#//BeanReference" containment="true"/> </eClassifiers> </ecore:EPackage>
sailpod.ecore
<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="sailpod" nsURI="http://sail.sf.net/2006/sailpod" nsPrefix="sailpod"> <eClassifiers xsi:type="ecore:EClass" name="Pod"> <eStructuralFeatures xsi:type="ecore:EReference" name="rims" upperBound="-1" eType="#//Rim" containment="true"/> <eStructuralFeatures xsi:type="ecore:EReference" name="beans" upperBound="-1" eType="#//Bean" containment="true"/> <eStructuralFeatures xsi:type="ecore:EReference" name="mappings" upperBound="-1" eType="#//Mapping" containment="true"/> <eStructuralFeatures xsi:type="ecore:EReference" name="embeddedPods" upperBound="-1" eType="#//Pod" containment="true"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="Rim"/> <eClassifiers xsi:type="ecore:EClass" name="Bean"/> <eClassifiers xsi:type="ecore:EClass" name="BasicBean" eSuperTypes="#//Bean"> <eStructuralFeatures xsi:type="ecore:EAttribute" name="beanClass" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="XMLEncoderBean" eSuperTypes="#//Bean"> <eStructuralFeatures xsi:type="ecore:EAttribute" name="beanXml" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/> </eClassifiers> <eClassifiers xsi:type="ecore:EClass" name="BeanReference"> <eStructuralFeatures xsi:type="ecore:EReference" name="bean" lowerBound="1" eType="#//Bean"/> <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="Mapping"> <eStructuralFeatures xsi:type="ecore:EReference" name="beanReference" lowerBound="1" eType="#//BeanReference" containment="true"/> <eStructuralFeatures xsi:type="ecore:EReference" name="podReference" lowerBound="1" eType="ecore:EClass ../../../plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EReference"/> </eClassifiers> </ecore:EPackage>
Issues using emf for the sail content data model
Containment
In emf when one object contains another that literally means the contained is stored inside of the container. So if one pod contains a child then that child pod will be stored in the part.
Most of the case we have of children pods, do not want this kind of containment. For example a Project pod has activity children and activities have step children. To support having these in separate places, the children need to be non-containment references.
EMF
Pod
Has a schema which is a ecore EClass
Has a list of beans in the Pod
Has a list of bindings between its EClass features and the properties in the beans
Has an instance of that EClass which is the actual data of the pod