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/Releases/NewAndNoteworthy1.6"

(Model Query Evaluation)
Line 1: Line 1:
 
= Model Query Evaluation =
 
= Model Query Evaluation =
  
VIATRA 1.6 provides a few new features providing better compatibility with various models the queries need to be evaluated on. In general, VIATRA should work out of the box the same way it worked before, but there are some settings that allow a more finely tuned behaviour for these cases.
+
VIATRA 1.6 provides a few new features that aim for better compatibility with various models the queries need to be evaluated on. In general, VIATRA should work out of the box the same way it worked before, but there are some settings that allow a more finely tuned behaviour for these cases.
  
In previous versions of VIATRA, in case of '''incorrect notifications''' (e.g. duplicate model deletion events), strange exceptions were thrown from the pattern matcher. In version 1.6, the model indexer identifies most of these cases and provides a more precise error message what happens. For these cases, it is also possible to tell the indexer to ignore (more specifically, log only) these incorrect notifications by turning the '''strict notification mode''' off.
+
Custom implementations of the EMF API (e.g. when generated code is manually modified) may violate EMF API contracts, and send '''incorrect notifications''' (e.g. duplicate model deletion events); similar situations can arise e.g. if there are custom EMF adapters that throw exceptions. In previous versions of VIATRA, this resulted in strange exceptions being thrown from the query backend. In version 1.6, the model indexer identifies most of these cases and provides a more precise error message describing what happens. It is also possible to tell the indexer to ignore (more specifically, log only) these incorrect notifications by turning the '''strict notification mode''' off, as shown below.
  
In case of the query scope was set to a subset of the entire model, the behavior of the query engine was unspecified in case of references between scoped model elements and elements outside the scope, called '''dangling edges'''. In VIATRA 1.6 this behavior was cleaned up by adding a new indexer mode that always checks both ends of all indexed edges to be in-scope.
+
<source lang="java">
 +
BaseIndexOptions options = new BaseIndexOptions().withStrictNotificationMode(false);
 +
ResourceSet rSet = new ResourceSetImpl();
 +
EMFScope scope = new EMFScope(rSet, options);
 +
ViatraQueryEngine engine = ViatraQueryEngine.on(scope);
 +
</source>
  
For backward compatibility, this mode is turned off by default, but you can turn it on using its corresponding base index option as below. For new code we suggest to turn this mode on as it provides a more consistent behavior in a lot of cases; in a future VIATRA release this will be turned on by default.
+
In case of the query scope was set to a subset of the entire model, the behavior of the query engine was unspecified in case of references between scoped model elements and elements outside the scope, called '''dangling edges'''. In VIATRA 1.6 this behavior was cleaned up by adding a new  indexer mode that always checks both ends of all indexed edges to be in-scope. For backward compatibility, this mode is turned off by default, but you can enable it using its corresponding base index option as below. For new code we suggest to turn this mode on as it provides a more consistent behavior in a lot of cases; in a future VIATRA release this will be turned on by default.
  
 
<source lang="java">
 
<source lang="java">

Revision as of 05:47, 29 May 2017

Model Query Evaluation

VIATRA 1.6 provides a few new features that aim for better compatibility with various models the queries need to be evaluated on. In general, VIATRA should work out of the box the same way it worked before, but there are some settings that allow a more finely tuned behaviour for these cases.

Custom implementations of the EMF API (e.g. when generated code is manually modified) may violate EMF API contracts, and send incorrect notifications (e.g. duplicate model deletion events); similar situations can arise e.g. if there are custom EMF adapters that throw exceptions. In previous versions of VIATRA, this resulted in strange exceptions being thrown from the query backend. In version 1.6, the model indexer identifies most of these cases and provides a more precise error message describing what happens. It is also possible to tell the indexer to ignore (more specifically, log only) these incorrect notifications by turning the strict notification mode off, as shown below.

BaseIndexOptions options = new BaseIndexOptions().withStrictNotificationMode(false); 
ResourceSet rSet = new ResourceSetImpl();
EMFScope scope = new EMFScope(rSet, options);
ViatraQueryEngine engine = ViatraQueryEngine.on(scope);

In case of the query scope was set to a subset of the entire model, the behavior of the query engine was unspecified in case of references between scoped model elements and elements outside the scope, called dangling edges. In VIATRA 1.6 this behavior was cleaned up by adding a new indexer mode that always checks both ends of all indexed edges to be in-scope. For backward compatibility, this mode is turned off by default, but you can enable it using its corresponding base index option as below. For new code we suggest to turn this mode on as it provides a more consistent behavior in a lot of cases; in a future VIATRA release this will be turned on by default.

BaseIndexOptions options = new BaseIndexOptions().withDanglingFreeAssumption(false); 
ResourceSet rSet = new ResourceSetImpl();
EMFScope scope = new EMFScope(rSet, options);
ViatraQueryEngine engine = ViatraQueryEngine.on(scope);

Code generator updates

VIATRA Query Codegen Options.png

For users targeting other environment than Eclipse plug-ins, it is now possible to disallow the updating of MANIFEST.MF and plugin.xml files. The bundle manifest is updated to ensure all packages that contain query specifications are exported, while plugin.xml files are used by the query specification registry to load all patterns during runtimes.

This setting is available as a workspace-level preference or a per-project setting. By default, these settings are turned on (so both files are updated on each build), maintaining compatibility with previous releases.

The other major change relates to the handling of private patterns. Given private patterns are not expected to be used outside calling them from patterns in the same vql file, the generated code does not need all the type-safe wrappers generated. However, to make private patterns testable using the query test API, the generated QuerySpecification classes were moved to a dedicated package were they could be made public without exporting them to all users of the query bundles.

In complex metamodels described in Ecore and genmodel files there are often cross-references between files with absolute or workspace-relative urls. When compiling VIATRA queries using the maven compiler, these urls cannot be resolved automatically. EMF uses URI converters to define a mapping between such source and target model elements. Starting with VIATRA 1.6, you can now specify the location of metamodels referred to via platform:/resource URIs with the uriMappings configuration element. See this wiki page for more details.

Query Test Framework updates

Viatra Query Coverage report.png

The query testing capabilities of VIATRA were extended to support a wider range of models and queries. This required new customization options for the test definition DSL, including support for non-default EMF resources as models and using more generic Java types in the query result snapshots. For a more detailed definitions of these features look at the documentation documentation.

When testing your patterns, you can measure their test coverage (similar to what EclEmma does to Java code): the constraints described in the patterns that were used during the evaluation of the queries. The coverage can be reported as an HTML file which immediately shows which patterns need more testing. See the feature's documentation for details.

Documentation updates

VIATRA query explain message.png

To make it easier to get started with VIATRA, a tutorial is added that presents an example for query and transformation development. In order to make the tutorial available for even more users, this documentation is also included in the platform help.

A few error messages in the query editor related to enumerable and non-enumerable references had been reported to hard to understand. In this version the error messages have been updated, and a quick fix was also added that updates a detailed explanation for the message. In future versions we plan to extend this support to make other error messages more understandable.

GEF5-based visualization

VIATRA Rete Visualizer.png

The graph-based components, specifically the Rete visualizer, Local search debugger and the graph visualization support of Viewers, were updated to rely on the latest GEF version 5.0 (available with Eclipse Oxygen). This results in an updated, JavaFX based display and further bugfixes available for these components by default.

Following the dependencies of GEF5 to use these features in the future, JavaFX (available from Java 8) and e(fx)clipse is required to be installed.

Additional issues

For a complete list of fixed issues for VIATRA 1.6 consult https://projects.eclipse.org/projects/modeling.viatra/releases/1.6.0/bugs

Back to the top