EMF Search---Quick Start Guide
This quick start guide will explain :
- Steps to generate textual search infrastructure for arbitrary Ecore model (Here MoviesDb)
- Generated Code and relations to EMF Search framework architecture
- Explain Extensibility in context of this example
- Hints for code customizations
- 1 Quick Start
- 2 Generated Code Explained
This document intent to explain how to generate EMF Search infrastructure from arbitrary Ecore models mainly relying on user defined *.genmodel resources.
Following steps will be described :
- Resources retrieval from CVS
- Model Plugins Generation
- Search Infrastructure Generation Configuration
- Select textual features to consider
- Select infrastructure to generate : Core and/or UI
- Runtime Launch Configuration Setting
- Setup Environment Setting
- Create new project
- Copy sample data
- Generated Feature Integrity Verification
- Run a simple test query
- Verify results consistency
- Go back to editor by clicking
Eclipse Live Demo
Here are links to screencast & demos in case you don't like to read :
Movies DB Example Plugin CVS Retrieval
You first need org.eclipse.emf.search.tests plugin from CVS :
module : org.eclipse.emf/org.eclipse.emf.search/tests/org.eclipse.emf.search.tests
Directory structure needed for the example :
Generate Model, Edit & Editor
First step consist in generating MoviesDb Model, Edit, Editor plugins from GenModel Editor like any other usual EMF projects. (Eg. right click on MoviesDb GenModel element)
(Note that you could be able to generate search stuff without these plugins existing, but the demo need these Movies Db plugins at runtime).
Generate Search Wizard
Once you generated Movies DB Model, Edit & Editor plugins, right click on moviesDb.genmodel in package explorer and select "EMF Search > Generate Textual Search Infrastructure"
A Wizard propose EString/String EAttributes coming from analyzed packages.
You must select one or more of proposed textual features prior proceeding with Core and/or UI Search infrastructure code generation (Note the two checkbox : Core & UI).
Coming from this EString EStructuralFeature selection, Search infrastructure custom code will be generated in two new plugins (one if only one checkbox selected) :
Copying Movies DB Sample Data
You need to create a project and to copy demo sample data. Name the project "SimpleMoviesDb" or whatever you like :
Copy all *.movies, *.customers, *.orders from org.eclipse.emf.search.tests/models/codegen/Movies/data/ to new project :
Movies Db Launch Configuration
Testing your newly generated Movies DB Search in action require to create a new launch configuration :
Be sure the following pluins are checked in the "plugins" tab :
org.eclipse.emf.search.tests.movies org.eclipse.emf.search.tests.movies.edit org.eclipse.emf.search.tests.movies.editor org.eclipse.emf.search.tests.movies.search org.eclipse.emf.search.tests.movies.search.ui
Open Movies DB Search Page
Open the Movies Db Search Page in your newly started runtime workbench (Ctrl + H) :
Custom Movies Db Search Page is displayed in a multi tab dialog :
Participant tabs have been created for each of the 3 packages plus an additional one containing the union of all the classifiers.
Run A Textual Query On Customer Element
Once you got the cutomer participant tab selected, you can selected Customer as unique element partcipant to laucnh a textual query.
This query will only be applied on EString EAttributes previously selected for Search plugins code generation.
The query result gives you the customers instances which textual query expression matched previously selected EString attributes current values.
After clicking on given result, Peter for example, you get the corresponding element selected in customer legacy Ecore editor:
Super Bonus : Replace
Using "replace..." button allows you to replace "Peter" by "Lucas" for example ;-)
Generated Code Explained
To be continued ...