Home Forums Database Design Relational Theory Defining keys as sets that must not intersect instead of scalar values that must not be equal RE: Defining keys as sets that must not intersect instead of scalar values that must not be equal

  • Don Halloran - Tuesday, December 19, 2017 6:48 PM

    ...,,
    But things get worse, because now I extend the requirements and say that the bounding polygon isn't necessarily a triangle. It is a polgyon with any number of vertices. Clearly I cannot implement this as:

    (vertex1, vertex2, vertex3, ...., vertexN, name, owner, characterization)

    Because not every polygon will have N vertices, which means all but the first three vertex columns must be nullable. But that is contrary to the requirements of a key. What I really want to say is that the key for the area is a set of vertices with cardinality greater than or equal to three. Then the key for the area is set.
    .....

    OK, here it's clear what you are getting at.   But a set of vertices doesn't work, it has to be an ordered list (because with two dimensional caresian coordinates [(0,1), (0,0), (1,0), (1,1)] is not the same area as [(0.1),(1,0),(1,1),(0,0)]  and neither is the same as [(0,1),(1,0), (0,0),(1,1)] although all three have the same set of vertices  (and once you allow enough vertices the list has to be allowed to include repetitions to cover all cases, so that's two ways in which a set or vertices doesn't work).The intended set would iof course work if you had enough storage to express it (since physical separation is quantised, a finite area can be expressed as a finite number of points) but you aren't ever going to see that much storage.  Of course simple cases like this could be considered as having an extra vertex (at (0.5.0.5)) in the non-convex case, but that still leaves you with two different figures with the same set of vertices if you ignore order.  Restricting yourself to polygons without intersecting sidesdoesn't eliminate those problems, as there are many non-convex polygons without what might be called intersecting sides which have them.  Restricting to polygons where there is never a meetin of three sides still doesn't eliminate the problem.

    But yes, it will work with an ordered list (possibly including repetitions, depending on what restrictions you might want to impose) of vertices as a way of expressing the set of pounts within an area definable by its vertices (and their order).  There is of course the interesting question of whether points on a boundary count as intersections (they had better if your areas are topologically closed sets of points, and then intersections on boundaries would not be forbidden, while if all sets were topologically open a shared boundary point would be an utterly bizarre concept that you wouldn't have to worry about.

    Tom