Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

26
EMF Notebook Pierre Lindenbaum @yokofakun http://plindenbaum.blogspot.com September 10, 2013 Abstract EMF (The Eclipse Modeling Framework) is a Java framework and code generation facility for building tools and other applications based on a structured model. Once you specify an EMF model, the EMF generator can create a corresponding set of Java implementation classes. In the following tutorial I’m going to generate a simple-and-stupid LIMS. We’re going to create an interface for a simple-and-stupid LIMS. 1

description

Here is my EMF notebook

Transcript of Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

Page 1: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

EMF Notebook

Pierre Lindenbaum@yokofakun

http://plindenbaum.blogspot.com

September 10, 2013

Abstract

EMF (The Eclipse Modeling Framework) is a Java framework andcode generation facility for building tools and other applications basedon a structured model. Once you specify an EMF model, the EMFgenerator can create a corresponding set of Java implementation classes.In the following tutorial I’m going to generate a simple-and-stupid LIMS.

We’re going to create an interface for a simple-and-stupid LIMS.

1

Page 2: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

• A laboratory contains a list of Families

• A laboratory contains a list of Sequencers

• a family contains a list of Individuals

• an Individual contains a list of Samples

• a Sequencer contains a list of Runs

• a Run contains a list of Sequenced which links to a Sample.

At the end of this tutorial, we’re going to generate the following heavy clientfor our model:

1 Install the EMF plugins for Eclipse

see http://wiki.eclipse.org/EMF/Installation#Install_EMF.

2 Creating the Model

A model is created and defined in the Ecore format, which is basically asub-set of UML Class diagrams.

2

Page 3: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

2.1 Create the Project

• Open Eclipse

• Menu File → New → New Project... → Empty EMF Project

• Name the project EMF03-Model

2.2 Create the ECore model

create a new ’ECore’ file in the model folder in your new modeling project.

• Menu File → New → Other.. → ECore Model

• Wizard: select the folder EMF03-Model/model.

• Wizard: set the filename as lims.ecore.

• Wizard: set Model Object as EPackage.

• Menu Window → Show View → Other → Properties

An EPackage named Lims is created. The package contains 7 EClass and 1EEnum(s). The EPackage Lims is defined as below:

Key Valuename Lims

nsURI http://univ-nantes.fr/lims/nsPrefix lims

Next, were going to create the EEnum and the EClass:

• In the tree view right click on the node EPackage ”Lims” , create a newEEnum and set the name property to ”Gender”.

• In the tree view right click on the node EPackage ”Lims” , create a newEClass and set the name property to ”Family”.

• In the tree view right click on the node EPackage ”Lims” , create a newEClass and set the name property to ”Laboratory”.

• In the tree view right click on the node EPackage ”Lims” , create a newEClass and set the name property to ”Individual”.

• In the tree view right click on the node EPackage ”Lims” , create a newEClass and set the name property to ”Sequencer”.

• In the tree view right click on the node EPackage ”Lims” , create a newEClass and set the name property to ”Run”.

• In the tree view right click on the node EPackage ”Lims” , create a newEClass and set the name property to ”Sample”.

3

Page 4: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

• In the tree view right click on the node EPackage ”Lims” , create a newEClass and set the name property to ”Sequenced”.

Then, we complete the structure of each classifier:

2.3 Gender

In the tree view, right-click on the node EEnum ”Gender” and add thefollowing 3 eLiterals:

Name Literal ValueUNKNOWN UNKNOWN

MALE MALE 1FEMALE FEMALE 2

2.4 Family

In the tree view, select the node EClass ”Lims” and set the following prop-erties:

Key Valuename Family

We add some structural features to the EClass ”Family”:

2.4.1 Family:name

In the tree view, right click on the node EClass ”Family” Create a newEAttribute named ”name” and set its properties:

Key Valuename name

lowerBound 1eType EString

2.4.2 Family:individuals

In the tree view, right click on the node EClass ”Family” Create a newEReference named ”individuals” and set its properties:

Key Valuename individuals

upperBound -1 (unbounded)eType -//Individual

containment trueeOpposite -//Individual/family

4

Page 5: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

2.4.3 Family:laboratory

In the tree view, right click on the node EClass ”Family” Create a newEReference named ”laboratory” and set its properties:

Key Valuename laboratory

lowerBound 1eType -//Laboratory

eOpposite -//Laboratory/families

2.5 Laboratory

In the tree view, select the node EClass ”Lims” and set the following prop-erties:

Key Valuename Laboratory

We add some structural features to the EClass ”Laboratory”:

2.5.1 Laboratory:families

In the tree view, right click on the node EClass ”Laboratory” Create anew EReference named ”families” and set its properties:

Key Valuename families

upperBound -1 (unbounded)eType -//Family

containment trueeOpposite -//Family/laboratory

2.5.2 Laboratory:sequencers

In the tree view, right click on the node EClass ”Laboratory” Create anew EReference named ”sequencers” and set its properties:

Key Valuename sequencers

upperBound -1 (unbounded)eType -//Sequencer

containment trueeOpposite -//Sequencer/laboratory

5

Page 6: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

2.6 Individual

In the tree view, select the node EClass ”Lims” and set the following prop-erties:

Key Valuename Individual

We add some structural features to the EClass ”Individual”:

2.6.1 Individual:gender

In the tree view, right click on the node EClass ”Individual” Create a newEAttribute named ”gender” and set its properties:

Key Valuename gender

ordered falseunique false

lowerBound 1eType -//Gender

defaultValueLiteral

2.6.2 Individual:family

In the tree view, right click on the node EClass ”Individual” Create a newEReference named ”family” and set its properties:

Key Valuename family

unique falselowerBound 1

eType -//FamilyeOpposite -//Family/individuals

2.6.3 Individual:Father

In the tree view, right click on the node EClass ”Individual” Create a newEReference named ”Father” and set its properties:

Key Valuename Father

eType -//Individual

6

Page 7: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

2.6.4 Individual:name

In the tree view, right click on the node EClass ”Individual” Create a newEAttribute named ”name” and set its properties:

Key Valuename name

eType EString

2.6.5 Individual:Mother

In the tree view, right click on the node EClass ”Individual” Create a newEReference named ”Mother” and set its properties:

Key Valuename Mother

eType -//Individual

2.6.6 Individual:samples

In the tree view, right click on the node EClass ”Individual” Create a newEReference named ”samples” and set its properties:

Key Valuename samples

upperBound -1 (unbounded)eType -//Sample

containment trueeOpposite -//Sample/individual

2.7 Sequencer

In the tree view, select the node EClass ”Lims” and set the following prop-erties:

Key Valuename Sequencer

We add some structural features to the EClass ”Sequencer”:

7

Page 8: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

2.7.1 Sequencer:name

In the tree view, right click on the node EClass ”Sequencer” Create a newEAttribute named ”name” and set its properties:

Key Valuename name

lowerBound 1eType EString

2.7.2 Sequencer:runs

In the tree view, right click on the node EClass ”Sequencer” Create a newEReference named ”runs” and set its properties:

Key Valuename runs

upperBound -1 (unbounded)eType -//Run

containment trueeOpposite -//Run/sequencer

2.7.3 Sequencer:laboratory

In the tree view, right click on the node EClass ”Sequencer” Create a newEReference named ”laboratory” and set its properties:

Key Valuename laboratory

lowerBound 1eType -//Laboratory

eOpposite -//Laboratory/sequencers

2.8 Run

In the tree view, select the node EClass ”Lims” and set the following prop-erties:

Key Valuename Run

We add some structural features to the EClass ”Run”:

8

Page 9: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

2.8.1 Run:name

In the tree view, right click on the node EClass ”Run” Create a new EAt-tribute named ”name” and set its properties:

Key Valuename name

lowerBound 1eType EString

2.8.2 Run:date

In the tree view, right click on the node EClass ”Run” Create a new EAt-tribute named ”date” and set its properties:

Key Valuename date

unique falseeType EDate

2.8.3 Run:sequenced

In the tree view, right click on the node EClass ”Run” Create a new ERef-erence named ”sequenced” and set its properties:

Key Valuename sequenced

upperBound -1 (unbounded)eType -//Sequenced

containment trueeOpposite -//Sequenced/run

2.8.4 Run:sequencer

In the tree view, right click on the node EClass ”Run” Create a new ERef-erence named ”sequencer” and set its properties:

Key Valuename sequencer

lowerBound 1eType -//Sequencer

eOpposite -//Sequencer/runs

9

Page 10: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

2.9 Sample

In the tree view, select the node EClass ”Lims” and set the following prop-erties:

Key Valuename Sample

We add some structural features to the EClass ”Sample”:

2.9.1 Sample:id

In the tree view, right click on the node EClass ”Sample” Create a newEAttribute named ”id” and set its properties:

Key Valuename id

lowerBound 1eType EString

2.9.2 Sample:individual

In the tree view, right click on the node EClass ”Sample” Create a newEReference named ”individual” and set its properties:

Key Valuename individual

lowerBound 1eType -//Individual

eOpposite -//Individual/samples

2.10 Sequenced

In the tree view, select the node EClass ”Lims” and set the following prop-erties:

Key Valuename Sequenced

We add some structural features to the EClass ”Sequenced”:

10

Page 11: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

2.10.1 Sequenced:run

In the tree view, right click on the node EClass ”Sequenced” Create a newEReference named ”run” and set its properties:

Key Valuename run

unique falselowerBound 1

eType -//RuneOpposite -//Run/sequenced

2.10.2 Sequenced:sample

In the tree view, right click on the node EClass ”Sequenced” Create a newEReference named ”sample” and set its properties:

Key Valuename sample

unique falselowerBound 1

eType -//Sample

All in one, the file lims.ecore looks like this:

1 <?xml version=” 1 .0 ” encoding=”UTF−8”?>2 <ecore :EPackage xmi :ve r s i on=” 2 .0 ”3 xmlns:xmi=” h t t p : //www. omg . org /XMI” xmlns :x s i=” h t t p : //

www. w3 . org /2001/XMLSchema−i n s t anc e ”4 xmlns : ecore=” h t t p : //www. e c l i p s e . org /emf /2002/ Ecore ”

name=”Lims”5 nsURI=” h t t p : // univ−nantes . f r / l ims /” nsPre f i x=” l ims ”>6 <e C l a s s i f i e r s x s i : t y p e=”ecore:EEnum” name=”Gender”>7 <e L i t e r a l s name=”UNKNOWN” l i t e r a l=”UNKNOWN”/>8 <e L i t e r a l s name=”MALE” value=”1” l i t e r a l=”MALE”/>9 <e L i t e r a l s name=”FEMALE” value=”2” l i t e r a l=”FEMALE”/>

10 </ e C l a s s i f i e r s>11 <e C l a s s i f i e r s x s i : t y p e=” eco r e :ECla s s ” name=”Family”>12 <eS t ruc tu ra lFea tu r e s x s i : t y p e=” eco r e :EAtt r ibu t e ” name

=”name” lowerBound=”1” eType=”ecore:EDataTypeh t t p : //www. e c l i p s e . org /emf /2002/ Ecore#//EString ”/>

13 <eS t ruc tu ra lFea tu r e s x s i : t y p e=” ecore :ERe f e r ence ” name=” i n d i v i d u a l s ” upperBound=”−1”

14 eType=”#//I n d i v i d u a l ” containment=” true ”eOpposite=”#//I n d i v i d u a l / fami ly ”/>

11

Page 12: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

15 <eS t ruc tu ra lFea tu r e s x s i : t y p e=” ecore :ERe f e r ence ” name=” labora to ry ” lowerBound=”1”

16 eType=”#//Laboratory ” eOpposite=”#//Laboratory /f a m i l i e s ”/>

17 </ e C l a s s i f i e r s>18 <e C l a s s i f i e r s x s i : t y p e=” eco r e :ECla s s ” name=” Laboratory ”

>19 <eS t ruc tu ra lFea tu r e s x s i : t y p e=” ecore :ERe f e r ence ” name

=” f a m i l i e s ” upperBound=”−1”20 eType=”#//Family” containment=” true ” eOpposite=”

#//Family/ l abora to ry ”/>21 <eS t ruc tu ra lFea tu r e s x s i : t y p e=” ecore :ERe f e r ence ” name

=” sequencer s ” upperBound=”−1”22 eType=”#//Sequencer ” containment=” true ” eOpposite

=”#//Sequencer / l abo ra to ry ”/>23 </ e C l a s s i f i e r s>24 <e C l a s s i f i e r s x s i : t y p e=” eco r e :ECla s s ” name=” I n d i v i d u a l ”

>25 <eS t ruc tu ra lFea tu r e s x s i : t y p e=” eco r e :EAtt r ibu t e ” name

=” gender ” ordered=” f a l s e ”26 unique=” f a l s e ” lowerBound=”1” eType=”#//Gender”

d e f a u l t V a l u e L i t e r a l=””/>27 <eS t ruc tu ra lFea tu r e s x s i : t y p e=” ecore :ERe f e r ence ” name

=” fami ly ” unique=” f a l s e ”28 lowerBound=”1” eType=”#//Family” eOpposite=”#//

Family/ i n d i v i d u a l s ”/>29 <eS t ruc tu ra lFea tu r e s x s i : t y p e=” ecore :ERe f e r ence ” name

=” Father ” eType=”#//I n d i v i d u a l ”/>30 <eS t ruc tu ra lFea tu r e s x s i : t y p e=” eco r e :EAtt r ibu t e ” name

=”name” eType=”ecore:EDataType h t t p : //www. e c l i p s e .org /emf /2002/ Ecore#//EString ”/>

31 <eS t ruc tu ra lFea tu r e s x s i : t y p e=” ecore :ERe f e r ence ” name=”Mother” eType=”#//I n d i v i d u a l ”/>

32 <eS t ruc tu ra lFea tu r e s x s i : t y p e=” ecore :ERe f e r ence ” name=” samples ” upperBound=”−1”

33 eType=”#//Sample” containment=” true ” eOpposite=”#//Sample/ i n d i v i d u a l ”/>

34 </ e C l a s s i f i e r s>35 <e C l a s s i f i e r s x s i : t y p e=” eco r e :ECla s s ” name=” Sequencer ”>36 <eS t ruc tu ra lFea tu r e s x s i : t y p e=” eco r e :EAtt r ibu t e ” name

=”name” lowerBound=”1” eType=”ecore:EDataTypeh t t p : //www. e c l i p s e . org /emf /2002/ Ecore#//EString ”/>

37 <eS t ruc tu ra lFea tu r e s x s i : t y p e=” ecore :ERe f e r ence ” name=” runs ” upperBound=”−1” eType=”#//Run”

38 containment=” true ” eOpposite=”#//Run/ sequencer ”/>

12

Page 13: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

39 <eS t ruc tu ra lFea tu r e s x s i : t y p e=” ecore :ERe f e r ence ” name=” labora to ry ” lowerBound=”1”

40 eType=”#//Laboratory ” eOpposite=”#//Laboratory /sequencer s ”/>

41 </ e C l a s s i f i e r s>42 <e C l a s s i f i e r s x s i : t y p e=” eco r e :ECla s s ” name=”Run”>43 <eS t ruc tu ra lFea tu r e s x s i : t y p e=” eco r e :EAtt r ibu t e ” name

=”name” lowerBound=”1” eType=”ecore:EDataTypeh t t p : //www. e c l i p s e . org /emf /2002/ Ecore#//EString ”/>

44 <eS t ruc tu ra lFea tu r e s x s i : t y p e=” eco r e :EAtt r ibu t e ” name=” date ” unique=” f a l s e ” eType=” ecore:EDataTypeh t t p : //www. e c l i p s e . org /emf /2002/ Ecore#//EDate”/>

45 <eS t ruc tu ra lFea tu r e s x s i : t y p e=” ecore :ERe f e r ence ” name=” sequenced ” upperBound=”−1”

46 eType=”#//Sequenced” containment=” true ” eOpposite=”#//Sequenced/run”/>

47 <eS t ruc tu ra lFea tu r e s x s i : t y p e=” ecore :ERe f e r ence ” name=” sequencer ” lowerBound=”1”

48 eType=”#//Sequencer ” eOpposite=”#//Sequencer / runs”/>

49 </ e C l a s s i f i e r s>50 <e C l a s s i f i e r s x s i : t y p e=” eco r e :ECla s s ” name=”Sample”>51 <eS t ruc tu ra lFea tu r e s x s i : t y p e=” eco r e :EAtt r ibu t e ” name

=” id ” lowerBound=”1” eType=”ecore:EDataType h t t p ://www. e c l i p s e . org /emf /2002/ Ecore#//EString ”/>

52 <eS t ruc tu ra lFea tu r e s x s i : t y p e=” ecore :ERe f e r ence ” name=” i n d i v i d u a l ” lowerBound=”1”

53 eType=”#//I n d i v i d u a l ” eOpposite=”#//I n d i v i d u a l /samples ”/>

54 </ e C l a s s i f i e r s>55 <e C l a s s i f i e r s x s i : t y p e=” eco r e :ECla s s ” name=”Sequenced”>56 <eS t ruc tu ra lFea tu r e s x s i : t y p e=” ecore :ERe f e r ence ” name

=”run” unique=” f a l s e ” lowerBound=”1”57 eType=”#//Run” eOpposite=”#//Run/ sequenced ”/>58 <eS t ruc tu ra lFea tu r e s x s i : t y p e=” ecore :ERe f e r ence ” name

=”sample” unique=” f a l s e ”59 lowerBound=”1” eType=”#//Sample”/>60 </ e C l a s s i f i e r s>61 </ ecore :EPackage>

3 GenModel

We’re going to generate the Genmodel for our model. The Genmodelcontains additional information for the codegeneration, e.g. the path and file

13

Page 14: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

information.

3.1 Create the GenModel Project

• Menu File → New → New Project... → EMF Generator Project

• Select the folder EMF03-Model/model

• Set the file name to lims.genmodel

• select a "Model Importer": "Ecore model"

• import the model ”URI: platform:/resource/EMF03/model/lims.ecore”

3.2 Edit the GenModel Project

In the tree view of the Genmodel, click on the root node and edit itsproperties:

• set All → Runtime Platform → to ”RCP”.

click on the package node ’Lims’ and edit its properties:

• set All → BasePackage → to ”com.github.lindenb.lims”.

1 <?xml version=” 1 .0 ” encoding=”UTF−8”?>2 <genmodel:GenModel xmi :ve r s i on=” 2 .0 ”3 xmlns:xmi=” h t t p : //www. omg . org /XMI” xmlns : ecore=” h t tp :

//www. e c l i p s e . org /emf /2002/ Ecore ”4 xmlns:genmodel=” h t t p : //www. e c l i p s e . org /emf /2002/

GenModel” copyr ightText=” P i e r r e Lindenbaum PhD2013”

5 modelDirectory=”/EMF03/ s r c ” modelPluginID=”EMF03”modelName=”Lims” importerID=” org . e c l i p s e . emf .importer . e co re ”

6 compl ianceLeve l=” 6 .0 ” c o p y r i g h t F i e l d s=” f a l s e ”language=”en” classNamePattern=””

7 runtimePlatform=”RCP”>8 <fore ignModel>l ims . e co re</ fore ignModel>9 <genPackages p r e f i x=”Lims” basePackage=”com . github .

l indenb . l ims ” d i sposab l eProv ide rFacto ry=” true ”10 ecorePackage=” l ims . e co re#/”>11 <genEnums typeSafeEnumCompatible=” f a l s e ” ecoreEnum=”

l ims . eco re#//Gender”>12 <genEnumLiterals ecoreEnumLiteral=” l ims . e co re#//

Gender/UNKNOWN”/>13 <genEnumLiterals ecoreEnumLiteral=” l ims . e co re#//

Gender/MALE”/>

14

Page 15: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

14 <genEnumLiterals ecoreEnumLiteral=” l ims . e co re#//Gender/FEMALE”/>

15 </genEnums>16 <genClasse s e co r eC la s s=” l ims . e co re#//Family”>17 <genFeatures c r ea t eCh i ld=” f a l s e ” ecoreFeature=”

eco r e :EAtt r ibut e l ims . e co re#//Family/name”/>18 <genFeatures property=”None” c h i l d r e n=” true ”

c r ea t eCh i ld=” true ” ecoreFeature=”ecore :ERe f e r ence l ims . e co re#//Family/ i n d i v i d u a l s”/>

19 <genFeatures property=”None” n o t i f y=” f a l s e ”c r ea t eCh i ld=” f a l s e ” ecoreFeature=”ecore :ERe f e r ence l ims . e co re#//Family/ l abo ra to ry ”/>

20 </ genClas se s>21 <genClasse s e co r eC la s s=” l ims . e co re#//Laboratory ”>22 <genFeatures property=”None” c h i l d r e n=” true ”

c r ea t eCh i ld=” true ” ecoreFeature=”ecore :ERe f e r ence l ims . e co re#//Laboratory /f a m i l i e s ”/>

23 <genFeatures property=”None” c h i l d r e n=” true ”c r ea t eCh i ld=” true ” ecoreFeature=”ecore :ERe f e r ence l ims . e co re#//Laboratory /sequencer s ”/>

24 </ genClas se s>25 <genClasse s e co r eC la s s=” l ims . e co re#//I n d i v i d u a l ”>26 <genFeatures c r ea t eCh i ld=” f a l s e ” ecoreFeature=”

eco r e :EAtt r ibut e l ims . e co re#//I n d i v i d u a l / gender ”/>

27 <genFeatures property=”None” n o t i f y=” f a l s e ”c r ea t eCh i ld=” f a l s e ” ecoreFeature=”ecore :ERe f e r ence l ims . e co re#//I n d i v i d u a l / fami ly ”/>

28 <genFeatures n o t i f y=” f a l s e ” c r ea t eCh i ld=” f a l s e ”proper tySortCho ices=” true ” ecoreFeature=”ecore :ERe f e r ence l ims . e co re#//I n d i v i d u a l / Father ”/>

29 <genFeatures c r ea t eCh i ld=” f a l s e ” ecoreFeature=”eco r e :EAtt r ibut e l ims . e co re#//I n d i v i d u a l /name”/>

30 <genFeatures n o t i f y=” f a l s e ” c r ea t eCh i ld=” f a l s e ”proper tySortCho ices=” true ” ecoreFeature=”ecore :ERe f e r ence l ims . e co re#//I n d i v i d u a l /Mother”/>

31 <genFeatures property=”None” c h i l d r e n=” true ”c r ea t eCh i ld=” true ” ecoreFeature=”ecore :ERe f e r ence l ims . e co re#//I n d i v i d u a l / samples

15

Page 16: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

”/>32 </ genClas se s>33 <genClasse s e co r eC la s s=” l ims . e co re#//Sequencer ”>34 <genFeatures n o t i f y=” f a l s e ” c r ea t eCh i ld=” f a l s e ”

prope r tyDesc r ip t i on=”” ecoreFeature=”eco r e :EAtt r ibut e l ims . e co re#//Sequencer /name”/>

35 <genFeatures property=”None” c h i l d r e n=” true ”c r ea t eCh i ld=” true ” ecoreFeature=”ecore :ERe f e r ence l ims . e co re#//Sequencer / runs ”/>

36 <genFeatures property=”None” n o t i f y=” f a l s e ”c r ea t eCh i ld=” f a l s e ” ecoreFeature=”ecore :ERe f e r ence l ims . e co re#//Sequencer /l abora to ry ”/>

37 </ genClas se s>38 <genClasse s e co r eC la s s=” l ims . e co re#//Run”>39 <genFeatures c r ea t eCh i ld=” f a l s e ” ecoreFeature=”

eco r e :EAtt r ibut e l ims . e co re#//Run/name”/>40 <genFeatures c r ea t eCh i ld=” f a l s e ” ecoreFeature=”

eco r e :EAtt r ibut e l ims . e co re#//Run/ date ”/>41 <genFeatures property=”None” c h i l d r e n=” true ”

c r ea t eCh i ld=” true ” ecoreFeature=”ecore :ERe f e r ence l ims . e co re#//Run/ sequenced ”/>

42 <genFeatures property=”None” c h i l d r e n=” true ”c r ea t eCh i ld=” true ” ecoreFeature=”ecore :ERe f e r ence l ims . e co re#//Run/ sequencer ”/>

43 </ genClas se s>44 <genClasse s e co r eC la s s=” l ims . e co re#//Sample”>45 <genFeatures c r ea t eCh i ld=” f a l s e ” ecoreFeature=”

eco r e :EAtt r ibut e l ims . e co re#//Sample/ id ”/>46 <genFeatures property=”None” n o t i f y=” f a l s e ”

c r ea t eCh i ld=” f a l s e ” ecoreFeature=”ecore :ERe f e r ence l ims . e co re#//Sample/ i n d i v i d u a l ”/>

47 </ genClas se s>48 <genClasse s e co r eC la s s=” l ims . e co re#//Sequenced”>49 <genFeatures n o t i f y=” f a l s e ” c r ea t eCh i ld=” f a l s e ”

proper tySortCho ices=” true ” ecoreFeature=”ecore :ERe f e r ence l ims . e co re#//Sequenced/run”/>

50 <genFeatures n o t i f y=” f a l s e ” c r ea t eCh i ld=” f a l s e ”proper tySortCho ices=” true ” ecoreFeature=”ecore :ERe f e r ence l ims . e co re#//Sequenced/ sample”/>

51 </ genClas se s>52 </ genPackages>53 </genmodel:GenModel>

16

Page 17: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

4 Generating the code

In the tree view of the Genmodel, right click the root node: Generate All :four new Eclipse plugins have been created:

• Model: contains the classes to create the instances of our model.

• EMF03.edit : classes to display a model in a UI (labels... )

• EMF03.editor: The editor plugin is a generated example editor to createand modify instances of a model.

• EMF03.tests: The test plugin contains templates to write tests for amodel.

Here is an example of the interface com.github.lindenb.lims.Lims.Familygenerated by EMF:

1 package com . github . l indenb . l ims . Lims ;23 import org . e c l i p s e . emf . common . u t i l . EList ;45 import org . e c l i p s e . emf . ecore . EObject ;67 /∗∗8 ∗ A r e p r e s e n t a t i o n o f t h e mod e l o b j e c t ’<em><b>Fami l y </b></em> ’ .9 ∗

10 ∗ The f o l l o w i n g f e a t u r e s a r e s u p p o r t e d :11 ∗ <u l>12 ∗ < l i >{@ l i n k com . g i t h u b . l i n d e n b . l i m s . Lims . F am i l y#ge tName <em>Name</em>}</ l i >13 ∗ < l i >{@ l i n k com . g i t h u b . l i n d e n b . l i m s . Lims . F am i l y# g e t I n d i v i d u a l s <em>I n d i v i d u a l s </

em>}</ l i >14 ∗ < l i >{@ l i n k com . g i t h u b . l i n d e n b . l i m s . Lims . F am i l y#g e t L a b o r a t o r y <em>L a b o r a t o r y </em

>}</ l i >15 ∗ </u l>16 ∗17 ∗ @see com . g i t h u b . l i n d e n b . l i m s . Lims . L im sPa c k a g e#g e t F am i l y ( )18 ∗ @mode l19 ∗ @g e n e r a t e d20 ∗/21 public interface Family extends EObject22 {23 /∗∗24 ∗ Re t u r n s t h e v a l u e o f t h e ’<em><b>Name</b></em>’ a t t r i b u t e .25 ∗ I f t h e mean in g o f t h e ’<em>Name</em>’ a t t r i b u t e i s n ’ t c l e a r ,26 ∗ t h e r e r e a l l y s h o u l d b e more o f a d e s c r i p t i o n h e r e . . .27 ∗ @r e t u r n t h e v a l u e o f t h e ’<em>Name</em>’ a t t r i b u t e .28 ∗ @see #se tName ( S t r i n g )29 ∗ @see com . g i t h u b . l i n d e n b . l i m s . Lims . L im sPa c k a g e#g e t F am i l y N ame ( )30 ∗ @mode l r e q u i r e d =” t r u e ”31 ∗ @g e n e r a t e d32 ∗/33 St r ing getName ( ) ;3435 /∗∗36 ∗ S e t s t h e v a l u e o f t h e ’{ @ l i n k com . g i t h u b . l i n d e n b . l i m s . Lims . F am i l y#ge tName

<em>Name</em>}’ a t t r i b u t e .37 ∗ @param v a l u e t h e new v a l u e o f t h e ’<em>Name</em>’ a t t r i b u t e .38 ∗ @see #ge tName ( )39 ∗ @g e n e r a t e d40 ∗/41 void setName ( St r ing value ) ;4243 /∗∗44 ∗ Re t u r n s t h e v a l u e o f t h e ’<em><b>I n d i v i d u a l s </b></em>’ c o n t a i nm e n t

r e f e r e n c e l i s t .45 ∗ The l i s t c o n t e n t s a r e o f t y p e {@ l i n k com . g i t h u b . l i n d e n b . l i m s . Lims .

I n d i v i d u a l } .46 ∗ I t i s b i d i r e c t i o n a l and i t s o p p o s i t e i s ’{ @ l i n k com . g i t h u b . l i n d e n b . l i m s .

Lims . I n d i v i d u a l#g e t F am i l y <em>Fami l y </em>} ’ .47 ∗ I f t h e mean in g o f t h e ’<em>I n d i v i d u a l s </em>’ c o n t a i nm e n t r e f e r e n c e l i s t

i s n ’ t c l e a r ,48 ∗ t h e r e r e a l l y s h o u l d b e more o f a d e s c r i p t i o n h e r e . . .49 ∗ @r e t u r n t h e v a l u e o f t h e ’<em>I n d i v i d u a l s </em>’ c o n t a i nm e n t r e f e r e n c e

l i s t .50 ∗ @see com . g i t h u b . l i n d e n b . l i m s . Lims . L im sPa c k a g e# g e t F a m i l y I n d i v i d u a l s ( )51 ∗ @see com . g i t h u b . l i n d e n b . l i m s . Lims . I n d i v i d u a l#g e t F am i l y52 ∗ @mode l o p p o s i t e =” f a m i l y ” c o n t a i nm e n t =” t r u e ”

17

Page 18: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

53 ∗ @g e n e r a t e d54 ∗/55 EList<Ind iv idua l> g e t I nd i v i dua l s ( ) ;5657 /∗∗58 ∗ Re t u r n s t h e v a l u e o f t h e ’<em><b>L a b o r a t o r y </b></em>’ c o n t a i n e r r e f e r e n c e

.59 ∗ I t i s b i d i r e c t i o n a l and i t s o p p o s i t e i s ’{ @ l i n k com . g i t h u b . l i n d e n b . l i m s .

Lims . L a b o r a t o r y#g e t F a m i l i e s <em>F am i l i e s </em>} ’ .60 ∗ I f t h e mean in g o f t h e ’<em>L a b o r a t o r y </em>’ c o n t a i n e r r e f e r e n c e i s n ’ t

c l e a r ,61 ∗ t h e r e r e a l l y s h o u l d b e more o f a d e s c r i p t i o n h e r e . . .62 ∗ @r e t u r n t h e v a l u e o f t h e ’<em>L a b o r a t o r y </em>’ c o n t a i n e r r e f e r e n c e .63 ∗ @see #s e t L a b o r a t o r y ( L a b o r a t o r y )64 ∗ @see com . g i t h u b . l i n d e n b . l i m s . Lims . L im sPa c k a g e#g e t F a m i l y L a b o r a t o r y ( )65 ∗ @see com . g i t h u b . l i n d e n b . l i m s . Lims . L a b o r a t o r y#g e t F a m i l i e s66 ∗ @mode l o p p o s i t e =” f a m i l i e s ” r e q u i r e d =” t r u e ” t r a n s i e n t =” f a l s e ”67 ∗ @g e n e r a t e d68 ∗/69 Laboratory getLaboratory ( ) ;7071 /∗∗72 ∗ S e t s t h e v a l u e o f t h e ’{ @ l i n k com . g i t h u b . l i n d e n b . l i m s . Lims . F am i l y#

g e t L a b o r a t o r y <em>L a b o r a t o r y </em>}’ c o n t a i n e r r e f e r e n c e .73 ∗ @param v a l u e t h e new v a l u e o f t h e ’<em>L a b o r a t o r y </em>’ c o n t a i n e r

r e f e r e n c e .74 ∗ @see #g e t L a b o r a t o r y ( )75 ∗ @g e n e r a t e d76 ∗/77 void setLaboratory ( Laboratory value ) ;7879 } // Fam i l y

and the implementation of the interface: com.github.lindenb.lims.Lims.impl.FamilyImpl:

1 package com . github . l indenb . l ims . Lims . impl ;23 import com . github . l indenb . l ims . Lims . Family ;4 import com . github . l indenb . l ims . Lims . Ind iv idua l ;5 import com . github . l indenb . l ims . Lims . Laboratory ;6 import com . github . l indenb . l ims . Lims . LimsPackage ;78 import java . u t i l . Co l l e c t i on ;9

10 import org . e c l i p s e . emf . common . no t i f y . No t i f i c a t i o n ;11 import org . e c l i p s e . emf . common . no t i f y . Not i f i ca t i onCha in ;1213 import org . e c l i p s e . emf . common . u t i l . EList ;1415 import org . e c l i p s e . emf . ecore . EClass ;16 import org . e c l i p s e . emf . ecore . Interna lEObject ;1718 import org . e c l i p s e . emf . ecore . impl . ENot i f i ca t ionImpl ;19 import org . e c l i p s e . emf . ecore . impl . EObjectImpl ;2021 import org . e c l i p s e . emf . ecore . u t i l . EObjectContainmentWithInverseEList ;22 import org . e c l i p s e . emf . ecore . u t i l . EcoreUt i l ;23 import org . e c l i p s e . emf . ecore . u t i l . I n t e rna lEL i s t ;2425 /∗∗26 ∗ An i m p l e m e n t a t i o n o f t h e mod e l o b j e c t ’<em><b>Fami l y </b></em> ’ .27 ∗ The f o l l o w i n g f e a t u r e s a r e im p l em e n t e d :28 ∗ <u l>29 ∗ < l i >{@ l i n k com . g i t h u b . l i n d e n b . l i m s . Lims . im p l . F am i l y Im p l#ge tName <em>Name</em

>}</ l i >30 ∗ < l i >{@ l i n k com . g i t h u b . l i n d e n b . l i m s . Lims . im p l . F am i l y Im p l# g e t I n d i v i d u a l s <em>

I n d i v i d u a l s </em>}</ l i >31 ∗ < l i >{@ l i n k com . g i t h u b . l i n d e n b . l i m s . Lims . im p l . F am i l y Im p l#g e t L a b o r a t o r y <em>

L a b o r a t o r y </em>}</ l i >32 ∗ </u l>33 ∗34 ∗ @g e n e r a t e d35 ∗/36 public c lass FamilyImpl extends EObjectImpl implements Family37 {38 /∗∗39 ∗ The d e f a u l t v a l u e o f t h e ’{ @ l i n k #ge tName ( ) <em>Name</em>}’ a t t r i b u t e .40 ∗ @see #ge tName ( )41 ∗ @g e n e r a t e d42 ∗ @o r d e r e d43 ∗/44 protected stat ic f ina l Str ing NAME EDEFAULT = null ;4546 /∗∗47 ∗ The c a c h e d v a l u e o f t h e ’{ @ l i n k #ge tName ( ) <em>Name</em>}’ a t t r i b u t e .48 ∗ @see #ge tName ( )49 ∗ @g e n e r a t e d

18

Page 19: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

50 ∗ @o r d e r e d51 ∗/52 protected Str ing name = NAME EDEFAULT;5354 /∗∗55 ∗ The c a c h e d v a l u e o f t h e ’{ @ l i n k # g e t I n d i v i d u a l s ( ) <em>I n d i v i d u a l s </em>}’

c o n t a i nm e n t r e f e r e n c e l i s t .56 ∗ @see # g e t I n d i v i d u a l s ( )57 ∗ @g e n e r a t e d58 ∗ @o r d e r e d59 ∗/60 protected EList<Ind iv idua l> i n d i v i dua l s ;6162 /∗∗63 ∗ @g e n e r a t e d64 ∗/65 protected FamilyImpl ( )66 {67 super ( ) ;68 }6970 /∗∗71 ∗ @g e n e r a t e d72 ∗/73 @Override74 protected EClass eS t a t i cC l a s s ( )75 {76 return LimsPackage . L i t e r a l s .FAMILY;77 }7879 /∗∗80 ∗ @g e n e r a t e d81 ∗/82 public Str ing getName ( )83 {84 return name ;85 }8687 /∗∗88 ∗ @g e n e r a t e d89 ∗/90 public void setName ( St r ing newName)91 {92 St r ing oldName = name ;93 name = newName ;94 i f ( eNot i f i c a t i onRequ i r ed ( ) )95 eNot i fy (new ENot i f i ca t ionImpl ( this , N o t i f i c a t i o n .SET,

LimsPackage .FAMILY NAME, oldName , name) ) ;96 }9798 /∗∗99 ∗ @g e n e r a t e d

100 ∗/101 public EList<Ind iv idua l> g e t I nd i v i dua l s ( )102 {103 i f ( i nd i v i dua l s == null )104 {105 i nd i v i dua l s = new EObjectContainmentWithInverseEList<

Ind iv idua l >( Ind iv idua l . class , this , LimsPackage .FAMILY INDIVIDUALS , LimsPackage . INDIVIDUAL FAMILY) ;

106 }107 return i n d i v i dua l s ;108 }109110 /∗∗111 ∗ @g e n e r a t e d112 ∗/113 public Laboratory getLaboratory ( )114 {115 i f ( eContainerFeatureID ( ) != LimsPackage .FAMILY LABORATORY) return

null ;116 return ( Laboratory ) eContainer ( ) ;117 }118119 /∗∗120 ∗ @g e n e r a t e d121 ∗/122 public Not i f i ca t i onCha in bas icSetLaboratory ( Laboratory newLaboratory ,

Not i f i ca t i onCha in msgs )123 {124 msgs = eBas icSetConta iner ( ( Interna lEObject ) newLaboratory ,

LimsPackage .FAMILY LABORATORY, msgs ) ;125 return msgs ;126 }127128 /∗∗129 ∗ @g e n e r a t e d130 ∗/131 public void setLaboratory ( Laboratory newLaboratory )132 {

19

Page 20: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

133 i f ( newLaboratory != e Inte rna lConta ine r ( ) | | ( eContainerFeatureID ( )!= LimsPackage .FAMILY LABORATORY && newLaboratory != null ) )

134 {135 i f ( EcoreUt i l . i sAnces to r ( this , newLaboratory ) )136 throw new I l l ega lArgumentExcept ion ( ”Recurs ive

containment not al lowed f o r ” + toSt r ing ( ) ) ;137 Not i f i ca t i onCha in msgs = null ;138 i f ( e In te rna lConta ine r ( ) != null )139 msgs = eBasicRemoveFromContainer (msgs ) ;140 i f ( newLaboratory != null )141 msgs = ( ( Interna lEObject ) newLaboratory ) . eInverseAdd (

this , LimsPackage .LABORATORY FAMILIES,Laboratory . class , msgs ) ;

142 msgs = bas icSetLaboratory ( newLaboratory , msgs ) ;143 i f (msgs != null ) msgs . d i spatch ( ) ;144 }145 else i f ( eNot i f i c a t i onRequ i r ed ( ) )146 eNot i fy (new ENot i f i ca t ionImpl ( this , N o t i f i c a t i o n .SET,

LimsPackage .FAMILY LABORATORY, newLaboratory ,newLaboratory ) ) ;

147 }148149 /∗∗150 ∗ @g e n e r a t e d151 ∗/152 @SuppressWarnings ( ”unchecked” )153 @Override154 public Not i f i ca t i onCha in eInverseAdd ( Interna lEObject otherEnd , int featureID

, Not i f i ca t i onCha in msgs )155 {156 switch ( f eature ID )157 {158 case LimsPackage . FAMILY INDIVIDUALS :159 return ( ( Inte rna lELi s t<InternalEObject >)(

Inte rna lELi s t <?>)g e t I nd i v i dua l s ( ) ) . basicAdd (otherEnd , msgs ) ;

160 case LimsPackage .FAMILY LABORATORY:161 i f ( e In te rna lConta ine r ( ) != null )162 msgs = eBasicRemoveFromContainer (msgs ) ;163 return bas icSetLaboratory ( ( Laboratory ) otherEnd , msgs

) ;164 }165 return super . eInverseAdd ( otherEnd , featureID , msgs ) ;166 }167168 /∗∗169 ∗ @g e n e r a t e d170 ∗/171 @Override172 public Not i f i ca t i onCha in eInverseRemove ( Interna lEObject otherEnd , int

featureID , Not i f i ca t i onCha in msgs )173 {174 switch ( f eature ID )175 {176 case LimsPackage . FAMILY INDIVIDUALS :177 return ( ( Inte rna lELi s t <?>)g e t I nd i v i dua l s ( ) ) .

basicRemove ( otherEnd , msgs ) ;178 case LimsPackage .FAMILY LABORATORY:179 return bas icSetLaboratory ( null , msgs ) ;180 }181 return super . eInverseRemove ( otherEnd , featureID , msgs ) ;182 }183184 /∗∗185 ∗ @g e n e r a t e d186 ∗/187 @Override188 public Not i f i ca t i onCha in eBasicRemoveFromContainerFeature ( Not i f i ca t i onCha in

msgs )189 {190 switch ( eContainerFeatureID ( ) )191 {192 case LimsPackage .FAMILY LABORATORY:193 return e In te rna lConta ine r ( ) . eInverseRemove ( this ,

LimsPackage .LABORATORY FAMILIES, Laboratory .class , msgs ) ;

194 }195 return super . eBasicRemoveFromContainerFeature (msgs ) ;196 }197198 /∗∗199 ∗ @g e n e r a t e d200 ∗/201 @Override202 public Object eGet ( int featureID , boolean r e so lve , boolean coreType )203 {204 switch ( f eature ID )205 {206 case LimsPackage .FAMILY NAME:207 return getName ( ) ;208 case LimsPackage . FAMILY INDIVIDUALS :

20

Page 21: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

209 return g e t I nd i v i dua l s ( ) ;210 case LimsPackage .FAMILY LABORATORY:211 return getLaboratory ( ) ;212 }213 return super . eGet ( featureID , r e so lve , coreType ) ;214 }215216 /∗∗217 ∗ @g e n e r a t e d218 ∗/219 @SuppressWarnings ( ”unchecked” )220 @Override221 public void eSet ( int featureID , Object newValue )222 {223 switch ( f eature ID )224 {225 case LimsPackage .FAMILY NAME:226 setName ( ( St r ing ) newValue ) ;227 return ;228 case LimsPackage . FAMILY INDIVIDUALS :229 g e t I nd i v i dua l s ( ) . c l e a r ( ) ;230 g e t I nd i v i dua l s ( ) . addAll ( ( Co l l e c t i on <? extends

Ind iv idua l >)newValue ) ;231 return ;232 case LimsPackage .FAMILY LABORATORY:233 setLaboratory ( ( Laboratory ) newValue ) ;234 return ;235 }236 super . eSet ( featureID , newValue ) ;237 }238239 /∗∗240 ∗ @g e n e r a t e d241 ∗/242 @Override243 public void eUnset ( int f eature ID )244 {245 switch ( f eature ID )246 {247 case LimsPackage .FAMILY NAME:248 setName (NAME EDEFAULT) ;249 return ;250 case LimsPackage . FAMILY INDIVIDUALS :251 g e t I nd i v i dua l s ( ) . c l e a r ( ) ;252 return ;253 case LimsPackage .FAMILY LABORATORY:254 setLaboratory ( ( Laboratory ) null ) ;255 return ;256 }257 super . eUnset ( f eature ID ) ;258 }259260 /∗∗261 ∗ @g e n e r a t e d262 ∗/263 @Override264 public boolean e I sS e t ( int f eature ID )265 {266 switch ( f eature ID )267 {268 case LimsPackage .FAMILY NAME:269 return NAME EDEFAULT == null ? name != null : !

NAME EDEFAULT. equa l s (name) ;270 case LimsPackage . FAMILY INDIVIDUALS :271 return i n d i v i dua l s != null && ! i nd i v i dua l s . isEmpty ( )

;272 case LimsPackage .FAMILY LABORATORY:273 return getLaboratory ( ) != null ;274 }275 return super . e I sS e t ( f eature ID ) ;276 }277278 /∗∗279 ∗ @g e n e r a t e d280 ∗/281 @Override282 public Str ing toSt r ing ( )283 {284 i f ( eIsProxy ( ) ) return super . t oS t r ing ( ) ;285286 St r ingBu f f e r r e s u l t = new St r ingBu f f e r ( super . t oS t r ing ( ) ) ;287 r e s u l t . append ( ” (name : ” ) ;288 r e s u l t . append (name) ;289 r e s u l t . append ( ’ ) ’ ) ;290 return r e s u l t . t oS t r ing ( ) ;291 }292293 } // F am i l y Im p l

21

Page 22: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

5 Create a new eclipse product

• Menu File → New → Other... → Product Configuration

• Wizard: set parent folder: EMF03/model

• Wizard: set the file name: ”lims.product”.

• Wizard: Ask to create a basic config

Open the editor for ’lims.product”.

• in Overview/Product Definition/Product → create a new product .

Defining plugin :”EMF03”, product ID : ”lims”, Application : "EMF03.editor.LimsEditorEditorAdvisorApplication".

• in Depedencies/Plugins and fragments: add EMF03, EMF03.edit, EMF03.editor

• check "include optional dependencies"

• click "Add required plug-in"

• in Lauching/Program Launcher set Launcher Name to ”lims”.

The content of the product file is displayed below:

1 <?xml version=” 1 .0 ” encoding=”UTF−8”?>2 <?pde version=” 3 .5 ”?>34 <product name=”Lims” uid=”LIMS” id=”EMF03. l ims ”

a p p l i c a t i o n=”EMF03. e d i t o r . L imsEditorAdvisorAppl icat ion” version=” 1 . 0 . 0 ” useFeatures=” f a l s e ” inc ludeLaunchers=” true ”>

56 <c o n f i g I n i use=” d e f a u l t ”>7 </ c o n f i g I n i>89 <launcherArgs>

10 <vmArgsMac>−XstartOnFirstThread −Dorg . e c l i p s e . swt .i n t e r n a l . carbon . smal lFonts</vmArgsMac>

11 </ launcherArgs>1213 <l auncher name=” l ims ”>14 < s o l a r i s />15 <win use I co=” f a l s e ”>16 <bmp/>17 </win>18 </ launcher>19

22

Page 23: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

20 <vm>21 </vm>2223 <p lug in s>24 <plug in id=”EMF03”/>25 <plug in id=”EMF03. e d i t ”/>26 <plug in id=”EMF03. e d i t o r ”/>27 <plug in id=”com . ibm . i cu ”/>28 <plug in id=” javax . s e r v l e t ”/>29 <plug in id=” javax . t r a n s a c t i o n ” fragment=” true ”/>30 <plug in id=” org . e c l i p s e . ant . core ”/>31 <plug in id=” org . e c l i p s e . core . commands”/>32 <plug in id=” org . e c l i p s e . core . contenttype ”/>33 <plug in id=” org . e c l i p s e . core . databinding ”/>34 <plug in id=” org . e c l i p s e . core . databinding . obse rvab l e

”/>35 <plug in id=” org . e c l i p s e . core . databinding . property ”/

>36 <plug in id=” org . e c l i p s e . core . e x p r e s s i o n s ”/>37 <plug in id=” org . e c l i p s e . core . f i l e s y s t e m ”/>38 <plug in id=” org . e c l i p s e . core . f i l e s y s t e m . l i nux . x86”

fragment=” true ”/>39 <plug in id=” org . e c l i p s e . core . j obs ”/>40 <plug in id=” org . e c l i p s e . core . r e s o u r c e s ”/>41 <plug in id=” org . e c l i p s e . core . runtime ”/>42 <plug in id=” org . e c l i p s e . core . runtime . c o m p a t i b i l i t y .

auth”/>43 <plug in id=” org . e c l i p s e . core . runtime . c o m p a t i b i l i t y .

r e g i s t r y ” fragment=” true ”/>44 <plug in id=” org . e c l i p s e . core . v a r i a b l e s ”/>45 <plug in id=” org . e c l i p s e . emf . common”/>46 <plug in id=” org . e c l i p s e . emf . common . u i ”/>47 <plug in id=” org . e c l i p s e . emf . e co re ”/>48 <plug in id=” org . e c l i p s e . emf . e co re . change”/>49 <plug in id=” org . e c l i p s e . emf . e co re . xmi”/>50 <plug in id=” org . e c l i p s e . emf . e d i t ”/>51 <plug in id=” org . e c l i p s e . emf . e d i t . u i ”/>52 <plug in id=” org . e c l i p s e . equinox . app”/>53 <plug in id=” org . e c l i p s e . equinox . common”/>54 <plug in id=” org . e c l i p s e . equinox . p2 . core ”/>55 <plug in id=” org . e c l i p s e . equinox . p2 . eng ine ”/>56 <plug in id=” org . e c l i p s e . equinox . p2 . metadata”/>57 <plug in id=” org . e c l i p s e . equinox . p2 . metadata .

r e p o s i t o r y ”/>58 <plug in id=” org . e c l i p s e . equinox . p2 . r e p o s i t o r y ”/>59 <plug in id=” org . e c l i p s e . equinox . p r e f e r e n c e s ”/>

23

Page 24: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

60 <plug in id=” org . e c l i p s e . equinox . r e g i s t r y ”/>61 <plug in id=” org . e c l i p s e . equinox . s e c u r i t y ”/>62 <plug in id=” org . e c l i p s e . he lp ”/>63 <plug in id=” org . e c l i p s e . j f a c e ”/>64 <plug in id=” org . e c l i p s e . j f a c e . databinding ”/>65 <plug in id=” org . e c l i p s e . j f a c e . t ex t ”/>66 <plug in id=” org . e c l i p s e . o s g i ”/>67 <plug in id=” org . e c l i p s e . o s g i . s e r v i c e s ”/>68 <plug in id=” org . e c l i p s e . swt”/>69 <plug in id=” org . e c l i p s e . swt . gtk . l i nux . x86” fragment

=” true ”/>70 <plug in id=” org . e c l i p s e . t ex t ”/>71 <plug in id=” org . e c l i p s e . u i ”/>72 <plug in id=” org . e c l i p s e . u i . forms ”/>73 <plug in id=” org . e c l i p s e . u i . i d e ”/>74 <plug in id=” org . e c l i p s e . u i . v iews ”/>75 <plug in id=” org . e c l i p s e . u i . workbench”/>76 </ p lug in s>777879 </ product>

6 Generating the Eclipse Product

• File → Export → Eclipse Product .

• Set configuration : ”EMF03/model/lims.product” .

• Set the destination directory .

• Uncheck "Generate metadata repository" .

• "Finish"

Congratulations, your client has been generated.

7 Running the Lims editor

Go to the generated application directory and run:

$ cd /path/ to /GENERATED$ . / l ims &

Here is a screenshot of the generated ’lims’ application:

24

Page 25: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

Here is an example of a data file handled by the ’lims’ application:

1 <?xml version=” 1 .0 ” encoding=”UTF−8”?>2 <l ims :Laboratory xmi :ve r s i on=” 2 .0 ” xmlns:xmi=” h t t p : //www.

omg . org /XMI” xmlns : l ims=” h t t p : // univ−nantes . f r / l ims /”>3 < f a m i l i e s name=”Family1”>4 < i n d i v i d u a l s name=” i n d i 1 ”/>5 < i n d i v i d u a l s Father=”// @fami l i e s . 0/ @ind iv idua l s . 0 ”

name=” in d i 2 ”>6 <samples id=”CD00001”/>7 </ i n d i v i d u a l s>8 </ f a m i l i e s>9 <s equencer s name=”HiSeq”>

10 <runs name=”CD1786CXX”>11 <sequenced sample=”// @fami l i e s . 0/ @ind iv idua l s . 1/

@samples . 0 ”/>12 </ runs>13 </ sequencer s>14 <s equencer s name=”miseq”>15 <runs name=”CXX01”>16 <sequenced sample=”// @fami l i e s . 0/ @ind iv idua l s . 1/

@samples . 0 ”/>17 </ runs>18 </ sequencer s>19 </ l ims :Laborato ry>

That’s it,Pierre

25

Page 26: Building a Simple LIMS with the Eclipse Modeling Framework (EMF) ,my notebook

8 References

• Source for this tutorial: https://github.com/lindenb/courses/tree/

master/about.emf

• The Eclipse Modeling Framework Overview : http://help.eclipse.

org/juno/index.jsp?topic=%2Forg.eclipse.emf.doc%2Freferences%

2Foverview%2FEMF.html

• Eclipse Modeling Framework (EMF) - Tutorial : http://www.vogella.

com/articles/EclipseEMF/article.html

26