Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "VIATRA/Query/DeveloperDocumentation/FeatureSetAndTesting/QueryExplorer"

(Query Explorer)
 
(4 intermediate revisions by 2 users not shown)
Line 17: Line 17:
 
Clicking on "Register patterns in Query Explorer" you can register your patterns to the "Pattern Registry".
 
Clicking on "Register patterns in Query Explorer" you can register your patterns to the "Pattern Registry".
  
[[File:register_patterns.png|900px|center]]
+
[[File:register_patterns.png|300px|center]]
  
 
Here, you can add your .eiq file to the pattern registry.
 
Here, you can add your .eiq file to the pattern registry.
Line 28: Line 28:
 
After you have opened your instance model with „Sample Reflective Ecore Model Editor”, you can load it with the "Magic Green Button".
 
After you have opened your instance model with „Sample Reflective Ecore Model Editor”, you can load it with the "Magic Green Button".
  
 +
Use-cases:
 
* Load ResourceSet: You can load the whole ResourceSet which is being edited by the editor (this is the default when pressing the green button)
 
* Load ResourceSet: You can load the whole ResourceSet which is being edited by the editor (this is the default when pressing the green button)
 
* Load Resource: You can load the Resource of the selected element within the editor which can be done with the appropriate element from the view menu of the green button.
 
* Load Resource: You can load the Resource of the selected element within the editor which can be done with the appropriate element from the view menu of the green button.
  
[[File:load_instance.png|900px|center]]
+
[[File:load instance.png|600px|center]]
  
  
  
 
* Load pattern(s): Opening a .eiq file, the magic green button functionality changes. Here we can register our .eiq file.
 
* Load pattern(s): Opening a .eiq file, the magic green button functionality changes. Here we can register our .eiq file.
* Load as model: Or we can load our .eiq file as a model.
+
* Load as model: Or we can load our .eiq file as an instance model, so that queries can be executed on pattern models ("reflection"). This is a special usecase, mostly intended for EMF-IncQuery developers.
  
[[File:load_eiq.png|900px|center]]
+
[[File:load_eiq.png|600px|center]]
 
   
 
   
  
Line 45: Line 46:
 
==== Pattern registry ====
 
==== Pattern registry ====
  
The Pattern Registry on the left shows the loaded patterns according to the package hierarchy. It distinguishes them by their source, either coming from a generated EMF-IncQuery project from the host workspace or manually loaded ones from the runtime Eclipse. You can select and deselect single patterns or groups of patterns inside the Pattern Registry which will result the loading and unloading of queries for every instance model loaded into the Query Explorer. You can also change the way of package presentation (flat or hierarchical) in the view menu of the Query Explorer.
+
The Pattern Registry on the left shows the loaded patterns according to the package hierarchy. It distinguishes them by their source, either coming from a generated EMF-IncQuery project from the host workspace or manually loaded ones from the host Eclipse. You can select and deselect single patterns or groups of patterns inside the Pattern Registry which will result the loading and unloading of queries for every instance model loaded into the Query Explorer. You can also change the way of package presentation (flat or hierarchical) in the view menu of the Query Explorer.
  
[[File:show_location.png|900px|center]]
+
[[File:show_location.png|300px|center]]
 
   
 
   
 +
Use-cases:
 
* Showing plugin and runtime patterndefinitions
 
* Showing plugin and runtime patterndefinitions
* Unregister pattern
+
* Unregister pattern: remove a pattern from the Registry (if you don't need it anymore)
** has effect on viewer
+
** This has an immediate effect on the result viewer.
** plugins can not unloaded
+
** Note that plugin patterns can not be unloaded.
* Show location
+
* Show location: useful for workspace patterns, you can immediate jump to the definition of a pattern (inside the query editor).
** jump to pattern
+
* Checkbox filtering: useful for temporarily disabling certain patterns.
* Checkbox filtering
+
** This has an immediate effect on the result viewer (checked patterns are in the viewer).
** has effect on viewer (checked patterns are in the viewer)
+
  
  
Line 65: Line 66:
 
If at least one query and instance model is loaded, the middle section of the Query Explorer will present the match sets in a tree structure. The top level element corresponds to an editor-instance model pair (because the same instance model can be loaded from different editors and the reversed way is also possible). The elements under the top level elements correspond to the queries and the low-level elements represent the match set of the given query. Note that the contents of the tree viewer are automatically updated upon changes occurring in the match sets of the pattern.
 
If at least one query and instance model is loaded, the middle section of the Query Explorer will present the match sets in a tree structure. The top level element corresponds to an editor-instance model pair (because the same instance model can be loaded from different editors and the reversed way is also possible). The elements under the top level elements correspond to the queries and the low-level elements represent the match set of the given query. Note that the contents of the tree viewer are automatically updated upon changes occurring in the match sets of the pattern.
  
* behaviour depends on the state of the:
+
* The behaviour depends on the state of the:
 
** patternregistry
 
** patternregistry
 
** instance model
 
** instance model
Line 74: Line 75:
 
** @ObservableValue: allows the developer to customize the appearance of a match inside the Details panel.
 
** @ObservableValue: allows the developer to customize the appearance of a match inside the Details panel.
  
[[File:constraints.png|900px|center]]
+
See more at [[EMFIncQuery/UserDocumentation/Databinding]]
 +
 
 +
 
 +
[[File:constraints.png|500px|center]]
  
 
* Use-cases:
 
* Use-cases:
** default appearance
+
** It automatically follows any changes to the attached instance model, the pattern registry (checked state) and the details/filters view. However, if you change the pattern definition in your .eiq file, the file needs to be re-loaded into the Query Explorer via the green button.
** following changes (modifying the contents of a .eiq file - that was loaded earlier to the Query Explorer - automatically triggers re-loading of the patterns)
+
** Navigate to source (Show location): useful for jumping to relevant sections of
** navigate to source (Show location)
+
*** the attached instance model: can be activated on individual matches, to reveal and select-highlight any EObjects contained in a match
*** to instance model
+
*** the pattern definition: can be activated on queries.
*** to pattern definition  
+
  
  
Line 90: Line 93:
 
The view of this content is based on the selection inside the tree viewer. If you select a pattern then you can specify filters on the pattern parameters. However, if you select a single match, you can observe the values of the pattern parameters which are data bound to the appropriate model elements thus automatically refreshed upon match changing.
 
The view of this content is based on the selection inside the tree viewer. If you select a pattern then you can specify filters on the pattern parameters. However, if you select a single match, you can observe the values of the pattern parameters which are data bound to the appropriate model elements thus automatically refreshed upon match changing.
  
[[File:detailsfilters.png|900px|center]]
+
[[File:detailsfilters.png|700px|center]]
  
Details/Filters use-cases:
+
Use-cases:
* choosing a concrete match or matcher
+
* Choosing a concrete match or matcher: the details mode is useful for investigating individual matches, while filters mode can be activated by selecting a matcher (query).
* input parameter binding (matcher filter) – popup window depends on the type of the parameter (object or not)
+
* Filters mode allows for input parameter binding (matcher filter) – popup window depends on the type of the parameter (object or scalar such as string or number). Input parameter binding allows to define a filter on the result set of the query, by binding one or more parameters to a given value (after the binding, only those results are shown which are allowed by the binding).
** has effect on viewer
+
* These settings have an immediate effect on the result viewer.
  
[[File:popupfilters.png|900px|center]]
+
[[File:popupfilters.png|600px|center]]
  
 
----
 
----
Line 103: Line 106:
 
==== View menu ====
 
==== View menu ====
  
 +
Use-cases:
 
* You can change the way of the pattern registry’s package presentation (flat or hierarchical) in the view menu of the Query Explorer.
 
* You can change the way of the pattern registry’s package presentation (flat or hierarchical) in the view menu of the Query Explorer.
* You can reset the UI
+
* You can reset the UI. This is useful if the Query Explorer gets into an inconsistent state (due to e.g. an error).
  
[[File:viewmenu.png|900px|center]]
+
[[File:viewmenu.png|700px|center]]

Latest revision as of 09:18, 10 March 2016

Query Explorer

This view can be used to apply queries on various EMF instance models. The Query Explorer can interact with EMF-based editors such as the generated tree editor, and even with GMF and Graphiti editors. Advanced querying use cases, like pattern match set filtering and detail observation is also available with the Query Explorer.

Query Explorer has the following components:

  • Context menu items for resources
  • "Magic Green Button"
  • Pattern registry
  • Result viewer
  • Details/Filters
  • View menu


Context menu items for resources

Clicking on "Register patterns in Query Explorer" you can register your patterns to the "Pattern Registry".

Register patterns.png

Here, you can add your .eiq file to the pattern registry.



"Magic Green Button" (depends on context)

After you have opened your instance model with „Sample Reflective Ecore Model Editor”, you can load it with the "Magic Green Button".

Use-cases:

  • Load ResourceSet: You can load the whole ResourceSet which is being edited by the editor (this is the default when pressing the green button)
  • Load Resource: You can load the Resource of the selected element within the editor which can be done with the appropriate element from the view menu of the green button.
Load instance.png


  • Load pattern(s): Opening a .eiq file, the magic green button functionality changes. Here we can register our .eiq file.
  • Load as model: Or we can load our .eiq file as an instance model, so that queries can be executed on pattern models ("reflection"). This is a special usecase, mostly intended for EMF-IncQuery developers.
Load eiq.png



Pattern registry

The Pattern Registry on the left shows the loaded patterns according to the package hierarchy. It distinguishes them by their source, either coming from a generated EMF-IncQuery project from the host workspace or manually loaded ones from the host Eclipse. You can select and deselect single patterns or groups of patterns inside the Pattern Registry which will result the loading and unloading of queries for every instance model loaded into the Query Explorer. You can also change the way of package presentation (flat or hierarchical) in the view menu of the Query Explorer.

Show location.png

Use-cases:

  • Showing plugin and runtime patterndefinitions
  • Unregister pattern: remove a pattern from the Registry (if you don't need it anymore)
    • This has an immediate effect on the result viewer.
    • Note that plugin patterns can not be unloaded.
  • Show location: useful for workspace patterns, you can immediate jump to the definition of a pattern (inside the query editor).
  • Checkbox filtering: useful for temporarily disabling certain patterns.
    • This has an immediate effect on the result viewer (checked patterns are in the viewer).



Result viewer

If at least one query and instance model is loaded, the middle section of the Query Explorer will present the match sets in a tree structure. The top level element corresponds to an editor-instance model pair (because the same instance model can be loaded from different editors and the reversed way is also possible). The elements under the top level elements correspond to the queries and the low-level elements represent the match set of the given query. Note that the contents of the tree viewer are automatically updated upon changes occurring in the match sets of the pattern.

  • The behaviour depends on the state of the:
    • patternregistry
    • instance model
    • details/filters
  • Data binding: EMF-IncQuery provides a simple data binding facility that can be used to bind pattern matches to UI elements.
    • @QueryExplorer: the message parameter of the Query explorer annotation defines the label feature of the selected match.
    • @ObservableValue: allows the developer to customize the appearance of a match inside the Details panel.

See more at EMFIncQuery/UserDocumentation/Databinding


Constraints.png
  • Use-cases:
    • It automatically follows any changes to the attached instance model, the pattern registry (checked state) and the details/filters view. However, if you change the pattern definition in your .eiq file, the file needs to be re-loaded into the Query Explorer via the green button.
    • Navigate to source (Show location): useful for jumping to relevant sections of
      • the attached instance model: can be activated on individual matches, to reveal and select-highlight any EObjects contained in a match
      • the pattern definition: can be activated on queries.



Details/Filters

The view of this content is based on the selection inside the tree viewer. If you select a pattern then you can specify filters on the pattern parameters. However, if you select a single match, you can observe the values of the pattern parameters which are data bound to the appropriate model elements thus automatically refreshed upon match changing.

Detailsfilters.png

Use-cases:

  • Choosing a concrete match or matcher: the details mode is useful for investigating individual matches, while filters mode can be activated by selecting a matcher (query).
  • Filters mode allows for input parameter binding (matcher filter) – popup window depends on the type of the parameter (object or scalar such as string or number). Input parameter binding allows to define a filter on the result set of the query, by binding one or more parameters to a given value (after the binding, only those results are shown which are allowed by the binding).
  • These settings have an immediate effect on the result viewer.
Popupfilters.png

View menu

Use-cases:

  • You can change the way of the pattern registry’s package presentation (flat or hierarchical) in the view menu of the Query Explorer.
  • You can reset the UI. This is useful if the Query Explorer gets into an inconsistent state (due to e.g. an error).
Viewmenu.png

Back to the top