This is more of my continuing saga to try and get DD to work for a situation which I've be placed in which seems ripe with problems right now.
This is hopefully a simple example that will explain the problem:
DCTcontainer: housecontainer: exterioritem: direction [N,S,E,W]
item width
item height
item: color_id
container: interiorcontainer: roomitem: room_id
item: width
item height
item: color_id
DBtable: EXTERIOR
table ROOM
table COLOR
table EXTERIOR_COLOR_XREFforeign-key parent-group="EXTERIOR"column-pair ("direction", "direction")
foreign-key parent-group="COLOR"column-pair("color_id", "color_id")
table ROOM_COLOR_XREFforeign-key parent-group="ROOM"column-pair ("room_id", "room_id")
foreign-key parent-group="COLOR"column-pair("color_id", "color_id")
The DCT has two source locations for
color information - both of which are supposed to be deployed to the COLOR table but I cannot defiine two "groups" named "COLOR" to represent each of the potential sources for this deployment.
Okay - Suppose we decide that the COLOR table is actually being maintained separately (from a paint manufacting source) and we no longer have to deploy the actual "color_id" information from the DCR to the DB - we still have a problem in that we want to make the cross-reference associations between each room and its associated color as well as each side of the exterior of the house and its associated color (
we could go real crazy and allow each wall of a room to be painted a different color too) - but we still have the problem of how to define the 2nd primary key for each of the "*_XREF" tables.
As near as I can tell - in order to define a
foreign key - I need to specify
both the table from which it comes
and the source xpath from the DCR which is the actual source of the information. Well - if the table is now being mained separate from the DCR to solve the problem of trying to push content from two different sources into a single DB - we no longer have a handle on the "parent-table" to use for our reference, and even if we did, we still have the problem of definining which column of information was being used to feed that particular table.
If we could stipulate that the
table (or "parent-group") was itself "foreign" then each XREF table could define the source information to use for the foreign-primary-key that comes from that foreign-table in order to make the correct association.
Looking at the DTD and the examples - it doesn't seem possible for me to define a foreign key as coming from an external or foreign table. Is it?
If not, I may end up having to scrap the entire use of DD here and spend a bunch of time writing my own code to parse the DCRs and use Perl DBI to push data where we want it. For various reasons I'd like to avoid this switch of approach - but if DD cannot do what we need, I need to know it ASAP so as to avoid any additional loss of time on this project.
--fish
Senior Consultant, Quotient Inc.
http://www.quotient-inc.com