dbTalk Databases Forums  

Modeling question...

comp.databases.theory comp.databases.theory


Discuss Modeling question... in the comp.databases.theory forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Volker Hetzer
 
Posts: n/a

Default Modeling question... - 07-08-2008 , 11:25 AM






Hi!
Not sure if this is the right group but I've come across a problem I'm at a
loss to model properly. Here's the setup:
A model contains three entities ("Level"s) describing projects:
- Project Family records, each referencing several
- Project records (with different attributes), in turn referencing
- Sub projects, with different attributes again.
Those three Project levels are connected by straight forward 1 to n relationships.
But the problem is that they all have a bunch of key/value pairs.
So, a project family can have a key/value-pair StartDate=20080615.
But each project and subproject can have a different StartDate.
On the other hand, sub projects, projects and family don't need to have
the same key/value pairs.

Now, the simple solution is to have three key_value tables and be done with
it. However what I'd very much prefer is just one key_value table with some
kind of "level" attribute, 0 being family, 1 being project and 2 being sub
project. The primary keys on the level entities are all numeric so
this would perhaps work but I have no idea how to get the foreign key
constraints done because the key_value table would have three parents.

How does one model relationships in which
- one child table has several parent tables
- each parent record can refer to several child records
- each child record belongs to exactly one parent record in exactly one of
the several parent tables?
Is there a declarative way to enforce consistency?

Lots of Greetings!
Volker
--
For email replies, please substitute the obvious.

Reply With Quote
  #2  
Old   
Bob Badour
 
Posts: n/a

Default Re: Modeling question... - 07-08-2008 , 01:07 PM






Volker Hetzer wrote:

Quote:
Hi!
Not sure if this is the right group but I've come across a problem I'm
at a loss to model properly. Here's the setup:
A model contains three entities ("Level"s) describing projects:
- Project Family records, each referencing several
- Project records (with different attributes), in turn referencing
- Sub projects, with different attributes again.
Those three Project levels are connected by straight forward 1 to n
relationships.
But the problem is that they all have a bunch of key/value pairs.
So, a project family can have a key/value-pair StartDate=20080615.
But each project and subproject can have a different StartDate.
On the other hand, sub projects, projects and family don't need to have
the same key/value pairs.

Now, the simple solution is to have three key_value tables and be done with
it. However what I'd very much prefer is just one key_value table with some
kind of "level" attribute, 0 being family, 1 being project and 2 being
sub project. The primary keys on the level entities are all numeric so
this would perhaps work but I have no idea how to get the foreign key
constraints done because the key_value table would have three parents.

How does one model relationships in which
- one child table has several parent tables
- each parent record can refer to several child records
- each child record belongs to exactly one parent record in exactly one of
the several parent tables?
Is there a declarative way to enforce consistency?

Lots of Greetings!
Volker
Ooooh! Reinventing EAV with levels...


Reply With Quote
  #3  
Old   
Bob Badour
 
Posts: n/a

Default Re: Modeling question... - 07-08-2008 , 01:07 PM



Volker Hetzer wrote:

Quote:
Hi!
Not sure if this is the right group but I've come across a problem I'm
at a loss to model properly. Here's the setup:
A model contains three entities ("Level"s) describing projects:
- Project Family records, each referencing several
- Project records (with different attributes), in turn referencing
- Sub projects, with different attributes again.
Those three Project levels are connected by straight forward 1 to n
relationships.
But the problem is that they all have a bunch of key/value pairs.
So, a project family can have a key/value-pair StartDate=20080615.
But each project and subproject can have a different StartDate.
On the other hand, sub projects, projects and family don't need to have
the same key/value pairs.

Now, the simple solution is to have three key_value tables and be done with
it. However what I'd very much prefer is just one key_value table with some
kind of "level" attribute, 0 being family, 1 being project and 2 being
sub project. The primary keys on the level entities are all numeric so
this would perhaps work but I have no idea how to get the foreign key
constraints done because the key_value table would have three parents.

How does one model relationships in which
- one child table has several parent tables
- each parent record can refer to several child records
- each child record belongs to exactly one parent record in exactly one of
the several parent tables?
Is there a declarative way to enforce consistency?

Lots of Greetings!
Volker
Ooooh! Reinventing EAV with levels...


Reply With Quote
  #4  
Old   
Bob Badour
 
Posts: n/a

Default Re: Modeling question... - 07-08-2008 , 01:07 PM



Volker Hetzer wrote:

Quote:
Hi!
Not sure if this is the right group but I've come across a problem I'm
at a loss to model properly. Here's the setup:
A model contains three entities ("Level"s) describing projects:
- Project Family records, each referencing several
- Project records (with different attributes), in turn referencing
- Sub projects, with different attributes again.
Those three Project levels are connected by straight forward 1 to n
relationships.
But the problem is that they all have a bunch of key/value pairs.
So, a project family can have a key/value-pair StartDate=20080615.
But each project and subproject can have a different StartDate.
On the other hand, sub projects, projects and family don't need to have
the same key/value pairs.

Now, the simple solution is to have three key_value tables and be done with
it. However what I'd very much prefer is just one key_value table with some
kind of "level" attribute, 0 being family, 1 being project and 2 being
sub project. The primary keys on the level entities are all numeric so
this would perhaps work but I have no idea how to get the foreign key
constraints done because the key_value table would have three parents.

How does one model relationships in which
- one child table has several parent tables
- each parent record can refer to several child records
- each child record belongs to exactly one parent record in exactly one of
the several parent tables?
Is there a declarative way to enforce consistency?

Lots of Greetings!
Volker
Ooooh! Reinventing EAV with levels...


Reply With Quote
  #5  
Old   
Bob Badour
 
Posts: n/a

Default Re: Modeling question... - 07-08-2008 , 01:07 PM



Volker Hetzer wrote:

Quote:
Hi!
Not sure if this is the right group but I've come across a problem I'm
at a loss to model properly. Here's the setup:
A model contains three entities ("Level"s) describing projects:
- Project Family records, each referencing several
- Project records (with different attributes), in turn referencing
- Sub projects, with different attributes again.
Those three Project levels are connected by straight forward 1 to n
relationships.
But the problem is that they all have a bunch of key/value pairs.
So, a project family can have a key/value-pair StartDate=20080615.
But each project and subproject can have a different StartDate.
On the other hand, sub projects, projects and family don't need to have
the same key/value pairs.

Now, the simple solution is to have three key_value tables and be done with
it. However what I'd very much prefer is just one key_value table with some
kind of "level" attribute, 0 being family, 1 being project and 2 being
sub project. The primary keys on the level entities are all numeric so
this would perhaps work but I have no idea how to get the foreign key
constraints done because the key_value table would have three parents.

How does one model relationships in which
- one child table has several parent tables
- each parent record can refer to several child records
- each child record belongs to exactly one parent record in exactly one of
the several parent tables?
Is there a declarative way to enforce consistency?

Lots of Greetings!
Volker
Ooooh! Reinventing EAV with levels...


Reply With Quote
  #6  
Old   
Bob Badour
 
Posts: n/a

Default Re: Modeling question... - 07-08-2008 , 01:07 PM



Volker Hetzer wrote:

Quote:
Hi!
Not sure if this is the right group but I've come across a problem I'm
at a loss to model properly. Here's the setup:
A model contains three entities ("Level"s) describing projects:
- Project Family records, each referencing several
- Project records (with different attributes), in turn referencing
- Sub projects, with different attributes again.
Those three Project levels are connected by straight forward 1 to n
relationships.
But the problem is that they all have a bunch of key/value pairs.
So, a project family can have a key/value-pair StartDate=20080615.
But each project and subproject can have a different StartDate.
On the other hand, sub projects, projects and family don't need to have
the same key/value pairs.

Now, the simple solution is to have three key_value tables and be done with
it. However what I'd very much prefer is just one key_value table with some
kind of "level" attribute, 0 being family, 1 being project and 2 being
sub project. The primary keys on the level entities are all numeric so
this would perhaps work but I have no idea how to get the foreign key
constraints done because the key_value table would have three parents.

How does one model relationships in which
- one child table has several parent tables
- each parent record can refer to several child records
- each child record belongs to exactly one parent record in exactly one of
the several parent tables?
Is there a declarative way to enforce consistency?

Lots of Greetings!
Volker
Ooooh! Reinventing EAV with levels...


Reply With Quote
  #7  
Old   
Bob Badour
 
Posts: n/a

Default Re: Modeling question... - 07-08-2008 , 01:07 PM



Volker Hetzer wrote:

Quote:
Hi!
Not sure if this is the right group but I've come across a problem I'm
at a loss to model properly. Here's the setup:
A model contains three entities ("Level"s) describing projects:
- Project Family records, each referencing several
- Project records (with different attributes), in turn referencing
- Sub projects, with different attributes again.
Those three Project levels are connected by straight forward 1 to n
relationships.
But the problem is that they all have a bunch of key/value pairs.
So, a project family can have a key/value-pair StartDate=20080615.
But each project and subproject can have a different StartDate.
On the other hand, sub projects, projects and family don't need to have
the same key/value pairs.

Now, the simple solution is to have three key_value tables and be done with
it. However what I'd very much prefer is just one key_value table with some
kind of "level" attribute, 0 being family, 1 being project and 2 being
sub project. The primary keys on the level entities are all numeric so
this would perhaps work but I have no idea how to get the foreign key
constraints done because the key_value table would have three parents.

How does one model relationships in which
- one child table has several parent tables
- each parent record can refer to several child records
- each child record belongs to exactly one parent record in exactly one of
the several parent tables?
Is there a declarative way to enforce consistency?

Lots of Greetings!
Volker
Ooooh! Reinventing EAV with levels...


Reply With Quote
  #8  
Old   
Bob Badour
 
Posts: n/a

Default Re: Modeling question... - 07-08-2008 , 01:07 PM



Volker Hetzer wrote:

Quote:
Hi!
Not sure if this is the right group but I've come across a problem I'm
at a loss to model properly. Here's the setup:
A model contains three entities ("Level"s) describing projects:
- Project Family records, each referencing several
- Project records (with different attributes), in turn referencing
- Sub projects, with different attributes again.
Those three Project levels are connected by straight forward 1 to n
relationships.
But the problem is that they all have a bunch of key/value pairs.
So, a project family can have a key/value-pair StartDate=20080615.
But each project and subproject can have a different StartDate.
On the other hand, sub projects, projects and family don't need to have
the same key/value pairs.

Now, the simple solution is to have three key_value tables and be done with
it. However what I'd very much prefer is just one key_value table with some
kind of "level" attribute, 0 being family, 1 being project and 2 being
sub project. The primary keys on the level entities are all numeric so
this would perhaps work but I have no idea how to get the foreign key
constraints done because the key_value table would have three parents.

How does one model relationships in which
- one child table has several parent tables
- each parent record can refer to several child records
- each child record belongs to exactly one parent record in exactly one of
the several parent tables?
Is there a declarative way to enforce consistency?

Lots of Greetings!
Volker
Ooooh! Reinventing EAV with levels...


Reply With Quote
  #9  
Old   
Bob Badour
 
Posts: n/a

Default Re: Modeling question... - 07-08-2008 , 01:07 PM



Volker Hetzer wrote:

Quote:
Hi!
Not sure if this is the right group but I've come across a problem I'm
at a loss to model properly. Here's the setup:
A model contains three entities ("Level"s) describing projects:
- Project Family records, each referencing several
- Project records (with different attributes), in turn referencing
- Sub projects, with different attributes again.
Those three Project levels are connected by straight forward 1 to n
relationships.
But the problem is that they all have a bunch of key/value pairs.
So, a project family can have a key/value-pair StartDate=20080615.
But each project and subproject can have a different StartDate.
On the other hand, sub projects, projects and family don't need to have
the same key/value pairs.

Now, the simple solution is to have three key_value tables and be done with
it. However what I'd very much prefer is just one key_value table with some
kind of "level" attribute, 0 being family, 1 being project and 2 being
sub project. The primary keys on the level entities are all numeric so
this would perhaps work but I have no idea how to get the foreign key
constraints done because the key_value table would have three parents.

How does one model relationships in which
- one child table has several parent tables
- each parent record can refer to several child records
- each child record belongs to exactly one parent record in exactly one of
the several parent tables?
Is there a declarative way to enforce consistency?

Lots of Greetings!
Volker
Ooooh! Reinventing EAV with levels...


Reply With Quote
  #10  
Old   
Bob Badour
 
Posts: n/a

Default Re: Modeling question... - 07-08-2008 , 01:07 PM



Volker Hetzer wrote:

Quote:
Hi!
Not sure if this is the right group but I've come across a problem I'm
at a loss to model properly. Here's the setup:
A model contains three entities ("Level"s) describing projects:
- Project Family records, each referencing several
- Project records (with different attributes), in turn referencing
- Sub projects, with different attributes again.
Those three Project levels are connected by straight forward 1 to n
relationships.
But the problem is that they all have a bunch of key/value pairs.
So, a project family can have a key/value-pair StartDate=20080615.
But each project and subproject can have a different StartDate.
On the other hand, sub projects, projects and family don't need to have
the same key/value pairs.

Now, the simple solution is to have three key_value tables and be done with
it. However what I'd very much prefer is just one key_value table with some
kind of "level" attribute, 0 being family, 1 being project and 2 being
sub project. The primary keys on the level entities are all numeric so
this would perhaps work but I have no idea how to get the foreign key
constraints done because the key_value table would have three parents.

How does one model relationships in which
- one child table has several parent tables
- each parent record can refer to several child records
- each child record belongs to exactly one parent record in exactly one of
the several parent tables?
Is there a declarative way to enforce consistency?

Lots of Greetings!
Volker
Ooooh! Reinventing EAV with levels...


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.