Quote from
dandl on October 22, 2019, 1:30 pm
Quote from
AntC on October 22, 2019, 11:03 am
Quote from
dandl on October 22, 2019, 9:00 am
I agree. In my view a domain is an abstract entity that provides a unique identifier for an attribute/column, and also constrains the set of permitted values. Domains are expected to be unique within a relation, but if not it can be further qualified by a role, which does not however play any part in matching up attributes for the RA.
Where this might lead to (if we try to graft on to modern type theory, and do away with all the hangover from ordered/positional tuples/relations) is that domains are roles are attribute names, we don't need two/three separate concepts.
There are two separate concepts, but the issue is that we would like to rationalise them in order to implement the RA in a programming language. These are choices.
A domain does not provide any of the other features of a programming language type, such as permitted operations, sub-typing etc.
Hmm hmm. See my reply to Erwin. We might use the same "pool of values" (i.e. INT
s) for part and quantity. We might want to do arithmetic over quantity. We might even want to do (limited) arithmetic or at least sorting/ordering over part. But we certainly don't want to add part numbers to quantity.
The RA provides no such capability. We have the First Order RA with domains and all the queries Codd wrote about in 1970. But now we want the Second Order RA in order to write queries that generate new values, which means open expressions, which in both SQL and TTM means adding a type system. SQL stops there, but in TTM we want unsafe queries, so we add a full blown Turing complete language, with SORA embedded.
These are choices we make, for good reasons, but they have consequences. I can imagine sticking with domains and coming up with a different way to match it to a modern language and type system, but it's not obvious it would be worth the trouble.
If you replace domains by types (as TTM does) you lose the uniqueness feature so you have to add in attribute names. Now there is potential for confusion between names across relations (enter RENAME) and the way names are used in programming languages (hence the weird TTM type system).
Perhaps there is a different way to marry up relations, domains and types, but I don't know what it might be.
For any heading, requiring unique domains (named pool of values) is isomorphic to requiring unique role-qualifiers (role name + domain) is isomorphic to requiring unique attributes (attribute name + TTM type, which is a type name + set of values). I see redundancy.
This doesn't avoid RENAME
: we still need part in role of assembly vs part in role of component. If distinct domains are defined over the same "pool of values", that's a type-level renaming resulting in an execution-time nullop.
I sense that it does. In that case where the domain part is ambiguous, the RA expression has to be annotated as to which role to use, but the result value is still a part.
Quote from
AntC on October 22, 2019, 11:03 am
Quote from
dandl on October 22, 2019, 9:00 am
I agree. In my view a domain is an abstract entity that provides a unique identifier for an attribute/column, and also constrains the set of permitted values. Domains are expected to be unique within a relation, but if not it can be further qualified by a role, which does not however play any part in matching up attributes for the RA.
Where this might lead to (if we try to graft on to modern type theory, and do away with all the hangover from ordered/positional tuples/relations) is that domains are roles are attribute names, we don't need two/three separate concepts.
There are two separate concepts, but the issue is that we would like to rationalise them in order to implement the RA in a programming language. These are choices.
A domain does not provide any of the other features of a programming language type, such as permitted operations, sub-typing etc.
Hmm hmm. See my reply to Erwin. We might use the same "pool of values" (i.e. INT
s) for part and quantity. We might want to do arithmetic over quantity. We might even want to do (limited) arithmetic or at least sorting/ordering over part. But we certainly don't want to add part numbers to quantity.
The RA provides no such capability. We have the First Order RA with domains and all the queries Codd wrote about in 1970. But now we want the Second Order RA in order to write queries that generate new values, which means open expressions, which in both SQL and TTM means adding a type system. SQL stops there, but in TTM we want unsafe queries, so we add a full blown Turing complete language, with SORA embedded.
These are choices we make, for good reasons, but they have consequences. I can imagine sticking with domains and coming up with a different way to match it to a modern language and type system, but it's not obvious it would be worth the trouble.
If you replace domains by types (as TTM does) you lose the uniqueness feature so you have to add in attribute names. Now there is potential for confusion between names across relations (enter RENAME) and the way names are used in programming languages (hence the weird TTM type system).
Perhaps there is a different way to marry up relations, domains and types, but I don't know what it might be.
For any heading, requiring unique domains (named pool of values) is isomorphic to requiring unique role-qualifiers (role name + domain) is isomorphic to requiring unique attributes (attribute name + TTM type, which is a type name + set of values). I see redundancy.
This doesn't avoid RENAME
: we still need part in role of assembly vs part in role of component. If distinct domains are defined over the same "pool of values", that's a type-level renaming resulting in an execution-time nullop.
I sense that it does. In that case where the domain part is ambiguous, the RA expression has to be annotated as to which role to use, but the result value is still a part.