G
Gary Schuldt
I need a standard design approach to this problem pattern:
Let's say I have two tables tA and tB with a n-n relationship trelAB between
them (with FK's to both tA and tB). The object of this user session is to
create instances of trelAB.
Example: tA is a table of photographs (tPhoto) and tB is a table of Plants
(tPlant). trelAB keeps track of which Photos depict which Plants
(trelPlantPhotoDepiction).
Scenario 1: I take a digital pic and I want to record which plants in
tPlant are depicted in that Photo. There are so many plants that I need to
search for the correct plant (i.e., I don't automatically know the PlantID);
and it may not even be in the database. (In those cases where I know the
ID--i.e., I've already tagged the plant--I'll just make note of the ID's of
the Plants in the pic and enter them and be done with it.)
Scenario 2: I enter a new plant into tPlant and want to link it to any
photos I have of it. I will have to search for the photos based on some
descriptor info in tPhoto, and in many cases will even have to view the
photo just to make sure it depicts this plant. There may be no Photos of
this plant currently in the database.
These two scenarios seem symmetric: It's an n-n relationship between them,
and, no matter which one I'm starting with, I have to do a human search to
make a decision about whether or not I can establish an instance of the
relationship to the other.
In my mind, this cries out for a standard design pattern that I could reuse
as needed. I have the rudimentary elements of it in my mind, but I need
help pulling it together! I'm sure someone has this design pattern in their
bag of tricks!
Thanks in advance.
Gary
Let's say I have two tables tA and tB with a n-n relationship trelAB between
them (with FK's to both tA and tB). The object of this user session is to
create instances of trelAB.
Example: tA is a table of photographs (tPhoto) and tB is a table of Plants
(tPlant). trelAB keeps track of which Photos depict which Plants
(trelPlantPhotoDepiction).
Scenario 1: I take a digital pic and I want to record which plants in
tPlant are depicted in that Photo. There are so many plants that I need to
search for the correct plant (i.e., I don't automatically know the PlantID);
and it may not even be in the database. (In those cases where I know the
ID--i.e., I've already tagged the plant--I'll just make note of the ID's of
the Plants in the pic and enter them and be done with it.)
Scenario 2: I enter a new plant into tPlant and want to link it to any
photos I have of it. I will have to search for the photos based on some
descriptor info in tPhoto, and in many cases will even have to view the
photo just to make sure it depicts this plant. There may be no Photos of
this plant currently in the database.
These two scenarios seem symmetric: It's an n-n relationship between them,
and, no matter which one I'm starting with, I have to do a human search to
make a decision about whether or not I can establish an instance of the
relationship to the other.
In my mind, this cries out for a standard design pattern that I could reuse
as needed. I have the rudimentary elements of it in my mind, but I need
help pulling it together! I'm sure someone has this design pattern in their
bag of tricks!
Thanks in advance.
Gary