Re: Relational query with path expressions

From: David BL <davidbl_at_iinet.net.au>
Date: Sun, 5 Apr 2009 20:08:29 -0700 (PDT)
Message-ID: <a6415716-becb-454e-81cb-cb5d1f702e0e_at_y34g2000prb.googlegroups.com>


On Apr 3, 12:46 pm, Tegiri Nenashi <TegiriNena..._at_gmail.com> wrote:
> Granted, if you have a choice between join and generalized projection
> you can infer the type of binary operator from the type of operand. In
> the expression
>
> x.y
>
> if both are relations, you interpret it as join, and if one is a set
> of attributes, than its a projection. That is some economy of
> notation.

It occurred to me that the same language can be formalised more simply and without any need to overload the dot syntax. The relevant rules are:

  1. R1.R2 always means project the join of R1 and R2 onto the attributes of R2
  2. (R1,...,Rn) always means the join of R1,...,Rn
  3. x where x is an attribute name represents a relation with a single attribute named x, and containing all the tuples associated with the domain of attribute x. Often these relations are infinite and can't be materialised.

This makes it clear for example that

    SP.(QTY,P) is equivalent to what Date would write as

    (SP JOIN P) { QTY, P#, PNAME, COLOR, WEIGHT, CITY } Providing access to (finite) domains as relations has other uses. E.g.

    COLOR \ P.COLOR to find the colours not used by any part.

The downside is that each attribute name must consistently use the same domain type in all relations it appears in. Received on Mon Apr 06 2009 - 05:08:29 CEST

Original text of this message