Creating and modifying validation constraints

You can create sets of constraints that are associated with particular domain projects. When you create new elements in a project, or update existing ones, the constraints are applied automatically.

Before you begin

You must be logged in to the Design Management Server with an ID that has permissions to create, edit, and delete constraints.

Before you can create validation constraints, you must include Model Constraints when you specify the details of the domain.

About this task

You can validate domain models by creating model constraints and applying them to designs. Model constraints, also referred to as constraint sets, are elements that contain a collection of constraints. When you create a model constraint, you can specify the following types of constraints:
  • Property constraints are applied to the properties of elements in the design.
  • Class constraints are applied to the classes in the design.

When you create a constraint, you can specify a scope for each type of constraint by selecting the property or class in the domain ontology that the constraint applies to. You can also set up restrictions on domain classes. For more information about restrictions, see Adding model constraints

Procedure

  1. Open a Domains project and, on the Designs menu, click Create Design Resource > Model Constraint.
  2. Optional: In the Model Constraint editor, click in the title field and type a name.
  3. Optional: In the Description field, add details about the constraint set.
  4. To create a class constraint or a property constraint, click the corresponding Add link.
  5. In the window that opens, provide details about the constraint. The following table outlines the information that you must provide for each type of constraint.
    Property Value used in each type of constraint Description
    Label Text string (Property or Class constraints) Type a name for the constraint.
    Language Range, Regular Expression (Property constraints only)

    JavaScript, SPARQL (Property or Class constraints)

    Select the language to use for the constraint.
    Live True/False (Property or Class constraints) If this check box is selected, when you modify an element, the change is validated immediately. If this check box is not selected, validation occurs when you save your changes.
    Message Text string (Property or Class constraints) Type text to display when the constraint is not satisfied. You can make the message specific to the actual problem by including variables from SPARQL queries or JavaScript.
    Note: The variable from a SPARQL query must be preceded by "?".
    Result True/False (Class constraints only) If this check box is selected, the results of the validation are inverted.
    Severity Info, Warning, or Error (Property or Class constraints) Specify a severity level for the constraint. When you validate a model, the constraints are grouped by severity on the validation page.
    Description (Optional) Rich text Provide more details about the constraint.
    Expression String (Property or Class constraints) If SPARQL is the selected language, you can use SELECT queries.
  6. To specify a scope for a constraint, in the Class section or Property section, click Add and, in the respective Add Class window or Add Property window, complete the following steps:
    1. Select a search type from the list.
    2. Type a search term in the field and select a class or a property from the list.
    3. To save the defined scope, click OK.
  7. To save the new class or property constraint, click OK. The new constraint is displayed in the corresponding Constraint section of the constraint set editor.
  8. Click Save. To see the new constraint set in the Explorer view, click the Explore in Tree icon.

Feedback