Re: Symmetric and Asymmetric Relationships
Date: Fri, 19 Nov 2004 05:14:11 GMT
Message-ID: <Difnd.532506$mD.64824_at_attbi_s02>
"Kenneth Downs" <firstinit.lastname_at_lastnameplusfam.net> wrote in message news:lv2072-dif.ln1_at_pluto.downsfam.net...
> Sometimes we encounter a mismatch between symmetric and asymmetric
> relationships.
>
> For instance, a foreign key is asymmetric, its operation are not the same in
> both directions. A join in a SELECT statement however is symmetric, you
> can specify the operation in either direction and get the same result.
>
> This can be a problem when you need to validate asymmetric data against
> symmetric. Data entered into the more lax situation may be reversed so
> that it fails to match into the stricter source. For example, a data
> dictionary specifies that TAB_CHILD has a foreign key against TAB_PARENT,
> but a user defining a view puts in TAB_PARENT joining to TAB_CHILD.
>
> The answer I came up with is to produce a UNION view of the foreign keys
> table with itself, where the 2nd copy has the keys reversed, something like
> this:
>
> SELECT table_id,table_id_par FROM foreign_keys
> UNION ALL
> SELECT table_id_par,table_id FROM foreign_keys
>
> I can then validate against this "loosened" table, and either CHILD->PARENT
> or PARENT->CHILD will both validate OK, and Bob's your uncle.
>
> Has anyone else run into situations with the mix of symmetric and asymmetric
> data? Any solutions you care to share?
This is the reflexive closure operation. It's discussed a lot less often than transitive closure, since it's an easier problem. But it's interesting at least in that one way I evaluate potential solutions to the transitive closure problem is if they have a solution to reflexive closure that just falls out. If not, it's probably not general enough.
Marshall Received on Fri Nov 19 2004 - 06:14:11 CET