Validate EMF Models with Sphinx

Aus SDQ-Wiki
Wechseln zu: Navigation, Suche
Dialog-warning.png
The information on this page is deprecated: It is currently unclear, whether this is still a viable alternative for model validation.


If you want to validate whether an instance of an Ecore metamodel of the Eclipse Modeling Framework (EMF) complies to certain checks or invariants, you can use the Validation feature of Eclipse Sphinx instead of the old EMF Validation framework.

Features

  • uses methods annotated with @Check to validate model elements, like Xtext Validation framework but for any EMF-Model
  • severitites, error messages and check categories can be put into a catalog

Usage

  • extend
    • extend org.eclipse.sphinx.emf.check.AbstractCheckValidator
    • contribute extension to org.eclipse.sphinx.emf.check.checkvalidators extension point
  • annotate
    • annotate void methods with @Check, parameter defines type of elements to be checked
    • to narrow applicability / scope restrict a check to certain categories
      • a check is performed if at least one of the categories is selected by the user
      • if no category is provided, then the check pertains to all categories
  • raise
    • in the check methods call error(...), warning(...), or info(...) with fixed severity
    • or use issue(...) to use the severity that is given for the constraint in the catalog
      • for this the check notation has to specify a constraint id
  • run
    • right-click on object: validate -> check-based validation