Bug 415371 - [CDO] Model search in repository models
Summary: [CDO] Model search in repository models
Status: RESOLVED FIXED
Alias: None
Product: Papyrus
Classification: Modeling
Component: Core (show other bugs)
Version: 0.10.0   Edit
Hardware: PC Mac OS X
: P3 enhancement (vote)
Target Milestone: M2   Edit
Assignee: Christian Damus CLA
QA Contact:
URL:
Whiteboard: Usability
Keywords: plan
Depends on:
Blocks:
 
Reported: 2013-08-19 15:17 EDT by Christian Damus CLA
Modified: 2017-06-19 06:54 EDT (History)
3 users (show)

See Also:
give.a.damus: luna+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Damus CLA 2013-08-19 15:17:12 EDT
The Kepler release introduced a Model Search implementation in the Eclipse Search framework.  This supports searching Papyrus UML models in the workspace.

The same or near-equivalent functionality is needed also (one might say, especially) for models stored in a CDO repository.  This implies a transformation of the search terms to a server-side query, using OCL or some other language provided by CDO (not, e.g., raw SQL because that is DB- and mapping-specific).

The Kepler search feature supports querying on text patterns in UML elements with metaclass filters.  CDO provides at least this level of search capability out-of-the-box.
Comment 1 Christian Damus CLA 2013-08-29 14:18:26 EDT
Extending model search into CDO repositories, in which there are no workspace files (IResource/IFiles) will require some refactoring of the Kepler Papyrus Search implementation for UML models:

  - replace dependencies on IResource/IFile with URI for portability
    to other EMF-compatible resource schemes

  - provide extensibility hooks for the CDO integration layer to
    plug in custom search queries for resources in its domain

The Eclipse Search UI provides some APIs that deal with workspace resources (text search matches in IFiles, for example), but this is always optional; Eclipse Search fully supports non-workspace storage, so refactoring will be limited to Papyrus Search code.
Comment 2 Christian Damus CLA 2013-08-30 09:23:11 EDT
I have pushed a new branch bugs/415374 with my proposed refactoring of the Papyrus Search APIs.  This includes:

  - in the IScopeCollector, IStereotypeCollector, ScopeEntry, PapyrusSearchPage, PapyrusSearchResult
     classes I have replaced dependencies on IResource with URI.
  - the AbstractResultEntry is updated to additionally handle URIs that are not platform:/resource scheme
     as "pure EMF" resources.  For the full search experience, resources in the workspace are still provided
     by this class as IResources
  - delegation in the PapyrusSearchPage to  pluggable providers contributed on new extension points:
     - IScopeProvider:  used to find URIs to search when the user opts for workspace-wide or selection-scoped
        search in the text-based (not OCL) search.  An implementation for Eclipse Workspace resources provides
        the Kepler-compatible behaviour
     - IPapyrusQueryProvider:  used to obtain ISearchQuery implementations covering the URIs that are provided
        by the scope providers (per above).  This allows a CDO-specific implementation to handle search in URIs
        identifying model repository resources and a workspace-specific implementation to provide the
        Kepler-compatible behaviour for models in the workspace
        
For refactoring of the APIs to prefer URI instead of IResource to indicate resources, I opted not to employ deprecation of the IResource-based APIs as I did in Kepler release for the ModelSet and IModel APIs.  Unlike the ModelSet, I expect that there should be few if no consumers of the affect search APIs outside of the Papyrus Search plug-ins, themselves (indeed, I would argue that these APIs should all be *internal*, not for general use).  Please let me know if that will be a problem.

The plan from this point is to implement the search providers for CDO as server-side queries.  I think the core API refactoring is sufficient for that purpose, but there is (of course) a chance that it will still need changes.  My intention is to provide CDO-specific support only for the "basic" and "advanced" text string searches, not for OCL searches.  The latter mode is restricted to the "selection" scope and, furthermore, selection of only a single model.  It also seems to assume that it will already be open in an editor.  As such, the current state of this branch already works on CDO models because they are used as loaded in the editor.  Please let me know if there are plans to expand the scopes to which OCL searches can be applied, or what other new kinds of new searches are planned.  I may have to leave it for others to support those in the CDO domain.  ;-)
Comment 3 Christian Damus CLA 2013-09-07 11:04:35 EDT
Fixed in commit 03d64c0d7976065e043e213b02004bb943822fc8 (and several previous).

**
** NOTE
**
** This functionality requires CDO build I20130906-2340 or later.
**

The Papyrus Search page in the Eclipse search dialog now full supports the text-based searches, beth Simple and Advanced models, on models in CDO repositories.

The scoping options in the dialog apply as follows:

  * Workspace: includes all Papyrus models in open workspace projects and
    in currently connected repositories in the Model Repositories view

  * Selection: includes all Papyrus models in the current selection in the
    Model Repositories view.  This may be any number of selections of
    repositories, folders, models, or component resources

  * Selected Projects:  n/a. Projects are necessarily a workspace construct

  * Working Sets:  n/a.  Working sets are necessarily a workspace construct

Both case-insensitive and regular expression searches are supported.

Search results from repository models are shown together with results from the workspace in the Search view.  Each search is executed in its own read-only view on the appropriate repository (searches across repositories and the workspace are run separately and their results composed).

Navigation of search results by double-clicking on them to open the contextual model is fully supported.

When a repository connection is closed, all search results from that repository are purged from the Search view.