Constraints

The Constraints aspect defines additional constraints on the structure of a language's concept instances, which can't be expressed in terms of Structure Language. This chapter considers the available constraints.

Property constraints

Generally speaking, "pure" concept properties are not properties, but only public fields. Property constraints allow you to make them real properties. Using these constraints, you can customize the behavior of a concept's properties. Each constraint is applied to the corresponding property.

property - the property to which this constraint is applied.

get - this method is executed to get property value every time it is accessed.

set - this method is executed to set property value on every write to it. The property value is guaranteed to be valid.

isValid - this method should determine whether the value of the property is valid. This method is executed everu time the value changes, and if it returns false, the set() method is not executed.

Referent constraints

Constraints of this type help to add behavior to links and make them more properties-like.

referent set handler - if specified, this method is executed on every set of this link.


search scope - this defines the set of nodes to which this link can point. The scope in this case represents a set of nodes. Sequence<node<>> or ISearchScope can be returned from this method.

resolve info - TODO

Can be child/parent

These are additional constraints determining whether instances of this concept can be parent (or child) nodes for other nodes.

Suppose you have a node A and it "can't be parent" of the node B, or B "can't be child" of A. In this case you won't be able to create B under A. Nevertheless, you can paste B into A even if these constraints are broken. In this case, places with broken constraints in your code will be underlined with red.

Default scope

Suppose we have a link pointing to an instance of concept C. When you edit this link, all instances of concept C from all imported models are visible by default.

In some cases you may want to change this default behavior. This is possible with default scope.

Previous Next

Labels

 
(None)