Re: predicate, constraints, header, relvar, and relation

From: Bob Badour <bbadour_at_pei.sympatico.ca>
Date: Sat, 21 Apr 2007 00:26:01 GMT
Message-ID: <tScWh.26508$PV3.272348_at_ursa-nb00s0.nbnet.nb.ca>


davis.jeffrey_at_gmail.com wrote:
> I've been reading a lot of CJ Date's work, and I have some fairly
> general (but fundamental) questions.
>
> Does a predicate apply to a relvar or a relation? It makes sense to me
> that you could have one relation that exists in two separate variables
> with two separate predicates, indicating to me that a predicate
> applies to the relvar, not the relation. However, if you join the
> values in two relvars, it makes sense that there is an inference being
> made, and therefore the result relation has some kind of derived
> predicate. Am I making any sense? Can someone clear this up for me?

Both. The data types of the attributes are part of the predicates of both the variable and the value. Generally speaking, the most specific type of any attribute of the value will be a subtype of the declared type of the variable.

As far as any specific value is concerned, any incidental key is a candidate key, and one could call it part of the predicate of the value. The predicate of the variable will require some specific set of candidate keys of any consistent value where additional incidental keys are neither prohibited nor required.

Any additional incidental keys necessarily indicate the most specific type of the value is a proper subtype of the declared type of the variable.

> Also, I have a similar question for constraints. Does a constraint
> apply to a relation or a relvar?

While the concept of constraint it meaningless for values, every constraint basically describes some property of consistent values. Any value will have an unlimited number of properties any of which might make the value consistent or inconsistent with respect to some constraint.

  It makes sense that this would be the
> same answer as above, because a constraint is an approximation of the
> predicate. Would it make any sense to apply a constraint to, for
> example, a relation literal?

It certainly makes sense to draw attention to the important properties of a literal in a given context. I could see someone wanting to overload the constraint concept to achieve this goal, but I think that would be a mistake.

> It seems to me that the header must be a part of the relation itself,
> because a relation literal must have a header. However, it makes sense
> to me that, when you declare a relvar, you specify the header so that
> the relvar can only store relations with a matching header.

Whether the above is true depends on how one defines "matching". If one says that a subtype "matches" a declared supertype when comparing headers, then the headers must match. I prefer to think in terms of types, though. The most specific type of the value must be a subtype of the declared type of the variable.

The "header" is just part of the data type specification. Received on Sat Apr 21 2007 - 02:26:01 CEST

Original text of this message