Thread Links Date Links
Thread Prev Thread Next Thread Index Date Prev Date Next Date Index

SUO: RDBMS Example of Construction of a Triadic Relation from Dyadic Relations




Dear Colleagues,

There seems to be a question of what "reduction of a triadic
relation to dyadic relations" means to different people. So using
Jon's example of an AND truth table, here is what I mean. I mean
that for any n-ary relation I can create a set of at most n binary
relations from which the original n-ary relation can be created
as a view.

I don't have skills in SQL but using Microsoft Access I was able 
to construct the following tables and a view definition based on 
them using the graphical tools of Access. The SQL presented below
is an output from this.

Here are the results:

Truth_Value_Table
o------------o
|Truth_Value |
o------------o
|False       |
|True        |
o------------o

AND_Truth_Table
o---------o
|Row      |
o---------o
|AND-Row-1|
|AND-Row-2|
|AND-Row-3|
|AND-Row-4|
o---------o

AND_Argument1
o-----------o----------------o
|Row        |    Arg1-Value  |
|AND-Row-1  |    True        |
|AND-Row-2  |    True        |
|AND-Row-3  |    False       |
|AND-Row-4  |    False       |
o-----------o----------------o

AND_Argument2
o-----------o----------------o
|Row        |    Arg2-Value  |
|AND-Row-1  |    True        |
|AND-Row-2  |    False       |
|AND-Row-3  |    True        |
|AND-Row-4  |    False       |
o-----------o----------------o

AND_Result
o-----------o----------------o
|Row        |    Result-Value|
|AND-Row-1  |    True        |
|AND-Row-2  |    False       |
|AND-Row-3  |    False       |
|AND-Row-4  |    False       |
o-----------o----------------o

AND_Truth_Table_Query (Query Definition)

SELECT AND_Argument1.[Arg1-Value], 
       AND_Argument2.[Arg2-Value], 
       AND_Result.[Result-Value]
FROM 
  (AND_Argument1 
     INNER JOIN AND_Argument2 
       ON AND_Argument1.Row = AND_Argument2.Row) 
     INNER JOIN AND_Result 
       ON AND_Argument1.Row = AND_Result.Row;


(Result of executing the query)
o-----------o------------o-------------o
|Arg1-Value | Arg2-Value | Result-Value|
o-----------o------------o-------------o
|True       | True       | True        |
|True       | False      | False       |
|False      | True       | False       |
|False      | False      | False       |
o-----------o------------o-------------o

From where I sit doing this is trivial technically. And when
I say that a triadic relation can be "reduced" to a dyadic form, 
this (and not something else) is what I mean.

The question is, why and when might this be useful?
The answer is that many n-ary relations are overconstrained. 
I.e. they are not a good model because there are many cases
they do not support.

This is particularly so when activities are represented by 
relations. Take giving as an example. Using a relation to
represent this does not only require that there is a giver,
a receiver, and a gift, but it requires that there is not
more than one giver, receiver, and gift. Whilst it is true
that there are some giving acts for which this constraint
holds, it is not true for all giving activities. And whilst
you could define relations for all the possible combinations
of different numbers of givers, receivers, and gifts, this is
not particularly practical.

So how does changing the representation of an activity from
a relation to a set and some binary relations help?

The answer is that it removes the constraints. Actually it 
removes both the minimum constraints and the maximum constraints.

Even removing the minimum constraint can be useful from an
epistemological viewpoint. So whilst in an act of giving ontologically
we know that there must be at least one giver, one given and one gift,
do we necessarily have knowledge of each of these for any giving activity?
More particularly do we always have to care?

Example: Steve Redgrave was given his 5th gold medal in rowing at the
Sydney Olympics. Do we care who gave it to him? Would we wish to be
prevented from recording anything about this giving act if we could
not identify the person who gave it to him? I think not.

Of course there are times when you do want to require some information.
Explicit axioms can be used to support this. For example, if 
you do not have a product ordered and a customer at least, then there
is no purpose to accepting only partial information as an order.

Regards  
      Matthew
===============================================================
Matthew West                    http://www.matthew-west.org.uk/

Principal Consultant                   Shell Visiting Professor
Operations & Asset Management            The Keyworth Institute
Shell Services International            The University of Leeds
http://www.shellservices.com/  http://www.keyworth.leeds.ac.uk/

H3229, Shell Centre, London, SE1 7NA, UK.
Tel: +44 207 934 4490 Fax: 7929 Mobile: +44 7796 336538
===============================================================