Darren Duncan wrote: >>>Is there a reference for the meaning of these methods? >>> >>> >>There are many written references to these methods; just type >>"relational algebra" into Google. >> >> > >I will add that the first hit on such a search, the Wikipedia page on >relational algebra ( http://en.wikipedia.org/wiki/Relational_algebra >), is a perfectly good primer on what relational algebra is and what >its importance is. > >
Thanks for the pointer. >While this may not actually change anything, I should point out that >every collection type can also be expressed in terms of a Relation >definition and/or they can all be implemented over a Relation (whose >members are actually always unique). For example: > >1. A Set of Any is a Relation with one Any attribute. >2. A Bag of N Any attributes is a Relation of N+1 attributes, where >the extra attribute is an Int (constrained >= 1) that counts >occurrances of the distinct other attributes. >3. A Mapping can be a Relation of 2 Any attributes. >4. A Hash is a Relation of 2 attributes, Str (key) and Any (value), >where the key has a unique constraint. >5. A Seq is a Relation of 2 attributes, typed Int (>= 0) and Any, >where the first shows their ordinal position and the second is the >actual value; the first has a unique constraint. >6. An Array is the same, assuming it is a sparse; if it is not >sparse, there is an additional constraint that the greatest Int value >is the same / one less than the count of Relation members. > > I don't know if anyone will care, but you can't emulate the raw "Collection" type with this fixed Relation type. That is, a collection of tuples, each of which may be of differing length and type. This is what leads me to think that Collection is the more generic role. I'm not saying Relations are not useful, perhaps they are more useful than Collections in the practical case, but they are a sub-type. Also, I don't agree with the notion of a "header" of each relation. It has a type for each tuple item, sure, but "header" just sounds like the sort of thing you want in a ResultSet, not a Relation. Sam.