1 Terry Halpin Neumont University [email protected] © 2006, T. A. Halpin ORM2 Perspectives:...

57
1 Terry Halpin Neumont University [email protected] www.orm.net © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling
  • date post

    18-Dec-2015
  • Category

    Documents

  • view

    225
  • download

    4

Transcript of 1 Terry Halpin Neumont University [email protected] © 2006, T. A. Halpin ORM2 Perspectives:...

Page 1: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

1

Terry HalpinNeumont University

[email protected]

© 2006, T. A. Halpin

ORM2 Perspectives:Objectification, Modality, and Tooling

Page 2: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

2

Contents

Objectification– Objectification in ORM, UML, and ER– Two Kinds of Nominalization– Objectification and Composite Reference Schemes – Objectification of Unary Facts– Objectification of Fact Types with Non-spanning UCs– Propositional Nominalization and Communication

Acts

Business Rule Modality– Introduction– Modal Operators and Rule verbalization– Embedded, Static Rules– Dynamic Rules

NORMA Tool Demo/Discussion

Page 3: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

3

Objectification in ORM, UML, and ER

Roughly speaking, objectification (a.k.a. nesting), treats a relationship instance as an object in its own right, so it may be talked about like any other object.

ORM example(ORM 2 notation):

Country(code)

Sport(name)plays

“Playing !”

AU cricketAU tennisNZ cricketUS tennis

Rank(nr)

is at

(AU, cricket) 1

(US, tennis) 1(AU, tennis) 4

Page 4: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

4

UML usually calls this reification, allowing association instances to be objectifiedas instances of an association class.

Unfortunately the name of the association class must matchthe name of the association (whether displayed or not).

UML example, augmented by non-standard notationfor preferred identification scheme “{P}” :

code {P}

Country

name {P}

Sport

rank [0..1]

Playing

**

Page 5: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

5

Industrial Entity Relationship Modeling (ER)(e.g. IE, IDEF1X, Barker ER) does not support objectification at all.

Some academic versions of ER do support objectification,typically with restrictions (e.g. objectified relationships may have attributes but not play in other relationships)

Example in Elmasri-Navathe ER notation(unable to specify attribute optionality):

COUNTRY SPORTPLAYS

CountryCode

M N

SportNameRank

Page 6: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

6

Two Kinds of Nominalization

Nominalization replaces a declarative sentence by a noun phrase,enabling the nominalized object to be referenced like any other object.

Two basic kinds of nominalization may be distinguished:

• Situational -- nominalized object is a state of affairs/event/activity

• Propositional -- nominalized object is a proposition

Elvis sang the song ‘Hound Dog’. -- original proposition

Elvis’s singing of the song ‘Hound Dog’ is popular. -- actual state of affairs

That Elvis sang the song ‘Hound Dog’ is well known. -- true proposition

That Elvis sang the song ‘Hound Dog’ is debatable. -- false proposition

Page 7: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

7

It’s snowing outside. -- original proposition

It’s true that it’s snowing outside. -- proposition

That snowing is beautiful. -- state of affairs

In ordinary speech, “fact” (i.e. fact instance) often means “true proposition”.

ORM uses “fact” in the weaker sense of

“proposition taken to be true”

(epistemic commitment by users in the business being modeled)

Page 8: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

8

Consider an object instance resulting from the objectification to Playing,

e.g. Australia’s playing of cricket.

Is this object a state of affairs/event/activity or is it a proposition?

Australia’s playing of cricket is at rank 1.

Makes sense if playing is an activity, but not if it’s a proposition.

Australia’s playing of cricket is true. -- Nonsense.

Country(code)

Sport(name)plays

“Playing !”

AU cricketAU tennisNZ cricketUS tennis

Rank(nr)

is at

(AU, cricket) 1

(US, tennis) 1(AU, tennis) 4

code {P}

Country

name {P}

Sport

rank [0..1]

Playing

**(a) (b)

Page 9: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

9

This is typical of objectification examples in information models.

“Objectified relationships” are typically states of affairs in 1:1 correspondence with the relationships (facts in the ORM sense)that they objectify,but are not identical with those facts.

So we reject this aspect of the UML metamodel,where AssociationClass is a subclass of Association and Class.

Page 10: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

10

Objectification andComposite Reference Schemes

To facilitate conceptual declaration of business rules (constraints or derivation rules) and queries on information modelsORM includes (implicitly or explicitly) link fact typesto support navigation betweenthe objectification result and the objects in the fact being objectified.

Country(code)

Sport(name)plays

“Playing !”Rank(nr)

is at

<< is by is of

Page 11: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

11

Default readings are assigned for link predicates, e.g.

The modelermay assignbetter readings,e.g.

Company(name)

acquired“Acquisition !”

is friendly

involves1 << involves2

Company(name)

acquired“Acquisition !”

is friendly

was by << is of

Page 12: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

12

ORM 2 supports multiple predicate readings and role nameswhose screen or print display may be suppressed individually.

ORM 2 allows rules and navigation paths to be declared in • relational style -- using predicate names• attribute style -- using role names• mixed style -- using both

Company(name)

acquired“Acquisition !” was friendly

was by /was acquirer in

<< is of

was acquired in

Microsoft Visio Microsoft Navision Visio InfoModelers

[acquisitionBySelf]

[acquirer] [target]

[acquisitionOfSelf]

[acquirer] [target]

Page 13: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

13

ORM 2 allowsobjectificationto be displayedin this way

but interprets this as shorthand for:

Asserting theequality constraintis the critical stepin treating thisas objectification.

Country(code)

Sport(name)plays

“Playing !”Rank(nr)

is at

<< is by is of

Playing !

Country(code)

Sport(name)

Rank(nr)is at

<< is by << is of

plays

Page 14: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

14

ORM 2 allows role sequences participating in constraintsto be disambiguated by role sequence numbers whose display may be toggled on/off.

Playing !

Country(code)

Sport(name)

Rank(nr)is at

<< is by << is of

plays1.1 1.2

2.1 2.2

Page 15: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

15

This model may be arrived at in different ways, e.g.

(1) Start with the fact type Country plays Sport, then objectify it as Playing.

(2) Start with the fact types Playing is by Country and Playing is of Sport, then define Country plays Sport as fully derived from them.

(3) Start with the 3 fact types Country plays Sport, Playing is by Country,

and Playing is of Sport, then assert the equality constraint.

Playing !

Country(code)

Sport(name)

Rank(nr)is at

<< is by << is of

plays1.1 1.2

2.1 2.2

Page 16: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

16

These 3 ways may be formalized as equivalences thus:

E1: x [Playing x y:Country z:Sport (x is by y & x is of z & y plays z)]

E2: x:Country y:Sport [x plays y z:Playing (z is by x & z is of y)]

E3: x:Country y:Sport z:Playing [x plays y (z is by x & z is of y)]

Regardless of which way is used to arrive at the model, the same basic structure is used to capture the model in the metamodel,and the same basic mapping procedures are used to transform itto implementation targets (e.g. Rmap, Omap, Xmap) -- under development

ORM 2 includes a formal, high level textual languagefor all its graphical rules as well as additional business rulese.g. the derivation rule E2 may be rendered as:

Country plays Sport iff some Playing is by Country and is of Sport.

Page 17: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

17

Objectification of Unary Facts

ORM previously forbad objectification of unary facts.For ORM 2, we removed this restriction, by extending the previous analysis toobjectified types with simple reference schemes.

Consider the unary fact:

The President named ‘Abraham Lincoln’ died.

We may objectify this event using the nominalization “that death”, and declare the following additional fact:

That death occurred in the Country with country code ‘US’.

Page 18: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

18

The schema is interpreted as shorthand for:

President(name)

Abraham Lincoln

George W. Bush Ronald Reagan

died

Abraham Lincoln Ronald Reagan

“Death !”

occurred in

Country(code)

Abraham Lincoln US Ronald Reagan US

AU

US CA

...

President(name)

occurred in

Country(code)

Death !

met / is of

died

Page 19: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

19

The earlier analysis for objectificationmay now be generalized by allowing the arity to be unrestricted (1 or more)and the reference scheme to be simple or composite.

The result of objectifying a relationship typemay be viewed asan entity type that has a reference schemewhose reference projectionbears an equality constraintto the fact type being objectified.

Page 20: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

20

FCO-IM also supports objectification of unaries,but in a very different way and for a different purpose.

FCO-IM uses defines non-lexical objectsas objectifications of roles played by lexical objects, e.g.

CountryCoderefers to a country

Country

While this approach is interesting, and is supported by twoDutch tools (CaseTalk and Infagon), this seems to conflate reference with referent,and to make it awkward to deal with multiple inheritance,context-dependent reference, and changes to reference schemes.

Page 21: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

21

Objectification of Fact Typeswith Non-spanning UCs

Previously, ORM allowed an association to be objectified only if either• it has just one uniqueness constraint, and this spans all its roles, • or it is a binary 1:1 association.

This restriction forbids objectification of 2 kinds of associations:

• An n:1 (or 1:n) binary association; • A ternary or longer association whose longest uniqueness constraint spans exactly n – 1 roles.

The above cases are allowed in UML, and those academic versionsof ER that support objectification.

ORM 2 allows these cases, subject to modeling guidelines.

Page 22: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

22

AIRPORTLEG

INSTANCEDEPARTS

DepTime

N1

Usually, objectifying an n:1 association is just bad modeling, e.g. consider this Elmasri-Navathe ER example1:

It’s simpler to remodel the departure timeas an attribute of just LegInstance.

1 Example from Elmasri, R. & Navathe, S. 1989, Fundamentals of Database Systems, Benjamin/Cummings Publishing, Figure 3.18, p. 63.

Page 23: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

23

To support thiskind of examplein ORM 2(whether or notit is the best way to model)

we interpretthe schema thus:

The 1:1 nature of the left-hand link fact type avoids denormalization on Rmapping.

GovtHead(name)

Country(code)was born in

“Birth”

Bill Clinton US George W. Bush US John Howard AU

Birth

GovtHead(name)

Country(code)

has/is of

<< is in

was born in

Page 24: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

24

For objectification, mandatory constraints are needed on all link rolesof the objectified type.e.g. if we remove a mandatory role constraint as shown below, Birth is no longer an objectification of GovtHead was born in Country.

Birth

GovtHead(name)

Country(code)

was born in

Bill Clinton US George W. Bush US John Howard AU

has /is of is in

Bill Clinton b1 George W. Bush b2 John Howard b3 Helen Clark b4

b1 US b2 US b3 AU

Page 25: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

25

The main case where it makes sense to objectify associationswith non-spanning uniqueness constraints, is when the UC(s) mayevolve over time (e.g. from non-spanning to spanning)and we wish to minimize the impact of such changes to the model.

A set of modeling guidelines, which also covers other cases is presented on the next slide.

Page 26: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

26

Modeling heuristic.1

A fact type may be objectified only if:

(a) it has only a spanning uniqueness constraint; or

(b) its uniqueness constraint pattern is likely to evolve over time, e.g. from n:1 to m:n, or m:n:1 to m:n:p; or

(c) it has at least two uniqueness constraints spanning n-1 roles (n > 1), and there is no obvious choice as to which of the n-1 role uniqueness constraints is the best basis for a smaller objectification based on a spanning uniqueness constraint; or

(d) the objectification significantly improves the display of semantic affinity between fact types attached to the objectified type.

1 For further discussion, see Halpin, T. 2003, ’Uniqueness Constraints on Objectified Associations’, Journal of Conceptual Modeling, October 2003. Online at: http://www.orm.net/pdf/JCM2003Oct.pdf.

Page 27: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

27

Propositional Nominalization and Communication Acts

The Business Rules Team submission to the OMG RFP onBusiness Semantics for Business Rules includes business rules thatmay be treated directly as cases of propositional nominalization, e.g.

If a waiter earns an amount of money as a tip from serving a meal, the waiter must report that fact.

Rather than introducing a second kind of objectification into ORM 2to deal directly with propositional nominalization, we recommend recasting such cases in terms ofsituational nominalization (e.g. as shown on the next slide).

Page 28: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

28

If a waiter earns an amount of money as a tip from serving a meal, the waiter must report that fact.

Waiter(EmpNr)

Meal(nr)served

“Service !”

earned a tip of

MoneyAmount(USD:)

… for serving … reported a tip of ...

2.1 2.2 2.3

1.1 1.2

1.3

Page 29: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

29

As regards modeling of communication acts, when it is of interest to model these acts, they are best modeled directly like any other business domain objects. e.g. in a genealogy model we might be interested in not just descriptions of states of affairs, but assertion acts made by researchers about states of affairs. Such a model might include fact types such as:

AssertionAct reported Proposition;

AssertionAct was made by Researcher with ConfidenceLevel; etc.

These comments relate to the information model only. For modeling communication processes, the information model should be supplemented by other kinds of model(e.g. interaction or workflow models) that provide a more intuitive and direct way of understandingessential business processes/services.

Page 30: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

30

For information modeling, objectification may be restricted tosituational nominalization, where the nominalized object is a state of affairs (event, activity …) rather than a proposition.

Objectification of facts (unary, binary, or longer)may then be interpreted in terms of entities whose reference schemesare constrained by equality constraintsinvolving reference projections from linking predicates.

Objectification of facts with non-spanning uniqueness constraintsshould be permitted, but subject to proposed modeling guidelines.

Communication acts may be included as domain entities in informationmodels, but some communication aspects are best specified withother kinds of model (e.g. interaction or workflow diagrams).

Summary

Page 31: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

31

Introduction

Modal Operators and Rule Verbalization

Embedded, Static Rules

Dynamic Rules

Business Rule Modality

Page 32: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

32

Introduction

Business Rules determine what states and state transitionsare possible or permitted for a given business domain,and may be of alethic or deontic modalities.

Alethic rules• impose necessities (e.g. implied by physical laws)• cannot be violated, even in principlee.g. Each Person was born on at most one Date.

No Component includes itself.

Deontic rules• impose obligations• ought to be obeyed, but may be violatede.g. It is obligatory that each Person is husband of at most one Person. It is forbidden that any Person smokes in any Office.

Page 33: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

33

Information modeling approaches such as ER, UML and ORMtypically restrict their coverage of rules to alethic rules.

In practice, many business rules are deontic,and it is often important to know when they are violatedso that actions can be taken to discourage future violations(whether or not support for this is automated).

In recognition of this need as well as for rule exchange etc.,the OMG is finalizing the SBVR1 (Semantics of Business Vocabulary and Rules) proposal to specify a business semanticslayer on top of its software-oriented layers.

1 Interim SBVR specification URL: www.omg.org/cgi-bin/doc?dtc/06-03-02.

Page 34: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

34

This presentation is based on the author’s logical formalization work for SBVR, and work on NORMA1

an open-source tool for ORM 2 (2nd generation ORM) which supports deontic and alethic rules.

The ideas discussed could be adapted for other approachessuch as ER and UML.

In fact, the NORMA tool is currently being extended toto support ER and UML notations as views of the underlying ORM model.

1 http://sourceforge.net/projects/orm

Page 35: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

35

Modal Operators and Rule Verbalization

Alethic Deontic

Reading Symbol Reading Symbol

It is necessary that It is obligatory that O

It is possible that It is permitted that P

It is impossible that

~ It is forbidden that F

Modal negation rules ~p ~p ~Op P~p~p ~p ~Pp O~p Fp

~Fp Pp

= true in all possible worlds = true in some possible worldFor static constraints, a possible world is a state of the business domain.

Page 36: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

36

(a)PERSON COUNTRY

the birthcountry of

a native of(b)

Person Country(c)

1*

Person(name)

was born in

Country(code)

Terry Halpin AU Robert Meersman BE Graeme Simsion AU birthCountry

NORMA displays alethic constraints in violetand verbalizes constraints in positive and negative forms.

The mandatory and uniqueness constraints in positive, combined form:

Each Person was born in exactly one Country.

(2 constraints: exactly one = some, and at most one).

This is read as a necessity. As an option, this may be made explicit:

It is necessary that each Person was born in exactly one Country.

Page 37: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

37

(a)PERSON COUNTRY

the birthcountry of

a native of(b)

Person Country(c)

1*

Person(name)

was born in

Country(code)

Terry Halpin AU Robert Meersman BE Graeme Simsion AU birthCountry

In positive form, NORMA also verbalizesthe lack of a uniqueness constraint on the right-hand role:

It is possible thatmore than one Person was born in the same Country.

Satisfying populations help illustrate constraints.

Page 38: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

38

(a)PERSON COUNTRY

the birthcountry of

a native of(b)

Person Country(c)

1*

Person(name)

was born in

Country(code)

Terry Halpin AU Robert Meersman BE Graeme Simsion AU birthCountry

The mandatory and uniqueness constraints verbalized separatelyin negative form:

For each Person, it is impossible thatthat Person was born in more than one Country.

It is impossible that any Person was born in no Country.

NORMA is being extended to support counterexamples toillustrate constraint violation and generate test cases.

Terry Halpin AU Terry Halpin US

Page 39: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

39

Alethic +ve: [It is necessary that] For each Room and HourSlot,

that Room at that HourSlot is booked for at most one Activity.

Alethic –ve:It is impossible thatthe same Room at the same HourSlot

is booked for more than one Activity.

The uniqueness constraint might be alethic (shown above) or deontic.

roomNr

Room

(a) (b)

dhCode

HourSlot

name

Activity

* 0..1

*

Booking

Room(nr)

HourSlot(dhCode)

Activity(name)

… at … is booked for ...

20 Mon 9 am ORM class20 Mon 4 pm CQ demo20 Tue 2 pm ORM class33 Mon 9 am CQ demo33 Fri 5 pm Party

Page 40: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

40

Deontic modality:

+ve: It is obligatory that for each Room and HourSlot, that Room at that HourSlot is booked for at most one Activity.

-ve: It is forbidden thatthe same Room at the same HourSlot

is booked for more than one Activity.

Room(nr)

HourSlot(dhCode)

Activity(name)

… at … is booked for ...

NORMA display deontic rules in blue, typically with an “o” for “obligatory”.

Page 41: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

41

NORMA screenshot

Page 42: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

42

NORMA currently allows modal operators only as the main operatorof the rule expression.

Some allowed SBVR formulations that violate this restrictionmay be transformed into an equivalent NORMA expressionby applying modal negation rules and the Barcan formulae and their converses, i.e.

x Fx x Fx x Fx x Fx

e.g. For each Person, it is necessary that that Person was born in at most one Country.

transforms to

It is necessary that each Person was born in at most one Country.

Page 43: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

43

x O Fx O x Fx

We also accept the following deontic variant of the Barcan formulae,allowing and O to commute.

This allows the following rule

For each Person, it is obligatory that that Person is a husband of at most one Person.

to be transformed to

It is obligatory that each Person is a husband of at most one Person.

Page 44: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

44

By normalizing rules to restrict modal operators to the main operator,the only impact on tagging a rule as a necessity or obligation is onrule enforcement. For static rules, no commitment to a specific modal logic is required.

Enforcement of a necessity rule never allows violations.

Enforcement of an obligation rule allows violations,but takes some remedial action(e.g. display a message to a relevant authority indicating violation of the rule including verbalization of the rule).

Page 45: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

45

Embedded, Static Rules

SBVR allows modal operators to be embedded anywhere inrule expressions. In rare cases, these rules cannot be transformedinto rules where the only modal operator is the main operator.

To support such cases, we have two alternatives• adopt a specific modal logic1

• replace the embedded modal operators by domain-level predicates

For the first alternative, we prefer S42.For the second alternative, we proceed as for embedded deontics(see later).

1 There are many normal modal logics (e.g. K, K4, KB, K5, DT, DB, D4, D5, T, Br, S4, S5) as well as non-normal modal logics (e.g. C2, ED2, E2, S0.5, S2, S3).2 Schema evolution may seem to violate S4 (its accessibility relationship between possible worlds in transitive), but we resolve this by treating such evolution at the metametalevel.

Page 46: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

46

Formally, we treat a model as an interpretationwhere each non-deontic formula evaluates to true.

A model is a permitted modelif the p in each deontic formula of the form Op evaluates to true

otherwise it is a forbidden model (though still a model).

This approach avoids the need to assign a truth valueto expressions of the form Op.

Page 47: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

47

Various metarules apply between alethic and deontic rules, e.g. the argument (role set) of a deontic uniqueness constraint must be a proper subset of the argument of an alethic uniqueness constraint.

This example satisfies this metarule:

However, if the marriage predicate were alethically 1:1, then no deontic uniqueness constraint may be added (if something is already necessary, it makes no sense to declare it obligatory).

Person(name)

is a husband of /is a wife of

Page 48: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

48

Some SBVR formulae (e.g. OPp) are illegal in some deontic logics,and deontic logic itself is rife with controversies.

If a deontic model operator is embedded, we first try to normalizethe formula using transformation rules such as p Oq .. O(p q)1

or deontic counterparts to the Barcan formulae.

In rare cases, embedded deontics cannot be so normalized.Rather than choosing a specific modal logic (a risky option),where possible we transform such cases into first-order formulaewith no modalities by replacing the modal operators by predicates at the business domain level.

Such predicates (e.g. “is forbidden”, “is permitted”) are reserved and given additional semantics (e.g. exclusion constraints between forbidden/permitted predicates).

1 In contrast to our approach, some versions of deontic logic reject this equivalence on the basis that agent control is restricted to the scope of modal operators.

Page 49: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

49

As a simple example, consider the following SBVR rule.

Car rentals ought not be issued to peoplewho are barred drivers at the time the rental was issued.

This deontic rule may be captured by the followingORM derivation rule for the partly derived domain fact typeCarRental is forbidden:

CarRental is forbidden if CarRental was issued at Time and

CarRental was issued to Person andPerson is a barred driver at Time.

The following slide shows the full ORM diagram for this case.

Page 50: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

50

CarRental

Person

Time

was issued to

was issued at

is abarreddriver

at*

is forbidden* -

* - CarRental is forbidden ifCarRental was issued at Time andCarRental was issued to Person andPerson is a barred driver at Time

wasbarred

at

wasunbarredat

* Person is a barred driver at Time1 iff Person was barred at a Time2 <= Time1 and Person was not unbarred at a Time3 between Time2 and Time1

Page 51: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

51

SBVR allows rules that embed possibly non-factual propositions. However, there does not appear to be any simple solution to providingexplicit, formal semantics for such rules. As a nasty example, consider the following business rule:

It is not permitted that some department adopts a rulethat says it is obligatory that each employee of that department is male.

This example includes the mention (rather than use) of an open propositionin the scope of an embedded deontic operator. One possible, though weak, solution is to rely onreserved domain predicates to carry much of the semantics implicitly,as shown in the following ORM schema.

Page 52: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

52

Department(Id)

Person(Id)

Rule(Nr)

is male

adopts“RuleAdoption” obligates the

actualization of

is forbidden * -

works for

<< employs

<< is of

<< is by

is of

* - RuleAdoption is forbidden if RuleAdoption is by a Department and is of a Rule

that obligates the actualization of a PossibleAllMaleState that is of the same Department

* PossibleAllMaleState is actual iff PossibleAllMaleState is of a Department and each Person who works for that Department is male

PossibleAllMaleState

is actual*

Some support for reification in the sense of propositional nominalizationis being added by Pat Hayes and Chris Menzel to the IKL language,while retaining first-order. When available, this may offer other optionsfor dealing with such cases.

Page 53: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

53

Dynamic Rules

Dynamic rules restrict the possible transitions between business states.

The rule may simply compare one state to the next (e.g. Salaries should never decrease)

or the rule may compare states separated by a given period (e.g. Invoices ought to be paid within 30 days of being issued).

The invoice rule might be formally expressed thus, assuming the relevant fact types exist in the conceptual schema:

For each Invoice, if that Invoice was issued on Date1

then it is obligatory thatthat Invoice is paid on Date2

where Date2 <= Date1 + 30 days.

Page 54: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

54

This rule might now be normalized to the following formulation, moving the deontic operator to the front:

It is obligatory that each Invoice that was issued on Date1

is paid on Date2

where Date2 <= Date1 + 30 days.

This transformation requires an equivalence rule such as

p Oq .. O(p q).

While this formula is actually illegal in some deontic logics, it does seem intuitively acceptable.

In principle, such formal transformation issues might be ignored, so long as the domain expert confirms that the normalized formulation agrees with his/her intended semantics.

Page 55: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

55

While it is obvious how to implement this rule in a database system, capturing the formal semantics in an appropriate logic (e.g. a temporal or dynamic logic) is a harder task.

One possibility is to provide a temporal package that may be importedinto a domain model, in order to provide a first-order logic solution.

Another possibility is to adopt a temporal modal logic (e.g. treat a possible world as a sequence of accessible states).

We prefer a first-order solution where possible.

Page 56: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

56

Summary

Many business rules are deontic rather than alethic.

This presentation discussed one way ofmodeling and verbalizing such rules in ORM 2,as supported by the open-source NORMA tool.

NORMA currently supports static rules wherethe only modal operator is the main operator.

Rules that cannot be transformed into such casesare challenging to adequately formalize and support,especially those involving embedded deontics or dynamic rules.

Some approaches were suggested to deal with such cases,but further research is needed to adequately address these complexities.

Page 57: 1 Terry Halpin Neumont University terry@neumont.edu  © 2006, T. A. Halpin ORM2 Perspectives: Objectification, Modality, and Tooling.

57

NORMA Tool Demo/Discussion