1 © amit mitra & amar gupta constraints constraints shape the lawful state space of an object...

21
1 © Amit Mitra & Amar Gupta Constrai nts Constraints shape the Lawful State Space of an object Create polymorphisms Constraints on value Homework: Read Supplementary materials Module 3 The generic constraint Supplementary materials Module 6

Upload: liliana-cain

Post on 23-Dec-2015

219 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: 1 © Amit Mitra & Amar Gupta Constraints Constraints shape the Lawful State Space of an object –Create polymorphisms Constraints on value –Homework: Read

1© Amit Mitra & Amar Gupta

Constraints

• Constraints shape the Lawful State Space of an object– Create polymorphisms

• Constraints on value– Homework: Read Supplementary materials Module 3

• The generic constraint– Supplementary materials Module 6

Page 2: 1 © Amit Mitra & Amar Gupta Constraints Constraints shape the Lawful State Space of an object –Create polymorphisms Constraints on value –Homework: Read

2© Amit Mitra & Amar Gupta

Attribute Value Constraint is a partition

OBJECT

.......PARTITION

partitioned by[partition of]

Partition based on State

Attribute Value Constraint(Partition based on value of a

single property)

Inclusion Set Exclusion Set

Is a subtype ofIs a subtype of

Is a subtype of

Is a subtype ofSubtyping Criteria

Partition of a partition based on Inclusion/Exclusion of states

Page 3: 1 © Amit Mitra & Amar Gupta Constraints Constraints shape the Lawful State Space of an object –Create polymorphisms Constraints on value –Homework: Read

3© Amit Mitra & Amar Gupta

Value Value Value Range

VALUE SET

Range

Union of 1 or more

Value Set

VALUE SET

STATEFUL SUBSET OF A DOMAIN

Page 4: 1 © Amit Mitra & Amar Gupta Constraints Constraints shape the Lawful State Space of an object –Create polymorphisms Constraints on value –Homework: Read

4© Amit Mitra & Amar Gupta

NOMINAL DOMAINS• Inclusion set:

– Property may take any value in inclusion set, and no other. Eg:• Person may only be Male or Female

• Playing card may only be Joker, Spade, Club, Heart or Diamond

• Exclusion set:

– Property may not take a value in exclusion set. Eg:• New Mexico Whiptail lizard may not be Male

= May only be Female

Irreducible fact normalized by inclusion set

Irreducible fact normalized by exclusion set

IMPOSSIBLEWe know how many values the set has and what all of them are

We know neither the cardinality, nor all the values in the set

We know how many values the set has, but not what all of them are

No. of values in Value SetKnownUnknown

Exhaustive Partition

Eg. The set has 5 values, of

which 2 are not known

Exhaustive Partition?

Eg. 3 values of an indeterminate number are known

Non-exhaustive Partition

We know every value but not how

many there are

Act

ual

val

ue

Kn

own

Un

kn

own

IMPOSSIBLE

“Optional” Attributes

or Hermaphrodite

Page 5: 1 © Amit Mitra & Amar Gupta Constraints Constraints shape the Lawful State Space of an object –Create polymorphisms Constraints on value –Homework: Read

5© Amit Mitra & Amar Gupta

NOMINAL DOMAINS

IMPOSSIBLEWe know how many values the set has and what all of them are

We know neither the cardinality, nor all the values in the set

We know how many values the set has, but not what all of them are

No. of values in Value SetKnownUnknown

Exhaustive Partition

Eg. The set has 5 values, of

which 2 are not known

Exhaustive Partition?

Eg. 3 values of an indeterminate number are known

Non-exhaustive Partition

We know every value but not how

many there are

Act

ual

val

ue

Kn

own

Un

kn

own

IMPOSSIBLE

• Inclusion set: –Can sometimes, but not always be sure we are “lawful”

–Often implemented in systems as “Optional” properties

• Exclusion set: –May spot violations, but cannot be sure we can catch them all

–If the sole member of an exhaustive exclusion set is the Unknown Value, it is a mandatory property

• Is “Mandatory Attribute” a misnomer?: In this sense it means that the attribute value must be known, a stricter condition than asserting that the existence of the attribute must be mandatory.

KnownRisk?

UnknownRisk

Page 6: 1 © Amit Mitra & Amar Gupta Constraints Constraints shape the Lawful State Space of an object –Create polymorphisms Constraints on value –Homework: Read

7© Amit Mitra & Amar Gupta

AttributeValue

AttributeMust take only 1

Is valid/invalid for(constrain)

AGGREGATE OBJECTSET OF VALUES

ATOMIC RULES NORMALIZED BY AGGREGATE RELATIONSHIP

•Constraining Relationship (Object Class)

ConstrainingValue

ConstrainingValue

ConstrainingValue

ConstrainingValue

ConstrainingValue

OBJECT A

Subtype of Attribute’s

domain

OBJECT CConstraining Set

OB

JEC

T B

(constrain)

is invalid(excluded by)

Is valid (i.e., included by)

SUBTYPE B1•Exclusion Relationship

(Object Class)

SUBTYPE B2•Inclusion Relationship

(Object Class)

Is subtype of

Is subtype of

•Number of distinct Values•Number of values “unknown”

ATTRIBUTES OFVALUE SET

•Number of distinct Values•Number of values “unknown”

ATTRIBUTES OFVALUE SET

Example of “role”

Same as “constrain”

?

?

If both B1 and B2 are exhaustive, B will be exhaustive, but not vice-versa

Page 7: 1 © Amit Mitra & Amar Gupta Constraints Constraints shape the Lawful State Space of an object –Create polymorphisms Constraints on value –Homework: Read

8© Amit Mitra & Amar Gupta

Range

UpperBoundValue

The set cannot be emptyLowerBoundValue

(OPTIONAL)At most 1

(OPTIONAL)At most 1

Page 8: 1 © Amit Mitra & Amar Gupta Constraints Constraints shape the Lawful State Space of an object –Create polymorphisms Constraints on value –Homework: Read

10© Amit Mitra & Amar Gupta

ValueValue ValueValue ValueValue ValueValue RangeRangeVALUE SET

Subtype of Attribute’s

domain

(Object A)

THE STRUCTURE OF RANGE

RANGE

LowerBoundValue

LowerBoundValue

(OPTIONAL)At most 1

The set of bounds cannot be empty

UpperBoundValue

UpperBoundValue

(OPTIONAL)At most 1

IMPLIES

AGGREGATE OBJECTSET OF VALUES OR RANGES

METAMODEL OF RANGE

VALUE SET

Value

May be upper bound of 0 or more[May have 0 or one upper bound]

May be lower bound of 0 or more[May have 0 or one lower bound]

At least one must existRange ValueValue

May be upper bound of 0 or more[May have 0 or one upper bound]

May be lower bound of 0 or more[May have 0 or one lower bound]

At least one must existRange

Jane is a woman who adores blue cars, likes red cars a lot, green cars a little, is neutral about white cars, and dislikes black cars a little. Thus it is possible to rank Jane’s color preference in order of magnitude, but it is impossible to say how much she prefers one car color above another.

ADORES LIKES A LOT

LIKES A LITTLE

NEUTRAL DISLIKES A LITTLE

Jim, the sales manager of a car showroom knows Jane’s car color preferences. He asks Charles, the car sales man, to show Jane cars of colors she is at least neutral about. Thus neutrality in preference for car colors is the lower bound of the range of car colors he will show Jane. In other words, the attribute is Person’s car color preference. The range is neutral or greater car color preference, and the lower bound of the range is neutral car color preference. The range has no upper bound.

Charles, unfortunately, loathes Jane secretly because she had once turned him down for a date. Charles is a petty man who does not want to show Jane cars with colors she will like. On the other hand he is afraid of disobeying Jim. He strikes a secret compromise with himself. He decides he will show Jane cars with colors which, at worst she will dislike only a little, and at best colors she will like only a little. Thus Charles sets the upper bound of the car color preference range at Likes a little for cars he intends to show Jane, and the lower bound for the range at dislike a little. Thus a range may have an upper bound, a lower bound or both. This range constraint is an inclusion set. The cars Charles intended to show Jane had to take a value from in this range of car color preference.

Ranges can also be exclusion sets. For example, Jim could have asked Charles not to show Jane cars of colors she neither likes nor dislikes, or worse (neutral car color preference or car colors she dislikes even a little). This would then be an exclusion set for car color preference with an upper bound (neutrality) - Jim would have excluded this range of Jane’s car color preference from cars he would show her, i.e., values in the range would not be permitted.

ORDINAL DOMAINS

Page 9: 1 © Amit Mitra & Amar Gupta Constraints Constraints shape the Lawful State Space of an object –Create polymorphisms Constraints on value –Homework: Read

11© Amit Mitra & Amar Gupta

QUANTITATIVE DOMAINS• Question: Are the following statements identical?

1.The thread must be two feet long or less

2.The thread must be less than two feet long• Answer is No

1.is a range with a closed (upper) bound

2.is a range with an open (upper) bound– Upper and/or lower bounds of ranges of quantitative values may be open or closed

• In ordinal domains – The expression “must be less than the nth rank” is equivalent to “must be (n-1)th rank or less”– The expression “must be greater than the nth rank” is equivalent to “must be (n+1)th rank or

more”– In ordinal domains, open and closed bounds are merely different expressions of the same

meaning– This meaning is also an irreducible fact

Page 10: 1 © Amit Mitra & Amar Gupta Constraints Constraints shape the Lawful State Space of an object –Create polymorphisms Constraints on value –Homework: Read

16© Amit Mitra & Amar Gupta

Limit 1 or more[limited by 1 or 2]

Exclu

ded

from0 or m

ore

Is subtypeofIs subtype

of

OPENBOUND

Range

If the limiting relationshipexists, the other must, tooand vice-versa(the two sets are equal)

Must contain 1 or more[be contained in 1 or more]

Is valid/invalid in 1 or more(I.e., included/excluded from range)

[bounded by 1 or 2]

The two sets are equal(the limiting value of a given

range, must be either included orexcluded from the range)

Cannot exceed 0 ormore

[cannot be exceededby 0 or 1]

Cannot be exceededby 0 or more[cannot exceed 0 or 1]

Is subtypeof

Is subtypeof

LOWERBOUND

UPPERBOUND

BOUND(Aggregate Object)

LimitingValue

(Ordinal or

Quantitative)Value inRange

Inclu

ded in0 or m

oreCLOSEDBOUND

Is valid/invalid in

(i.e., included

/excluded from

range)

is s

ubty

pe o

f

Ordinal or

QuantitativeValue

LimitingValue

Range

Valuein a

Range

Limit 1 or more[limited by 1 or 2]

is subtypeof(ROLE)

The twosets areequal

Attribute

(ROLE)

(ROLE)

A value in a domain need notbe an attribute value, but thosethat are, are playing that role.They are subtypes of Valuebased on having thatrelationship with Attribute.

Must take only 1[may be value of 0 or more]

SAME OBJECT

SAME OBJECT

SAME OBJECT

SAME OBJECT

SAME OBJECT

Establishing the limits of a range is only one of several roles of an ordinal or quantitative value

The pattern of information that defines the concept called “Bound”

THE SEMANTICS OF “BOUND”(See Box 29 in Module 3 of supplementary materials)

Page 11: 1 © Amit Mitra & Amar Gupta Constraints Constraints shape the Lawful State Space of an object –Create polymorphisms Constraints on value –Homework: Read

17© Amit Mitra & Amar Gupta

Merging Value Sets

• Merging value sets creates a new perspective.

–Perspective is an object. It changes state

–The old value sets and ranges go away and are subsumed into the merged range/value set

• Identical values merge into one value

–A set does not distinguish between identical members (a list does)

–Ranges merge• Open overlapping ranges cannot merge

– The limiting value is excluded from the range, hence it will always divide a merger, or will cause a conflict– A conflict creates a Null State. Null represents lack of meaning, not magnitude (Nil)

• Open and Closed overlapping ranges may merge if an overlapping “edge” (limit) is the “Unknown Value”– Because Known values will override unknown values

• If an open limit is Known, the range will be divided at the limit(s) into separate ranges

• Inclusion sets may only merge with Inclusion sets

• Exclusion sets may only merge with exclusion sets

RangeRange Range

Page 12: 1 © Amit Mitra & Amar Gupta Constraints Constraints shape the Lawful State Space of an object –Create polymorphisms Constraints on value –Homework: Read

18© Amit Mitra & Amar Gupta

Contains 1 or more[contained in 0 or more](Inherited relationship)

RangeBOUND

must have 1 to 2

Lower Bound

Upper Bound

Upper/LowerBound Partition

ClosedBound

OpenBound

Subtype of

Closed/OpenPartition

may have 0 or 1

Subtypes of

may have 0 or 1

Subtype ofSubtype of

Ordinal orquantitative

ValueSubtypeof

Value Set

Union of0 or more

Value

Subtypeof

Contains 1 or more[contained in 0 or more]

Attribute

Must takeonly 1

Limit of 0 or more[must specify 1 limiting]

Subtype of

Limit all values in 1 or more[values limited by 1 or 2]

Sets are equal

Constrains 0 or more[constrained by 0 or more]

VALUE CONSTRAINT

DOMAIN

Fragment frommetamodel ofattribute

is a subtype of

Equalsets

Value Constraint(Partition based on

value of a singleattribute)

InclusionSet

ExclusionSet

Is a subtypeof

Partition based on Inclusion/Exclusion of states

merger of0 or more

merger of 0or more(inherited)

merger of 0or more

(inherited)

merger not permitted

may merge with only 0[may merge with only 0]

Value

constrainParameter

of

Parameterof

limit ofbound

containedin value set

MERGER IMPLIES UNION OF VALUE SETS

SAME OBJECT

SAME OBJECT

Metamodel of a simple value constraint• How do constraints on objects flow to subtypes?

– Subtypes may be more, but not less constrained than their supertype• A constraint on the subtype/Polymorphism may be stricter than a constraint on its parent, but the subtype cannot violate

the lawful state space of its parent• Constraints on cardinality are an example of this

• RULE– The cardinality constraints of a subtype relationship may be stricter than its parent, but cannot violate the cardinality of the

parent

Page 13: 1 © Amit Mitra & Amar Gupta Constraints Constraints shape the Lawful State Space of an object –Create polymorphisms Constraints on value –Homework: Read

20© Amit Mitra & Amar Gupta

COMPLEX VALUE CONSTRAINTS

Page 14: 1 © Amit Mitra & Amar Gupta Constraints Constraints shape the Lawful State Space of an object –Create polymorphisms Constraints on value –Homework: Read

21© Amit Mitra & Amar Gupta

CFO’sSignature

CEO’sSignature

Payabilityof Check

JOINT CONSTRAINT(relationship)

Rent EnergyFee

CheckAmount

Amount=Rent + Energy fee(quantitative relationship)

A Joint Constraint is the repository of a single

atomic rule that mutually relates all participating

attributes (objects)

A quantitative relationship can contain a mathematical formula that involves each participating

attribute(A single atomic rule that relates

all participating attributes)

Constraints that bind more than 2 objects

Examples of a 3 way constraints between states

Joint constraint Magnitude constraint

RULE EXPRESSIONS

A KIND OF INCLUSION SET

A KIND OF INCLUSION SET

Could have been an exclusion set Could have been an

exclusion set

Could have been ranges

Could have been value sets

Could have been ranges

Could have been value sets

Ordinal Rules values could lead

to sequencing

rules

Duration of a process cannot be less than the duration of its longest

subprocess

Page 15: 1 © Amit Mitra & Amar Gupta Constraints Constraints shape the Lawful State Space of an object –Create polymorphisms Constraints on value –Homework: Read

24© Amit Mitra & Amar Gupta

ValueOf 1 or moreJoin with 1 or more[join with 0 or 1]

Expression of Rule Inclusion/Exclusion

Include

Exclude

Su

btyp

e of

Inclusion/Exclusion Partition

(RULE) CONSTRAIN

Value SetMay be used by 0 to many

[involve values in 1]Value Set

EXAMPLES OF STATIC RULES

• Percentages must add up to 100• The area of a rectangle is the product of its sides• The height of a room cannot exceed the height of the

building it is in• These are parts of a car (a relationship between objects)

EXAMPLES OF DYNAMIC RULES• Assemble the car from its parts• The check must be signed before it is payable

PROCESS

Page 16: 1 © Amit Mitra & Amar Gupta Constraints Constraints shape the Lawful State Space of an object –Create polymorphisms Constraints on value –Homework: Read

26© Amit Mitra & Amar Gupta

•ORDER= No of Sets (Classes) involved

•DEGREE=No. of values (objects) involved

•STATIONARITY=Rule and/or value set changes over time

RELATIONSHIPS BETWEEN ATTRIBUTES

objectValue A1 value C1(image of value A1)

RULE

DOMAINOF RULE

CODOMAINOF RULESET A

(set of all permitted values of

attribute A)

SET C(set of all permitted values of

attribute C)

object

value C1(image of

combination of values)

RULE

DOMAINOF RULE

CODOMAINOF RULE

SET ASet of all

permitted values of an

attribute (attribute A)

SET CSet of all permitted values of a different attribute (attribute C)

Value A1

COMBINATION OF ATTRIBUTES’

VALUESSET B(set of all permitted

values of a another

attribute (attribute B)

Value B1

DOMAINOF RULE

INVERSE OF RULE

Page 17: 1 © Amit Mitra & Amar Gupta Constraints Constraints shape the Lawful State Space of an object –Create polymorphisms Constraints on value –Homework: Read

27© Amit Mitra & Amar Gupta

Value ValueInclusion/ExclusionMay be contained in 0 to many

[contain 1 to many]Of 1 or more

Attribute

Must take only 1

[of 0 or more]DOMAIN

FRAGMENT FROM

METAMODEL OF ATTRIBUTE

is a subtype of

Equal sets

of only 1

Expression of Rule

term in 0 or more[conjoined via operator with 0 or more]

RULE MEANING

Expressed by 1 or more[expression of 1]

Include

Exclude

Subtype of

Inclusion/Exclusion Partition

CONSTRAIN

Subtype of

Value SetMay be used by 0 to many

[involve values in 1]

CONSTRAIN

Inclusion/ Exclusion

Expression of Rule

UML SYNTAX

10..*

*

Meaning of Rule

1

*

Join with 1 or more[join with1 or more]

E.g. Area of a rectangle (of sides of length “a” and “b”)

UNKNOWN

Business Process Automation

Business Rules (Meaning)

Layer

TR

AN

SFO

RM

E.g. 1. (a+b)2

2. a2+b2+2a.b

Rule meaning may be used elsewhere• Eg: the area of a square may be used to compute the volume of a cube

The concept called “Constrain” depends on inclusion/Exclusion for its very existence

Cardinality constraint

Normalizing Ignorance

•Know two or more attributes are related, but not how•Not know which attributes participate in a rule•Know which attributes participate in a rule, but not all their values•Not know whether to include or exclude•Know the meaning of a rule, but not how it might be expressed/calculated

–Eg: know exposure to advertising will influence sales, but not how, or all the variables involved

•When the co-domain is quantitative, know some, but not all terms of the rule expression

–Assign “Don’t Know” value to some terms

Page 18: 1 © Amit Mitra & Amar Gupta Constraints Constraints shape the Lawful State Space of an object –Create polymorphisms Constraints on value –Homework: Read

28© Amit Mitra & Amar Gupta

RULE

Expression of RuleRULE MEANINGExpressed by 1 or more

[expression of 1]

Normal Form of expression

Subtype of Equivalent to 0 or 1[equivalent to of 0 or more different]

Page 19: 1 © Amit Mitra & Amar Gupta Constraints Constraints shape the Lawful State Space of an object –Create polymorphisms Constraints on value –Homework: Read

29© Amit Mitra & Amar Gupta

IMPLICATION

COUNT•Add the flow of time

House TownLocated in 1

[location of 1 or more]

LIVE IN 1[LIVED IN BY 0 OR MORE]

Person Live in 1[lived in by 0 or more]

EXAMPLE OF IMPLICATION (TRANSITIVITY) WITH OBJECT CLASSES

SET OFNUMBERS

SET OFINSTANCE

IDENTIFIERS

SET OFNUMBERS

RULE: MAP EACH INSTANCE IDENTIFIER TO THE NUMBER “1” RULE: SUM ALL MAPPED NUMBERS

IMPLIED (RESULTING) RULEADD ONE FOR EACH INSTANCE

IDENTIFIER

EXAMPLE OF IMPLICATION (TRANSITIVITY) WITH DOMAINS

Page 20: 1 © Amit Mitra & Amar Gupta Constraints Constraints shape the Lawful State Space of an object –Create polymorphisms Constraints on value –Homework: Read

30© Amit Mitra & Amar Gupta

Include/Exclude

May be contained in 0 to many[contain 1 to many]

Value1 or more

[constrained by 0 or more]

Join with 1 or more[join with 0 or 1]

Expression of Rule

term in 0 or more[conjoined via operator with

0 or more]

Value Set

May be used in 0 to many[involve values in 1]

RULEMEANING

Expressed by 1 or more[express 1]

IRREFLEXIVE RELATIONSHIP

ORDER OF A CONSTRAINTWhen a constraint constrains another constraint (Constraining set)

Constraining set

RECURSIVERELATIONSHIP

CONSTRAINING STATE SPACE•Collections of constraints may define the lawful state space of an object

•The collection is an object•Collections may merge

•Members of the original collection will merge, constrained by the rules we have discussed

Page 21: 1 © Amit Mitra & Amar Gupta Constraints Constraints shape the Lawful State Space of an object –Create polymorphisms Constraints on value –Homework: Read

31© Amit Mitra & Amar Gupta

READING ASSIGNMENT

Module 3