Jump to: navigation, search

Difference between revisions of "EMF Search"

(Open UML2 Package)
(Indicated the is scheduled for termination.)
 
(32 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Project website at Eclipse [http://www.eclipse.org/emft/projects/search/#search]
+
The project has been "inactive for many years" and is scheduled for termination. See [http://wiki.eclipse.org/Modeling/project_termination_review_2012#Search].
 +
Project website is at [http://www.eclipse.org/emft/projects/search/#search].
  
 
== Concept ==
 
== Concept ==
Line 7: Line 8:
 
EMF Search is an Ecore meta-model based extensible search engine which purpose is to provide users query launching services against Ecore based models.
 
EMF Search is an Ecore meta-model based extensible search engine which purpose is to provide users query launching services against Ecore based models.
  
Meta-model based search is basically being able to take advantage of a meta-model structure to run generic search queries onto it. This means that a meta-model structure, defining a minimal modeling "organizaton", contains information enough to get operations applied to it, and by extension having same operations applied to any inheriting model compliant with this meta-model structure. Ecore based search is in fact a particular case of meta-model based treatment, a typical approach also known as Model Driven Architecture.
+
Meta-model based search is basically being able to take advantage of a meta-model structure to run generic search queries onto it. This means that a meta-model structure, defining a minimal modeling "organization", contains information enough to get operations applied to it, and by extension having same operations applied to any inheriting model compliant with this meta-model structure. Ecore based search is in fact a particular case of meta-model based treatment, a typical approach also known as Model Driven Architecture.
  
 
In other words, this allows to develop meta-model based generic algorithms, valid across any user defined model extending elements & structure of a given meta-model. Such method are usually employed as part of a code generation development process also known as Model Driven Development, allowing developers to code things once, setting up templates based code generation getting its data from the particular valuation of an instance of a given meta-model (eg: An actual user defined model or domain model populated with pertinent data).
 
In other words, this allows to develop meta-model based generic algorithms, valid across any user defined model extending elements & structure of a given meta-model. Such method are usually employed as part of a code generation development process also known as Model Driven Development, allowing developers to code things once, setting up templates based code generation getting its data from the particular valuation of an instance of a given meta-model (eg: An actual user defined model or domain model populated with pertinent data).
Line 13: Line 14:
 
== Terminology ==
 
== Terminology ==
  
For model search explanatory purposes, we need to introduce some terminology. First at all, lets keep in mind a model search query always need to deal with entities such as a scope of model resource(s)/element(s) onto which a search query will apply, a set of participant meta-elements which the search query will consider, and finally a search query, textual, scriptical,programatic which an associated model search engine will evaluate against a scope and participants. This evaluation obviously having the role to produce Model Search Results.
+
For model search explanatory purposes, we need to introduce some terminology. First of all, let's keep in mind that a model search query always needs to deal with entities such as a scope of model resource(s)/element(s) onto which a search query will apply, a set of participant meta-elements which the search query will consider, and finally a search query, whether textual, scriptical or programmatic, which an associated model search engine will evaluate against a scope and participants. This evaluation obviously having the role to produce Model Search Results.
  
[EMF Model Search Query Entites Overview]
+
[[Image:EMFModelSearchQueryClassDiagram.png|EMF Model Search Query Entities Overview]]
  
This brief explanation just made main concepts appearing : Model Search Scope, Model Search Participants, Model Search Query, Model Search Engine, Model Search Results.
+
This brief explanation just made main concepts appearing : Model Search Scope, Model Search Participants, Model Search Query, Model Search Engine, and Model Search Results.
  
    * Model Search Engine:
+
=== Model Search Engine ===
    EMF Search has extension point allowing user to contribute custom model search engines
+
EMF Search has an extension point allowing a user to contribute custom model search engines
    (see org.eclipse.emf.search.modelSearchEngine extension point definition).
+
(see <code>org.eclipse.emf.search.modelSearchEngine</code> extension point definition).
    A model search engine has responsability, given a model resource scope,
+
    to evaluate a model search query applying only on a set of selected meta-elements (called meta-elements participants).
+
  
    * Model Search Query
+
A model search engine has responsibility, given a model resource scope,
    EMF Search offers extensible model search queries mechanism.
+
to evaluate a model search query applying only on a set of selected meta-elements (called meta-element participants).
    Users can contribute model search queries potentially combined with any numbers of diferent elements particpants.
+
    (eg. given the fact different user defined elements extends Ecore meta-elements). As a result, users can register to
+
    org.eclipse.emf.search.modelSearchID extension their own model search queries (plus the way to handle it from UI point of view)
+
    and the, associating it to an existing model search engine.
+
  
    * Model Search Particiants
+
=== Model Search Query ===
    EMF Search offers extensible model search participants elements mechanism.
+
EMF Search offers an extensible mechanism for model search queries.
    Users can contribute model search participants potentially combined with any numbers of diferent model search queries.
+
    As a result, users can register to org.eclipse.emf.search.modelSearchParticipantTab extension their own
+
    model search participant elements (plus the way to handle it from UI point of view) and, associating it to an existing model search engine.
+
  
    * Model Search Scope
+
Users can contribute model search queries potentially combined with any number of different element participants.
    Model Search Scope stands for a set of ecore resources to be considerer by the search query.  
+
(eg. given the fact that different user defined elements extend Ecore meta-elements). As a result, users can register to <code>org.eclipse.emf.search.modelSearchID</code> extension their own model search queries (plus the way to handle it from the UI point of view) and then, associate it to an existing model search engine.
    We can make a comparison with platform search concepts from the scope point of view.
+
    As in the text search or java search, user can search into the whole workspace or reduce its scope to selected resources,
+
    selected projects or even given working set.
+
  
    * Model Search Result
+
=== Model Search Participants ===
    Query evaluation produces matches, being collected in a result object or each resource evaluated.
+
EMF Search offers extensible model search participants elements mechanism.
    Matches can be considered as reult entries of top level reult object.
+
    These matches are considered as Model Search Result and will populate the Eclipse Search View.
+
  
== Eclipse Search Integration ==
+
Users can contribute model search participants potentially combined with any numbers of different model search queries.
  
=== Eclipse Search Ecore Integration ===
+
As a result, users can register to <code>org.eclipse.emf.search.modelSearchParticipantTab</code> extension their own model search participant elements (plus the way to handle it from the UI point of view), and associate it to an existing model search engine.
  
Ecore Search Page have two main query kinds : Textual & OCL
+
=== Model Search Scope ===
 +
Model Search Scope stands for a set of ecore resources to be considered by the search query.
  
* Textual queries
+
We can make a comparison with platform search concepts from the scope point of view.
** normal (?, * available)
+
As in the text search or java search, a user can search into the whole workspace or reduce its scope to selected resources, selected projects or even a given working set.
** case sensitive
+
** regex (Java regular expression based)
+
  
 +
=== Model Search Result ===
 +
Query evaluation produces matches, being collected in a result object or each resource evaluated.
 +
Matches can be considered as result entries of top level result object.
 +
These matches are considered as Model Search Result and will populate the Eclipse Search View.
  
Textual queries are very similar to JDT, PDE or File ones.
+
== Eclipse Search Integration ==
Query evaluation is done against meta elemnt names as users can see in Ecore editors.
+
Thanks to the fact Most Ecore elements are inheriting from ENamedElement, exposing a usefull getName:String method, it is possible evaluate regex pattern against them.
+
  
 +
=== Eclipse Search Ecore Integration ===
  
* OCL queries
+
[[EMF_Search---Ecore_Integration|Ecore Search Feature Tour]]
 
+
OCL queries for Ecore are simple OCL invariants evaluations, these queries are ran against a particular meta element.
+
OCL contextual edition is allowed according to a meta element user selection. Thus, users wanting to evaluate
+
invariant expression against an EClass would have to set the OCL Expression wigdet context set to 'EClass'
+
before being able to edit the invariant body.
+
 
+
 
+
As a result an OCL query expression body can take advantage of syntax coloring & contextual completion proposal.
+
 
+
 
+
==== Ecore Textual Search ====
+
 
+
 
+
Ecore Textual Search Page is composed of two parts : query & participants.
+
 
+
 
+
* Query : Textual expression edit area with normal, case sentitive & regex support
+
* Participants : All Ecore meta elements possibly particpating to Ecore Textual query
+
 
+
 
+
 
+
The figure below depict a user textual query against selected participant meta elements.
+
 
+
Here, the user want find all EClass elements with name matching "Movie*" regex.
+
 
+
Note that the search scope can be chosen between Workspace, Selected, Resource, Working Set.
+
 
+
Note also that query participants can be filtered in order to ease elements selection
+
user experience.
+
 
+
 
+
 
+
[[Image:EcoreTextualSearchPage.png|500px|Ecore Textual Search Page]]
+
 
+
 
+
 
+
Ecore Results page collects and display matches for Ecore queries. An header label summarize the
+
query configuration in terms of expression, participants and scope.
+
 
+
 
+
Matches are display in black, hierarchical intermediary results are colored in gray and get
+
number of match occurences their sub tree owns.
+
 
+
 
+
 
+
[[Image:EcoreTextualResultPage.png|750px|Ecore Textual Result Page]]
+
 
+
==== Ecore OCL Search ====
+
 
+
 
+
OCL queries for Ecore are simple OCL invariants evaluations, these queries are ran against a particular meta element. OCL contextual edition is allowed according to a meta element user selection.
+
 
+
 
+
Thus, users wanting to evaluate invariant expression against an EClass would have to set the OCL Expression wigdet context set to 'EClass' before being able to edit the invariant body.
+
 
+
 
+
As a result an OCL query expression body can take advantage of syntax coloring & contextual completion proposal.
+
 
+
 
+
Below we can see the completion proposal list obtained by hitting "Ctrl+Space" from the OCL Expression widget.
+
 
+
 
+
 
+
[[Image:EcoreOCLSearchPage.png|500px|Ecore OCL Search Page]]
+
 
+
 
+
 
+
Results are collected and displayed accordingly to the resource & OCL invariant they have been evaluated against.
+
 
+
 
+
 
+
[[Image:EcoreOCLResultPage.png|800px|Ecore OCL Result Page]]
+
  
 
=== EMF Search Replace ===
 
=== EMF Search Replace ===
  
 
+
[[EMF_Search---Replace_Integration|EMF Search Replace Feature Tour]]
Replace infrastructure is offered. It allows users to replace a match occurence by a given text.
+
 
+
Normal & Case Sensitive queries replace the whole matched occurence.
+
Regex queries replace only the region matched with given text.
+
 
+
It is planned to improve replace infrastructure to offer full regex replace support.
+
 
+
+
 
+
[[Image:EcoreRegexReplace1.png|500px|Ecore Regex Replace Parametrization]]
+
 
+
 
+
 
+
Once, user gave a new value to replace occurences with, a dialog pops up proposing to apply or not changes.
+
 
+
 
+
 
+
[[Image:EcoreRegexReplace2.png|500px|Ecore Regex Replace Discrimination]]
+
  
 
=== UML2 Search Integration ===
 
=== UML2 Search Integration ===
  
 
+
[[EMF_Search---UML2_integration|UML2 Search Feature Tour]]
UML2 Search is a kind of enhanced sample example demonstrating extensibilty of EMF Search framework.
+
It has same features has Ecore ones by extesnion and add some UML specific ones.
+
 
+
Textual queries are against NamedElement objects. OCL Queries are ran against any ModelElement.
+
 
+
 
+
 
+
[[Image:UML2TextualSearchPage.png|500px|UML2 Textual Search Page]]
+
 
+
 
+
 
+
Results are collected in a dedicated result page, offering custom actions and navigation.
+
 
+
 
+
 
+
[[Image:UML2TextualResultPage.png|800px|UML2 Textual Result Page]]
+
  
 
=== GenModel Search Integration ===
 
=== GenModel Search Integration ===
  
 
+
[[EMF_Search---GenModel_Integration|GenModel Search Feature Tour]]
GenModel is basically an Ecore model for Ecore generation. Thus, it was a natural candidate for an EMF Search integration.
+
 
+
GenModel elements are pretty similar to those defined in Ecore meta model. Search page has a simple textual expression area.
+
GenModel extension of the EMF Search framework is very similar to the UML2 one. They are all inheriting from the Ecore one.
+
 
+
 
+
[[Image:GenModelTextualSearchPage.png|500px|GenModel Textual Search Page]]
+
 
+
==== GenModel Navigation ====
+
 
+
 
+
Results are displayed in a very similar form than Ecore or UML2 ones.
+
 
+
 
+
[[Image:GenModelTextualResultPage.png|800px|GenModel Textual Result Page]]
+
 
+
 
+
Results allow to perform code generation actions as in the EMF genmodel legacy editor.
+
 
+
 
+
[[Image:GenModelResultPageGenerationActions.png|800px|GenModel Textual Result Code Generation Actions]]
+
 
+
GenModel owns information enough to generate code *AND* navigate to source.
+
 
+
 
+
[[Image:GenModelTextualResultPageToJavaCodeNavigation.png|800px|GenModel Textual Result Navigation To Java Code Action]]
+
 
+
 
+
User can come back to legacy Ecore editor at any time.
+
 
+
 
+
[[Image:GenModelTextualResultPageToEcoreElementNavigation.png|800px|GenModel Textual Result Page Navigation To Ecore Element]]
+
  
 
=== Custom Textual Search Code Generation ===
 
=== Custom Textual Search Code Generation ===
  
Users wanting to get a boostrap implementation for Search Core & UI can take advantage of code generation wizard.
+
[[EMF_Search---Custom_Textual_Search_Generation|Custom Textual Search Generation Feature Tour]]
 
+
This wizard works only for textual search queries (No OCL support). Basically speaking generating textual EMF search implementations for arbitrarty ecore models is quite complex. First you need to query .genmodel to get all available String/EString Ecore EStructural features. User must select a few or all of these features from which Core & UI implementations will be generated.
+
 
+
Access to the wizard is available from a popup menu on any .genmodel file. menu is "EMF Search > Generate Textual Search Engine ..."
+
 
+
[[Image:EMFSearchCodegenAction.PNG|450px|EMF Search Textual Core and UI Code Generation Action]]
+
 
+
Wizard allows user to discriminate which textual feature he wants its search to consider.
+
 
+
[[Image:EMFSearchCodegenWizard.PNG|500px|EMF Search Textual Core and UI Code Generation Wizard]]
+
  
 
=== Misc EMF Search Based Tooling ===
 
=== Misc EMF Search Based Tooling ===
  
==== Open Ecore EClass Dialog ====
+
[[EMF_Search---Misc_SearchBased_Tooling|Miscellaneous Search Based Tooling Panorama]]
  
A filtered dialog allows to open EClass like Open Java Type Does (Alt + Shift + M).
+
== Quick Start Guide ==
  
[[Image:OpenEClassFilteredDialog.png|375px|EMF Search Open EClass Filtered Dialog]]
+
[[EMF_Search---Quick_Start_Guide|Quick Start : Movies DB Example Tutorial]]
 
+
==== Open Ecore EPackage Dialog ====
+
 
+
A filtered dialog allows to open EPAckage like JDT Does Not ;-) (Alt + Shift + P).
+
 
+
[[Image:OpenEPackageFilteredDialog.png|375px|EMF Search Open EPackage Filtered Dialog]]
+
 
+
==== Open UML2 Class Dialog ====
+
==== Open UML2 Package ====
+
 
+
A filtered dialog is also available to open UML2 Packages (Alt + Shift + K).
+
 
+
[[Image:OpenUMLPackageFilteredDialog.png|375px|EMF Search Open UML Package Filtered Dialog]]
+
 
+
==== Ecore Diagram EReference Resolution ====
+
  
 
== Developer Guide ==
 
== Developer Guide ==
  
=== Introduction ===
+
[[EMF_Search---Developer_Guide|How To Efficiently Use EMF Search APIs And Extension Points]]
  
Developers have several levels/contexts/persitences configurations for which they want to use EMF Search.
+
== Extensibility ==
  
One aspect is which modeling level they want their extension to address :
+
[[EMF_Search_Framework_Extensibility---How_It_Works|How It Works]]
 
+
* meta modeling level
+
** Ecore meta-modeling (M3)
+
** UML2 meta-modeling or custom meta-models (M2)
+
** Model instance (M1)
+
 
+
 
+
Another aspect is where and how their meta models are stored :
+
 
+
* meta model perstistence layer type
+
** Eclipse Resources
+
** Local File System
+
** WWW distant resources (Close to be supported)
+
** DB persitence (Support planned)
+
 
+
 
+
Depending on these particular situations, EMF Search typical usages exist.
+
 
+
=== Search Scope & Visitors ===
+
 
+
 
+
EMF Search defines a Scope API contract with IModelSearchScope :
+
 
+
    public interface IModelSearchScope<P, O> {
+
        List<P> getParticipants();
+
        void addParticipant(P resource);
+
        void addParticipants(P[] resources);
+
        void removeParticipant(P resource);
+
        void removeParticipants(P[] resources);
+
        List<P> findPartcipant(Class<O> clazz);
+
        String getLabel();
+
    }
+
 
+
* Eclipse Workspace resource
+
 
+
* Local File System
+
 
+
* Distant locations (Http URIs)
+
 
+
* EE repositories
+
 
+
=== Ecore Query & Helper ===
+
 
+
=== Custom Queries & Helper ===
+
 
+
== Extensibility ==
+
  
[[http://wiki.eclipse.org/EMF_Search_Framework_Extensibility EMF Search Framework Extensibility Example]]
+
[[EMF_Search_Framework_Extensibility|EMF Search Framework Extensibility Example]]
  
 
=== EMF Search Core Extension Points ===
 
=== EMF Search Core Extension Points ===
  
[[http://wiki.eclipse.org/EMF_Search_Framework_Extensibility---org.eclipse.emf.search.modelSearchEngine Model Search Engine]]
+
[[EMF_Search_Framework_Extensibility---org.eclipse.emf.search.modelSearchEngine|Model Search Engine]]
  
 
=== EMF Search UI Extension Points ===
 
=== EMF Search UI Extension Points ===
  
[[http://wiki.eclipse.org/EMF_Search_UI_Extensibility---org.eclipse.emf.search.ui.modelSearchEngineMapping Model Search Engine Mapping]]
+
[[EMF_Search_UI_Extensibility---org.eclipse.emf.search.ui.modelSearchEngineMapping|Model Search Engine Mapping]]
  
[[http://wiki.eclipse.org/EMF_Search_UI_Extensibility---org.eclipse.emf.search.ui.modelSearchPageActionContribution Model Result Page Action]]
+
[[EMF_Search_UI_Extensibility---org.eclipse.emf.search.ui.modelSearchPageActionContribution|Model Result Page Action]]
  
[[http://wiki.eclipse.org/EMF_Search_UI_Extensibility---org.eclipse.emf.search.ui.modelSearchPageMenuContribution Model Result Page Menu]]
+
[[EMF_Search_UI_Extensibility---org.eclipse.emf.search.ui.modelSearchPageMenuContribution|Model Result Page Menu]]
  
[[http://wiki.eclipse.org/EMF_Search_UI_Extensibility---org.eclipse.emf.search.ui.modelSearchParticipantTab Model Search Participant Tab]]
+
[[EMF_Search_UI_Extensibility---org.eclipse.emf.search.ui.modelSearchParticipantTab|Model Search Participant Tab]]
  
[[http://wiki.eclipse.org/EMF_Search_UI_Extensibility---org.eclipse.emf.search.ui.modelSearchQueryTab Model Search Query Tab]]
+
[[EMF_Search_UI_Extensibility---org.eclipse.emf.search.ui.modelSearchQueryTab|Model Search Query Tab]]
  
[[http://wiki.eclipse.org/EMF_Search_UI_Extensibility---org.eclipse.emf.search.ui.openDiagramParticipants Open Diagram Participants]]
+
[[EMF_Search_UI_Extensibility---org.eclipse.emf.search.ui.openDiagramParticipants|Open Diagram Participants]]
  
 
=== EMF Search OCL Extension Points ===
 
=== EMF Search OCL Extension Points ===
  
[[http://wiki.eclipse.org/EMF_Search_OCL_Extensibility---org.eclipse.emf.search.ocl.targetMetaModel OCL Target MetaModel]]
+
[[EMF_Search_OCL_Extensibility---org.eclipse.emf.search.ocl.targetMetaModel|OCL Target MetaModel]]

Latest revision as of 09:40, 27 September 2012

The project has been "inactive for many years" and is scheduled for termination. See [1]. Project website is at [2].

Concept

EMF Search provides the fundamental infrastructure and components for search queries on EMF based models. A particular focus is made on integration with the Eclipse Core Search API for end user tight integration.

EMF Search is an Ecore meta-model based extensible search engine which purpose is to provide users query launching services against Ecore based models.

Meta-model based search is basically being able to take advantage of a meta-model structure to run generic search queries onto it. This means that a meta-model structure, defining a minimal modeling "organization", contains information enough to get operations applied to it, and by extension having same operations applied to any inheriting model compliant with this meta-model structure. Ecore based search is in fact a particular case of meta-model based treatment, a typical approach also known as Model Driven Architecture.

In other words, this allows to develop meta-model based generic algorithms, valid across any user defined model extending elements & structure of a given meta-model. Such method are usually employed as part of a code generation development process also known as Model Driven Development, allowing developers to code things once, setting up templates based code generation getting its data from the particular valuation of an instance of a given meta-model (eg: An actual user defined model or domain model populated with pertinent data).

Terminology

For model search explanatory purposes, we need to introduce some terminology. First of all, let's keep in mind that a model search query always needs to deal with entities such as a scope of model resource(s)/element(s) onto which a search query will apply, a set of participant meta-elements which the search query will consider, and finally a search query, whether textual, scriptical or programmatic, which an associated model search engine will evaluate against a scope and participants. This evaluation obviously having the role to produce Model Search Results.

EMF Model Search Query Entities Overview

This brief explanation just made main concepts appearing : Model Search Scope, Model Search Participants, Model Search Query, Model Search Engine, and Model Search Results.

Model Search Engine

EMF Search has an extension point allowing a user to contribute custom model search engines (see org.eclipse.emf.search.modelSearchEngine extension point definition).

A model search engine has responsibility, given a model resource scope, to evaluate a model search query applying only on a set of selected meta-elements (called meta-element participants).

Model Search Query

EMF Search offers an extensible mechanism for model search queries.

Users can contribute model search queries potentially combined with any number of different element participants. (eg. given the fact that different user defined elements extend Ecore meta-elements). As a result, users can register to org.eclipse.emf.search.modelSearchID extension their own model search queries (plus the way to handle it from the UI point of view) and then, associate it to an existing model search engine.

Model Search Participants

EMF Search offers extensible model search participants elements mechanism.

Users can contribute model search participants potentially combined with any numbers of different model search queries.

As a result, users can register to org.eclipse.emf.search.modelSearchParticipantTab extension their own model search participant elements (plus the way to handle it from the UI point of view), and associate it to an existing model search engine.

Model Search Scope

Model Search Scope stands for a set of ecore resources to be considered by the search query.

We can make a comparison with platform search concepts from the scope point of view. As in the text search or java search, a user can search into the whole workspace or reduce its scope to selected resources, selected projects or even a given working set.

Model Search Result

Query evaluation produces matches, being collected in a result object or each resource evaluated. Matches can be considered as result entries of top level result object. These matches are considered as Model Search Result and will populate the Eclipse Search View.

Eclipse Search Integration

Eclipse Search Ecore Integration

Ecore Search Feature Tour

EMF Search Replace

EMF Search Replace Feature Tour

UML2 Search Integration

UML2 Search Feature Tour

GenModel Search Integration

GenModel Search Feature Tour

Custom Textual Search Code Generation

Custom Textual Search Generation Feature Tour

Misc EMF Search Based Tooling

Miscellaneous Search Based Tooling Panorama

Quick Start Guide

Quick Start : Movies DB Example Tutorial

Developer Guide

How To Efficiently Use EMF Search APIs And Extension Points

Extensibility

How It Works

EMF Search Framework Extensibility Example

EMF Search Core Extension Points

Model Search Engine

EMF Search UI Extension Points

Model Search Engine Mapping

Model Result Page Action

Model Result Page Menu

Model Search Participant Tab

Model Search Query Tab

Open Diagram Participants

EMF Search OCL Extension Points

OCL Target MetaModel