Duality View Directives

Directives extend duality views with declarative supplemental logic for application-object augmentation, validation, and notification.

Duality views let applications represent application objects over normalized relational data and perform SQL/REST operations. Applications often need to extend these operations with additional logic. Common supplemental logic includes:

  1. Augmentation: Add values to an object when an application reads or modifies it. For example, compute a student’s total course count or GPA.

  2. Validation: Ensure that an object, including its augmented values, conforms to business rules. For example, set a maximum number of courses that a student can register for in a semester.

  3. Notification: Generate notifications when objects are created, modified, or deleted. Notifications support history tracking, replication, and event processing. The system tracks all affected objects whether an object changes through a direct table update or an update to a duality view with overlapping content. For example, when class timings change, notify all registered students.

Directives are a declarative construct that extends duality views by allowing applications to specify supplemental logic for duality-view operations. They have the following properties:

  1. Declarative: Directives use declarative SQL constructs that can involve expressions or PL/SQL functions.

  2. Use-Case Oriented: Directives are specific to a use case. Different directives can support different use-case-specific views. New use cases can use new views or directives without requiring changes to underlying table declarations.

  3. Tunable: For performance, applications can apply a directive only to explicitly modified objects. For completeness, applications can apply a directive to the closure of all modified objects.

Directives enable applications to add business logic directly to objects rather than rows, simplifying development. New SQL syntax supports directives on duality views. Applications can specify directive procedural logic in PL/SQL or JavaScript.

Directive Types

Use a directive type that matches the result you need from a duality-view operation.

Directive type Purpose
Validation directives Enforce business rules for documents during an operation or at transaction commit time.
Notification directives Record committed changes for applications that need change history or events.

Note: A directive type has its own supported operations, syntax, and restrictions. Review the directive topic before creating a directive on a duality view.

See Also: