Re: Relational query with path expressions
Date: Mon, 6 Apr 2009 21:06:18 -0700 (PDT)
Message-ID: <f413f24e-a6a3-4b25-b13e-24fde7a1c916_at_x31g2000prc.googlegroups.com>
On Apr 7, 1:09 am, Tegiri Nenashi <TegiriNena..._at_gmail.com> wrote:
> On Apr 3, 4:31 am, David BL <davi..._at_iinet.net.au> wrote:
>
> > For example, given binary relation R(x,y), one could define a unary
> > function f that maps a set of x values to a set of y values as follows
>
> > for all X, f(X) = {y | exists x in X, R(x,y)}
>
> > It can be shown that f distributes over union and this "additive"
> > property on sets is preserved over function composition. In fact it
> > is easy to show that composition of these unary functions is
> > equivalent to a join + projection on the associated binary relations.
>
> My interpretation of this is the following. You took binary named
> relation (Codd model operates named relations), and abstracted away
> named perspective. Then, you suggest that the join between binary
> relations is defined the same way as in algebra of binary relations.
> This allows you to express graph queries.
I'm afraid I didn't follow all of that. I'll explain what I was stating in more detail...
Let R1(x,y) and R2(y,z) be two named binary relations on named attributes.
Then it turns out that fxz = fyz o fxy
f1,f2 distribute over union (giving them an additive characteristic) whereas f3,f4 distribute over intersection (giving them a subtractive characteristic).
That would allow for the path expression
P*SP.S.S#
which finds supplier numbers of suppliers that ships /all/ the parts.
The following is interesting:
P[COLOR='red']*SP.P#
This finds part numbers for any parts shipped by any supplier that
ships all the red parts. This may include parts that are not red.