1 ©Amit Mitra & Amar Gupta RELATIONSHIPS Reading Assignment Supplementary module 5
Mar 29, 2015
1©Amit Mitra & Amar Gupta
RELATIONSHIPS
Reading Assignment
Supplementary module 5
2©Amit Mitra & Amar Gupta
A RELATIONSHIP IS AN INTERACTION BETWEEN OBJECTS
product customer retailer
is sold to.. buys thru...
product customer retailerXX
CARTESIAN PRODUCT
product 1 customer 1 retailer 1
product 1 customer 1 retailer 2
product 1 customer 2 retailer 1
product 1 customer 2 retailer 2
product 2 customer 1 retailer 1…...
Relationship Class
Relationship Instances
Order of relationship = No. of classes involvedDegree of relationship = No. Of object instances involved
EXAMPLE OF A RELATIONSHIPS BETWEEN OBJECTS
(3rd order, 3rd degree relationship)
3©Amit Mitra & Amar Gupta
object
object 1 object 2Instance of relationship
OBJECT CLASSA
object 1 object 2Instances of relationship
inverse of relationship
OBJECT CLASSB
OBJECT CLASSA
OBJECT CLASSB
Instance of inverse of relationship
object 4object 1 Instances of relationship
object 2
OBJECT CLASSB
OBJECT CLASSA
Instance of inverse of relationship
Instance of inverse of relationship
BIJECTIVE RELATIONSHIP(1 to 1)
INJECTIVE RELATIONSHIP(1 to many)
SURJECTIVE RELATIONSHIP(many to 1)
MANY to MANY
object 3Instance of inverse of
relationship
CAREFULL!!! (2nd order, 2nd degree relationship)
•Cardinality or Cardinality Ratios may be constrained
– Usually cardinality ratios in both directions are specified
4©Amit Mitra & Amar Gupta
PERSON
ORGANIZATION
many to many
manytomanyresolution
PERSON
ORGANIZATION
Personemployed InOrganization
0 to many
Employ0 to many
may b
e emp
loyed b
y 0 or more
[emp
loy 0 or more]
MANY-TO-MANY RESOLUTION
5©Amit Mitra & Amar Gupta
object instance 1
OBJECT CLASS
Object instance 2
Instance of reflexive relationship
Instance of irreflexive
relationship
RECURSIVE RELATIONSHIPS
(homogenous facts)
Idempotent relationship must loop back to the same object instance(1st order, 1st degree relationship)
(1st order, 2nd degree relationship)
(1st order relationships, degree unknown)
• Symmetrical: Inverse must be same as relationship– Eg: Person is relative of Person
• Asymmetrical: Inverse cannot be same as relationship– Eg: Person is parent of Person– Cartesian Product
• Antisymmetrical (for reflexive relationships only): Inverse cannot be same as relationship unless it loops back to the same object instance, in which case the relationship must be the same in both directions.– Eg: Arithmetic subtraction– Poymorphism of patterns of separation
SYMMETRY
Subtype of
6©Amit Mitra & Amar Gupta
Instance
Class
OBJECT
Instance
Class
OBJECTClass
Instance
OBJECT
INFORMATION
RELATIONSHIPRECURSIVEIRREFLEXIVE
Polymorphisms of Relationships
NON-RECURSIVE
7©Amit Mitra & Amar Gupta
RecursiveRelationship
Subtype of
IdempotentRelationship
Subtypeof
Reflexive Relationship
Asymmetrical Relationship
Subtype of
AntisymmetricalRelationship
SymmetricalSubset of subset of
Exhaustivepartition
Subtypeof
Symmetrical Relationship
Eg: •involve•Locate•relative of
Eg: •Part of•parent of
Polymorphisms of Relationships (2)
Eg: “Help” in Person help
PersonEg: “Self
Help”
Idempotent relationship
will always be symmetrical
IrreflexiveRelationship
Non-recursiveRelationship
Polymorphismof
Polymorphismof
Subtype of (inherited from recursive relationship)
Eg: Civil War
Eg: Distinct Parts of the nation at war with itself
Where relationships begin
8©Amit Mitra & Amar Gupta
HIGHER ORDER RELATIONSHIP
is sold to.. buys thru...
product customer retailer
possible ways in which minimum and maximumoccurrence (cardinality) constraints may be defined
for a three-way relationship
m..n
m..n
m..n
is sold to.. buys thru...
product customer retailer
m..n
Instances of this combination must be unique, otherwise it will not be an
object class
The symmetry of each combination must be considered
The length of the tuple is determined by its degree
Combinations may be recursive
Cardinality of polymorphisms of a relationship cannot be less constrained
than its parent (it may be more constrained)
Cardinality = Nil is the same as the exclusion constraint
9©Amit Mitra & Amar Gupta
Mutually inclusive and exclusive relationships
INSURANCECOVERAGE
ASSET
PERSON
cover
cover
MUTUALLYEXCLUSIVERELATIONSHIPS
X
= cover
Person Asset
Degree = 1cover
Insurance Coverage
=
co
ver..
Degree =
1
Person
Asset
InsuranceCoverage
PERSON
CAR
CARINSURANCE
own
own
MUTUALLYINCLUSIVERELATIONSHIPS
= own
Cardinality = 0 or more
own
Person
CarCar
Insurance
Degree = 2
=
Card
inality =
0 or more
ow
n..Person
car
CarInsurance
Degree =
2
PERSON
CAR
WHEEL
owns
SUBSET OF
owns
=
owns
Cardinality cannot exceed cardinality of Person owns Wheel
owns Person
Car Wheel
=
Ow
n..
Person
Wheel
Car
CardinalityCannotexceed
Mutual ExclusionIf one relationship exists, the other(s) cannot
Mutual InclusionIf any one relationship exists, the other(s) also must SubsettingIf one relationship exists, the other must, but not vice-versa
A subtype must stay within the lawful state space of its parent
10©Amit Mitra & Amar Gupta
Some additional information on cardinality constraints• Instance level constraints
–Eg: upper bound on cardinality ratio of Person lives in House
–Each house might have a different capacity
• Upper bound constraints on cardinality of relationships creates the concept of Capacity
• “Instance of” is a subtype of the subtyping relationship constrained to a single member
DO
MA
IN
(Exh
au
stive) Qu
alitative/Q
uan
titativ
e Par
tition
OB
JEC
T
Qu
alita
tiveA
ttribu
te
Each Objec t is anaggregation of one or more
Each Attribute is a Property of a single
Attrib
ute
Each Q
ualitative Attribute
is a Subtype of an Attribute
Each Q
uantitative Attribute
is a Subtype of an Attribute
FO
RM
AT
UN
ITO
FM
EA
SU
RE
is exp
ressed b
y 1
or m
any
[expr
ess]
con
vert to
0 or 1
[con
vert from]
con
vert to
0 or 1
[con
vert from]
Each Quantitative A ttributeis a Subtype of a
QU
AL
ITA
TIV
E D
OM
AIN
QU
AN
TIT
AT
IVE
DO
MA
INis ex
pressed
by
1 o
r man
y
is expressed
in 1
or m
any
Qu
antita
tiveA
ttribu
te
Instan
ceId
entifier
Each Qualitative A ttributeis a Subtype of a
(Exh
au
stive) Ord
inal/N
om
inal P
artitio
n
Ord
ina
lD
oma
inN
omin
al
Dom
ain
Each Ordinal Attributeis a Subtype of a
Each Nominal Attribute is a Subtype of a
Ord
ina
lA
ttribu
teN
omin
al
Attrib
ute
is aS
ub
typeof
is aS
ub
type
of
is aS
ub
typeof
Ea
ch ob
ject m
usth
ave ex
actly 1
[Iden
tifiesexa
ctly 1]
is aS
ub
type
of
is aS
ub
type
of
is aS
ub
typeof
(Ex
hau
stive) D
ifference/R
atio
Sca
led P
artitio
n
Ord
ina
lD
oma
inN
omin
al
Dom
ain
Differen
ceS
caled
Attrib
ute
Ra
tioS
caled
Attrib
ute
is aS
ub
typeof
is aS
ub
type
of
Each Difference ScaledA ttribute is a Subtype of a
Eac h Ratio Scaled A ttributeis a Subtype of a
is aS
ub
type
ofis a
Su
bty
peof
is a S
ub
typ
e of
is a S
ub
typ
e ofV
AL
UE
Th
e two
setsare eq
ua
l
Is asubtype of
Must take only 1
[may be value of
none, or many]
Relation
ship
Iden
tifieris a
Su
bty
peof
ST
AT
E O
F O
BJE
CT
TH
E S
TA
TE
OF
AN
OB
JE
CT
IS A
CO
LL
EC
TIO
N O
FA
TT
RIB
UT
E V
AL
UE
S
• Instance level cardinality (or capacity) constraints cannot violate corresponding class level constraints• The lower bound of the Cardinality (and enumeration) domain is nil
–Cardinality ratios map to the domain of cardinality quotients (obviously!)• Lower bound = nil = Optional relationship• Lower bound = 1 = Mandatory relationship• Often upper bound may be “many”
– “Many” is a finite value: Open bound , delimited by infinity
• (example of a finite, bounded/delimited pattern, in which the delimiter is infinite)
–These constraints are inherited by all counts
Person Home
Each person may own only 1 home
own0..1
Each person must own 1 home and no more
1..1
Each person must own 1, and may own more, homes
1..M 0..M
[Each home may be owned by 1 or more persons]
11©Amit Mitra & Amar Gupta
Relationships may be compositions of objects
House Town
Located in 1[location of 1 or more]Person Live in 1
[lived in by 0 or more]
OBJECTCLASS
OBJECTCLASS
OBJECTCLASS
RELATIONSHIPRELATIONSHIP
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]
An object class may glue relationships end-to-end
Together, two relationships imply the third
Live inExplicitly asserting all three would denormalize and replicate information
• Structure also adds information to a collection: the entire composition considered together is a polymorphism of “Live in”
Could have been a
complex network of objects and
relationships
(remember the metamodel of Pattern)
•Which objects join which?•In a network of associations how do we distinguish objects from relationships?•The truth is that it does not matter; they are all objects and only the overall structure of association matters
•This is the essence of the pattern
12©Amit Mitra & Amar Gupta
Polymorphisms of Relationships
13
©Amit Mitra & Amar Gupta©Amit Mitra & Amar Gupta
Polymorphisms of Relationships
OBJECT
RELATIONSHIP
OBJECT
PROCESSRECURSIVE
14©Amit Mitra & Amar Gupta
Polymorphisms of Relationships
17©Amit Mitra & Amar Gupta
Cardinality ratios of compositions
1. If any relationship in a chain of relationships in a composition is optional, the composite relationship will be optional
2. 1 to 1 relationships in tandem result in a composite 1 to 1 relationship
3. A 1 to 1 relationship in tandem with a 1 to many relationship results in a composite 1 to many relationship
4. A Many to 1 relationship in tandem with a 1 to 1 relationship results in a composite many to 1 relationship
5. A 1 to 1 relationship in tandem with a many to 1 relationship results in a composite many to 1 relationship
6. A Many to 1 relationship in tandem with a Many to 1 relationship results in a composite many to 1 relationship
7. A 1 to Many relationship in tandem with a 1 to Many relationship may result in a composite many to many relationship
8. A Many to 1 relationship in tandem with a 1 to Many relationship results in a composite many to many relationship
18©Amit Mitra & Amar Gupta
Mutability
•The Principle of Parsimony (of information)– Specify only what you must
• Basis for innovation!!
– Liskov’s principle• A subtype may always substitute its parent in a rule, but not necessarily vice-versa
(“It must be possible to substitute any object instance of a subclass for any object instance of a superclass without affecting the semantics of a program written in terms of the superclass”)MODIFICATION:“It is possible to substitute any Pattern with its subclass without affecting the semantics of the pattern”
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]
ApartmentLivingSpace
Apartment House
Subtype of
object
•The concept of the essence of a pattern and the meaning of “Essential” emerge thus•Eg: Is a check a paper document or a payment?•What are the essential parts of a composition? What may we remove/change without changing the meaning of the composition?
•A car without its radio is still a car, but is a car without wheels still a car? What about a car without its chassis?•What is the essence of the meaning of “house”: A house with a roof only, a roof and outside walls, or also inside walls, all of these?
•Larger scope and complexity require more abstraction•The Universal Perspective must be abstract
•The goal of a process is its product•A network like the Universal Perspective provides many paths to a goal
•Changing the essential meaning of a goal is a paradigm shift•Apply the Principle of Parsimony with the Universal Perspective to help innovate or to automate innovation (subtypes of universal meanings may substitute each other as resources and products of processes
19
©Amit Mitra & Amar Gupta©Amit Mitra & Amar Gupta
TRANSITIVITY
PERSON
HOUSE
WALL
Owns 0 or more[owned by 0 or more]
Consists of 1 or more[part of 0 or 1]
TRANSITIVE
Owns 0 or more[owned by 0 or more](automatically implied)
Transitive relationship
Transitivity, or the lack of it has several flavors
20©Amit Mitra & Amar Gupta
2nd Degree intransitivity
Transitivity
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]
•Transitive: Together, a set of relationships imply another•One relationship must be eliminated to normalize knowledge•The degree of transitivity is the max. number of relationships in a transitive chain•If the set of relationships is a set of processes, the last process should be eliminated
Live inTransitive triad
•Intransitive: A relationship is barred if a set of relationships exists
•Atransitive:No inclusion or exclusion constraints between relationships•Is “friend of” transitive, atransitive or intransitive?
Person
Parent of
Person PersonParent of
Parent of
DISSALLOWED
(Degree can be infinite)(Eg: The transitivity of Ancestor of)
21©Amit Mitra & Amar Gupta
COMPOSITION x
Subtype of
TransitiveComposition
IntransitiveComposition
Subtype of
Tansitivity (2)
• Transitivity is about compositions• A Transitive relationship may be symmetrical or not
– Eg: Relative of (symmetrical) vs. Ancestor of (asymmetrical)• An intransitive relationship has more information than a transitive relationship
– It will always be asymmetrical• Eg: Parent of
May be symmetrical (eg: relative of)OrAsymmetrical (eg: ancestor of) May only be asymmetrical (eg: parent of)
Increasinf information
Increasinf information
22
©Amit Mitra & Amar Gupta©Amit Mitra & Amar Gupta
Quantitative (arithmetic)Rule Expression
NominalRule Expression
OrdinalRule Expression
Subtype of
Subtype of
Inherit Classification information;Add ranking information
Inherit classification and ranking information;Add quantitative information
Quantitative (arithmetic)Rule Expression
NominalRule Expression
OrdinalRule Expression
Subtype of
Subtype of
• Ranking operations
•Quantitative operations(includes arithmetic operations, ranges, inequalities, equalities formulae etc)
•Boolean operations(including existence constraints like cardinality constraints)
OCCURRENCE AND EXISTENCE TO ARITHMETIC AND EQUATIONS
23©Amit Mitra & Amar Gupta
PRODUCTSALE
PRODUCT“constituent”of relationship
CUSTOMER
“constituent”of relationship
= Relationship
PLACE“constituent”of relationship
3rd ORDERRELATIONSHIP
sell
Sell to
Sell at
STATE SPACE OF A RELATIONSHIP
24©Amit Mitra & Amar Gupta
AN INSTANCE OF A 3RD ORDER MANIFOLD SHOWN IN THREE SPACE
products
places
customers
a particular product sold toa particular customer ata particular place
• An instance of an “ordinary” binary relationship would be a point in two-space
• Each item, product, place and customer may normalize different properties (like product feature, geographical footprint and customer age respectively)
– Each axis may unfold into a state space, each axis of which could in turn summarize a state space and so on
25©Amit Mitra & Amar Gupta
products
places
customers
a particular product sold toa particular customer ata particular place
A category is a region with various points inside it
Ovelappingcategories
MutuallyExclusive, orNon- overlappingcategories
Two dimensional region
CATEGORIES IN THREE SPACE
26©Amit Mitra & Amar Gupta
BOREL SET
Sale price
pro
du
cts
places
= INSTANCES OFBOREL SETS
ANOTHER INSTANCE OF A
BOREL SET
•A BOREL SET is the set of all possible regions in that space– In nominal state space it will be the set of all possible subsets– If we consider the “All” value, the Borel object will include all intervals
in state spaces of supertypes and subtypes
27©Amit Mitra & Amar Gupta
EXAMPLES OF 3RD ORDER “MARKET SEGMENT” BOREL SET IN THREE
SPACE
products
places
customers
a particular product sold toa particular customer ata particular place
A category is a region with various points inside it
Ovelappingcategories
MutuallyExclusive, orNon- overlappingcategories
categoryid
product place customer
seg 1 ALL NYC GE
seg 1 ALL NYC GM
seg 2 ALL NYC GM
seg 2 ALL NYC Toyota
More categories
The origin may represent shared values like “All”For spaces composed of axes that have a Nil value, such as ratio scaled spaces, the origin might represent the shared Nil value
28©Amit Mitra & Amar Gupta
BOREL OBJECT EXAMPLE
Note: At least one relationship, (or combination of relationships), with constituent objects -- product,customer ,sales channel -- must exist at each moment in time
PRODUCTSALE
PRODUCT“constituent”of relationship
CUSTOMER
“constituent”of relationship
SALESCHANNEL
“constituent”of relationship
MARKETSEGMENT
many to many
PRODUCTSALE
MARKETSEGMENT
PRODUCT SALE IN MARKET SEGMENT
1 to many
0 to many0 to many
0 to many
0 to many
manytomanyresolution
= Relationship
= Borel Object
= Resolution Object
29©Amit Mitra & Amar Gupta
(At least 1 relationship to a constituent entity must exist at any given time)
RELATIONSHIP(ASSOCIATIVE OBJECT)
OBJECT“constituent”of Borel Object
OBJECT
“constituent”of manifold
OBJECT
“constituent”of manifold
BOREL OBJECTOF
RELATIONSHIP
many to
many
RELATIONSHIP
BOREL OBJECT
RESOLUTIONOBJECT
1 to many
0 to many
0 to many
0 to many
0 to many
= Relationship
Degree of combination = 1 or more
Eg.: ProductTransfer/usageagreement
Eg.: Market segment
resolution object name <relationship name>
IN<borel object name>
BOREL OBJECT RULES
Every relationship implies a corresponding Borel Object