Peter Becker
2003-08-18 08:56:03 UTC
Hi again,
slightly different topic now: the plural version. I have implemented a
whole set of operators for relations in the form I like them (or better:
the form that I hope I will like once I use it). Here is a list in
alphabetical order with arity and constructor arguments:
- crossproduct: 2, ()
- drop columns: 1, (int[])
- identity: 1, ()
- intersection: 2, ()
- join: 2, (int[],bool,int[], bool) -- this one takes the columns to
join on and if they should be dropped for each side
- negation: 1, (Set[]) -- relations don't have signatures, so we need to
give the domains
- pick columns: 1, (int[]) -- allows permutations and repetitions
- selection: 1, (TuplePredicate) -- has two static methods for col=value
and col1=col2 checks
- union: 2, ()
I think this is enough to implement pretty much everything I can think
of. Thinking about it: I'll add a permutation operation for the same
reason I did the drop column one -- you don't want to specify every
column you want to keep. It'll take an int[], too -- with the usual
rotational semantics, i.e. [2,4,5] means (abcde) turns into (adceb)
(code: "new int[]{1,3,4}").
Of course it doesn't match any classical relational algebra (or at least
I wouldn't expect it to). To fix that problem, I plan to introduce
factories which give exactly the operations a particular algebra allows.
For example the factory method for a join could be:
public static BinaryRelationOperation getJoin(int[] leftColumns, int[]
rightColumns) {
return new JoinOperation(leftColumns, true, rightColumns, true);
}
for the PeirceAlgebra class and
public static BinaryRelationOperation getJoin(int[] leftColumns, int[]
rightColumns) {
return new JoinOperation(leftColumns, false, rightColumns, true);
}
for a more SQLish one (of course SQL uses names, but you know what I mean).
The question now is: what are the algebras we want to have? Can someone
give me a few references to relevant papers (ideally Citeseer links), so
I can create the factories matching the algebras presented?
Thanks,
Peter
slightly different topic now: the plural version. I have implemented a
whole set of operators for relations in the form I like them (or better:
the form that I hope I will like once I use it). Here is a list in
alphabetical order with arity and constructor arguments:
- crossproduct: 2, ()
- drop columns: 1, (int[])
- identity: 1, ()
- intersection: 2, ()
- join: 2, (int[],bool,int[], bool) -- this one takes the columns to
join on and if they should be dropped for each side
- negation: 1, (Set[]) -- relations don't have signatures, so we need to
give the domains
- pick columns: 1, (int[]) -- allows permutations and repetitions
- selection: 1, (TuplePredicate) -- has two static methods for col=value
and col1=col2 checks
- union: 2, ()
I think this is enough to implement pretty much everything I can think
of. Thinking about it: I'll add a permutation operation for the same
reason I did the drop column one -- you don't want to specify every
column you want to keep. It'll take an int[], too -- with the usual
rotational semantics, i.e. [2,4,5] means (abcde) turns into (adceb)
(code: "new int[]{1,3,4}").
Of course it doesn't match any classical relational algebra (or at least
I wouldn't expect it to). To fix that problem, I plan to introduce
factories which give exactly the operations a particular algebra allows.
For example the factory method for a join could be:
public static BinaryRelationOperation getJoin(int[] leftColumns, int[]
rightColumns) {
return new JoinOperation(leftColumns, true, rightColumns, true);
}
for the PeirceAlgebra class and
public static BinaryRelationOperation getJoin(int[] leftColumns, int[]
rightColumns) {
return new JoinOperation(leftColumns, false, rightColumns, true);
}
for a more SQLish one (of course SQL uses names, but you know what I mean).
The question now is: what are the algebras we want to have? Can someone
give me a few references to relevant papers (ideally Citeseer links), so
I can create the factories matching the algebras presented?
Thanks,
Peter