The platform currently supports four types of simple constraints: consequence, exception, equality, and definiteness. For all simple constraints, an automatic resolution mechanism is supported. When this is enabled, instead of throwing an error the platform itself restores system integrity.
|Number of properties|
|Description||If the value of one property (the premise) is non-||Only one of the values of the specified properties must be non-||If the value of one property is non-||If all property parameters match specified classes, a non-|
|Statement||Not yet implemented||Not yet implemented|
|Auto-resolution||Two modes are supported:||If one of the properties changes to non-||If one of the properties changes to a non-|
* A change to
NULL is the following:
- For data properties - input
NULLor the default value for this property value class.
- For membership to a class - deleting an object / adding an object of a class for which belonging to the class is checked.
- For an aggregation constraint - (only if changing to non-
NULL) create an object of the base class (
System.Object), change to non-
NULLconditions of the aggregation constraint, write the values of the corresponding parameters to all grouping values.
Just as for a basic constraint, for each simple constraint, a base event must be defined, which determines when the specified constraint will be checked.
Note that the definiteness constraint is a special case of the consequence, in which the consequence is a property that must be defined, and the premise is its signature (a property obtained from it using the corresponding operator).
There is also an implicit fifth kind of simple constraint, uniqueness, but it is combined with an aggregation operator (which returns this most unique value), and therefore it is not considered here. Together with consequences, this type of constraint allows to implement the aggregation mechanism.
is(Sku s) = s IS Sku;
// the product must have a barcode and name specified
is(Sku s) => barcode(s);
is(Sku s) => name(s);
invoice = DATA Invoice (InvoiceLine);
is(InvoiceLine l) = l IS InvoiceLine;
// for a document line, a document must be specified, and when deleting a document, the lines of this document should be deleted
is(InvoiceLine l) => invoice(l) RESOLVE RIGHT;
// is equivalent to declaring document = DATA Invoice (InvoiceLine) NONULL DELETE;
// aggregation for f(a, b) create an object of class x, whose property a(x) equals a, and property b(x) equals b
f = DATA BOOLEAN (A, B);
a = DATA A(X);
b = DATA B(X);
is (X x) = x IS X;
f(a,b) => [ GROUP AGGR X x WHERE x IS X BY a(x), b(x)](a,b) RESOLVE LEFT;
is(X x) => f(a(x), b(x)) RESOLVE RIGHT;