| |
| |
|
ORM2 Syntax Primer: Constraints
|
|
|
|
| |
Location: Blogs ObjectRoleModeling.com Web Log ORM2 |
 |
| Posted by: Scot Becker |
2/26/2006 |
Internal UCs
Internal uniqueness constraints in ORM2 are similar to those in ORM1 except that they have no double-tipped arrow points, which no body drew (free-hand) anyway.

If an internal uniqueness constraint indicates the preferred reference mode for an object type, it is shown with two lines (instead of the "P" notation used in ORM1). Notice that the nomenclature for this type of constraint has changed from "primary" to "preferred"; this is because not all preferred reference modes become primary keys in a relational mapping (for example, a co-referenced object type has a preferred reference mode that forms no table, and thus no primary key, if that object type itself has no functional roles).

The arrow tips in ORM1 actually served a purpose other than to annoy the person trying to draw them: when a constraint spanned non-contiguous roles of a ternary or higher predicate, the arrow tips were only on the ends of the line in order to disambiguate the spanning constraint from, say two single role uniqueness constraints. In ORM2, such non-contiguous role spanning constraints are indicted via a dashed line over the non-spanned role. For example, in the drawing below, each of the three predicates on the right (and the predicate in the bottom-middle) have a uniqueness constraint that doesn't span the middle role.

External UCs
Like ORM1, external uniqueness constraints in ORM2 are shown by a symbol inside of a constraint bubble. However, due to the goal of making the symbols non-English specific, the U and P symbols have been replaced by lines: one for unique and two for preferred reference mode.

Mandatory Constraints
Mandatory constraints in ORM2 are the same as for ORM one: a) simple mandatory constraints are shown as a dot on the role connector line -- at either the object type or role end, and b) disjunctive mandatory constraints (i.e. an inclusive-or across two or more roles) are shown as a dot inside of the constraint bubble.


Set Comparison
Set comparison (subset, equality, exclusion) constraints are not changed in ORM2.




Frequency/Value
The display of frequency and value constraints remains unchanged in ORM2. However, open range value constraints (e.g. positive real numbers with no upper boundary: > 0) are now supported. In addition, value constraints can now be applied to roles (e.g. the allowable values for a given role could be restricted to a subset of the allowable values of its related object type) as well as object types.
Ring Constraints
Ring constraints in ORM2 now use symbols (instead of their English-based constraint type abbreviations) and have no connecting role lines (that just got in the way anyway).

Subtypes
The display of subtypes in ORM2 remain (as in ORM1) as directed acyclic graphs but now support the explicit display of exclusion and totality constraints defined by the subtype definitions and related fact types.
For example, in the schema below, a Person is defined as a Party of Party Type "P" and an Organization is defined as a Party of Party Type "O". Since each Party can be of at most one Party Type (enforced by the internal uniqueness constraint), and since each Party must be of some Party Type (enforced by the mandatory constraint), the subtypes are said to be exhaustive and exclusive. In other words, every Party must be either a Person or an Organization, but not both. This can now be explicitly shown on the diagram in ORM2 by attaching exclusion and mandatory constraints on the subtype arrows.

|
|
| Permalink |
Trackback |
|
|
|
|
Note: To comment on a blog post, you must be logged in.
|
|