dkubb/veritas — pull request #16 by dkubb (2012-12-24 17:57:50+00:00)
Title: Add key support to relations

This branch adds key support to relations. It introduces a new object called Relation::Keys, which is basically a set of Relation::Header objects, each of them representing a candidate key. A Relation::Header#keys attribute stores a reference to the keys for the relation.

The remaining task is to add key minimization to the key constructor so that the keys are made irreducible. For example, given the following:

```ruby
Veritas::Relation::Keys.coerce([ header.project([ :id, :name ]), header.project([ :id ]) ])
```

Two headers were provided, yet one is a proper subset of the other. The key with `[ :id, :name ]` will be discarded because it is redundant. Every key must not be a proper subset of another key.

An alternative approach, and (actually) the current front-runner would be to simply check in the constructor to make sure the keys are irreducible. If they are it would raise an exception. This will catch errors earlier on when the keys are declared.