Adding constraints and rules

In addition to the basic cardinality constraints for slots, additional constraints can be specified

Unique Key

A class can declare unique_keys, a set of slots that are unique for members of that class.

identifiers are special cases of unique keys.

Patterns

The value of a slot can be constrained to conform to a particular string pattern using the pattern metaslot

Example:

  slots:
     phone:
       pattern: "^[\\d\\(\\)\\-]+$"   ## regular expression

String serialization

A rule for generating the string value of a slot can be specified as a string_serializationpattern

Note: this may not yet be implemented in all frameworks

Minimum and Maximum values

Any numeric value can have minimum and maximum values specified