dbTalk Databases Forums  

Is it Possible to Enforce This Relationship at the DB Level?

comp.databases.theory comp.databases.theory


Discuss Is it Possible to Enforce This Relationship at the DB Level? in the comp.databases.theory forum.



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

Default Is it Possible to Enforce This Relationship at the DB Level? - 10-15-2007 , 03:13 PM






DB layout is as follows:

--------------------------------
Quote:
Client |
--------------------------------
1
Quote:

0..*
-------------------------------
Quote:
Service |
-------------------------------
1
Quote:

1
---------------------------------
---------------------------
Quote:
Spreadsheet Config | 1 ------ 1..* | Cell Config |
--------------------------------
---------------------------
1 1
Quote:
|
|
1 |
-------------------------------- |
Quote:
Spec | |
-------------------------------- |
1 |
Quote:
|
|
1..* |
-------------------------------- |
Quote:
Field |
1----------------------------|
--------------------------------

Every client has a spreadsheet that must implement a version of Spec.
For this version, the cell config must corresponding to cells in the
spreadsheet containing fields for the given Spec.

As long a Cell Config references a Fileld, th DB will be happy, but
the problem I have is making sure that the Fields referenced by Cell
Config are indeed children of the Spec referenced by Spreadsheet
Config.

Is it possible to enforce this at a DB level? Maybe my model is
flawed?

Thanks



Reply With Quote
  #2  
Old   
David Portas
 
Posts: n/a

Default Re: Is it Possible to Enforce This Relationship at the DB Level? - 10-15-2007 , 04:00 PM






"dutone" <dutone (AT) hotmail (DOT) com> wrote

Quote:
DB layout is as follows:

--------------------------------
| Client |
--------------------------------
1
|
|
0..*
-------------------------------
| Service |
-------------------------------
1
|
|
1
---------------------------------
---------------------------
| Spreadsheet Config | 1 ------ 1..* | Cell Config |
--------------------------------
---------------------------
1 1
| |
| |
1 |
-------------------------------- |
| Spec | |
-------------------------------- |
1 |
| |
| |
1..* |
-------------------------------- |
| Field |
1----------------------------|
--------------------------------

Every client has a spreadsheet that must implement a version of Spec.
For this version, the cell config must corresponding to cells in the
spreadsheet containing fields for the given Spec.

As long a Cell Config references a Fileld, th DB will be happy, but
the problem I have is making sure that the Fields referenced by Cell
Config are indeed children of the Spec referenced by Spreadsheet
Config.

Is it possible to enforce this at a DB level? Maybe my model is
flawed?

Thanks

In principle it is possible, assuming your DBMS supports something like
SQL's CREATE ASSERTION statement for example.

--
David Portas






Reply With Quote
  #3  
Old   
Cimode
 
Posts: n/a

Default Re: Is it Possible to Enforce This Relationship at the DB Level? - 10-15-2007 , 04:03 PM



On 15 oct, 22:13, dutone <dut... (AT) hotmail (DOT) com> wrote:
Quote:
DB layout is as follows:

--------------------------------
| Client |
--------------------------------
1
|
|
0..*
-------------------------------
| Service |
-------------------------------
1
|
|
1
---------------------------------
---------------------------
| Spreadsheet Config | 1 ------ 1..* | Cell Config |
--------------------------------
---------------------------
1 1
| |
| |
1 |
-------------------------------- |
| Spec | |
-------------------------------- |
1 |
| |
| |
1..* |
-------------------------------- |
| Field |
1----------------------------|
--------------------------------

Every client has a spreadsheet that must implement a version of Spec.
For this version, the cell config must corresponding to cells in the
spreadsheet containing fields for the given Spec.

As long a Cell Config references a Fileld, th DB will be happy, but
the problem I have is making sure that the Fields referenced by Cell
Config are indeed children of the Spec referenced by Spreadsheet
Config.

Is it possible to enforce this at a DB level? Maybe my model is
flawed?

Thanks
In *no case* presentation should determine design. Proper design
should be the consequence of studying sound principles of relational
modeling.

For more info...

Introduction to Database Systems. CJ Date



Reply With Quote
  #4  
Old   
dutone
 
Posts: n/a

Default Re: Is it Possible to Enforce This Relationship at the DB Level? - 10-15-2007 , 04:54 PM




Quote:
Is it possible to enforce this at a DB level? Maybe my model is
flawed?

In *no case* presentation should determine design. Proper design
should be the consequence of studying sound principles of relational
modeling.
Huh, who said anything about presentation? I'm trying to construct an
appropriate data model based on a set of business rules.
Thanks for the advice....





Reply With Quote
  #5  
Old   
dutone
 
Posts: n/a

Default Re: Is it Possible to Enforce This Relationship at the DB Level? - 10-15-2007 , 04:59 PM



On Oct 15, 2:00 pm, "David Portas"
<REMOVE_BEFORE_REPLYING_dpor... (AT) acm (DOT) org> wrote:
Quote:
"dutone" <dut... (AT) hotmail (DOT) com> wrote in message

news:1192479211.800346.53530 (AT) i38g2000prf (DOT) googlegroups.com...



DB layout is as follows:

--------------------------------
| Client |
--------------------------------
1
|
|
0..*
-------------------------------
| Service |
-------------------------------
1
|
|
1
---------------------------------
---------------------------
| Spreadsheet Config | 1 ------ 1..* | Cell Config |
--------------------------------
---------------------------
1 1
| |
| |
1 |
-------------------------------- |
| Spec | |
-------------------------------- |
1 |
| |
| |
1..* |
-------------------------------- |
| Field |
1----------------------------|
--------------------------------

Every client has a spreadsheet that must implement a version of Spec.
For this version, the cell config must corresponding to cells in the
spreadsheet containing fields for the given Spec.

As long a Cell Config references a Fileld, th DB will be happy, but
the problem I have is making sure that the Fields referenced by Cell
Config are indeed children of the Spec referenced by Spreadsheet
Config.

Is it possible to enforce this at a DB level? Maybe my model is
flawed?

Thanks

In principle it is possible, assuming your DBMS supports something like
SQL's CREATE ASSERTION statement for example.
I'd like to enforce this based on the data model and its
relationships.
Although to me, it doesn't seem possible without an additional layer
of logic.
The need for a check assertion in a RDMS tells me that cerain
cituations must be enforced at a higher level. This is one of them I
guess.

Thanks




Reply With Quote
  #6  
Old   
David Portas
 
Posts: n/a

Default Re: Is it Possible to Enforce This Relationship at the DB Level? - 10-16-2007 , 06:03 AM



On 15 Oct, 22:59, dutone <dut... (AT) hotmail (DOT) com> wrote:
Quote:
I'd like to enforce this based on the data model and its
relationships.
Although to me, it doesn't seem possible without an additional layer
of logic.
The need for a check assertion in a RDMS tells me that cerain
cituations must be enforced at a higher level. This is one of them I
guess.

Maybe your definition of a data model differs from mine. All such
constraints are surely part of that model irrespective of what syntax
the DBMS uses.

If you have some particular DBMS in mind then maybe someone will have
other suggestions about features supported by that product. Perhaps a
redesign would also be possible but I'm reluctant to begin a design-by-
newsgroup exercise.

--
David Portas



Reply With Quote
  #7  
Old   
David Cressey
 
Posts: n/a

Default Re: Is it Possible to Enforce This Relationship at the DB Level? - 10-16-2007 , 07:36 AM




"David Portas" <REMOVE_BEFORE_REPLYING_dportas (AT) acm (DOT) org> wrote

Quote:
On 15 Oct, 22:59, dutone <dut... (AT) hotmail (DOT) com> wrote:

I'd like to enforce this based on the data model and its
relationships.
Although to me, it doesn't seem possible without an additional layer
of logic.
The need for a check assertion in a RDMS tells me that cerain
cituations must be enforced at a higher level. This is one of them I
guess.


Maybe your definition of a data model differs from mine. All such
constraints are surely part of that model irrespective of what syntax
the DBMS uses.

If you have some particular DBMS in mind then maybe someone will have
other suggestions about features supported by that product. Perhaps a
redesign would also be possible but I'm reluctant to begin a design-by-
newsgroup exercise.

Very good point. Design-by-newsgroup has almost always been based on flawed
analysis.

Second, "enforcing this based on the model" is clearly an implementation
issue, not a modeling issue.





Reply With Quote
  #8  
Old   
TroyK
 
Posts: n/a

Default Re: Is it Possible to Enforce This Relationship at the DB Level? - 10-16-2007 , 02:59 PM



On Oct 15, 3:54 pm, dutone <dut... (AT) hotmail (DOT) com> wrote:
Quote:
Is it possible to enforce this at a DB level? Maybe my model is
flawed?
In *no case* presentation should determine design. Proper design
should be the consequence of studying sound principles of relational
modeling.

Huh, who said anything about presentation? I'm trying to construct an
appropriate data model based on a set of business rules.
Thanks for the advice....
"client", "spreadsheet", "cells", etc. all sound like user interface
or
presentation concepts. Difficult to tell without working definitions
for these entities that you have identified, though.



Reply With Quote
  #9  
Old   
Roy Hann
 
Posts: n/a

Default Re: Is it Possible to Enforce This Relationship at the DB Level? - 10-17-2007 , 02:44 AM



"dutone" <dutone (AT) hotmail (DOT) com> wrote

Quote:
In principle it is possible, assuming your DBMS supports something like
SQL's CREATE ASSERTION statement for example.

I'd like to enforce this based on the data model and its
relationships.
Where you say data model I am sure you mean "logical model" or "conceptual
model". Although most people would understand what you mean when you use
that term, it is a colloquailism that can/will be misconstrued by readers of
this newsgroup. More importantly, if you do take the advice you will get
about reading books on fundamentals you will find it easier if you know
those books use the term data model for something very different than you
expect.

Quote:
Although to me, it doesn't seem possible without an additional layer
of logic.
The need for a check assertion in a RDMS tells me that cerain
cituations must be enforced at a higher level.
I suspect you might be thinking that referential integrity constraints
should be enough to represent the business rules of your entire enterprise
of interest. That is not possible even in principle. There are all kinds
of other constraints that one needs, and SQL is supposed to implement some
of them (e.g. the check constraints you refer to, and general
constraints/assertions). Whether your SQL implementation provides them is
another matter, but in any case SQL doesn't provide all the constraint
mechanisms you could want, and if it does it may not support them flexibly
enough (e.g. by allowing checking to be deferred).

In practice you will have to enforce some assertions in your application,
but only because your SQL server doesn't. You should take advantage of
whatever limited constraint enforcement your SQL implementation provides,
for a whole lot of reasons.

Roy






Reply With Quote
  #10  
Old   
Ed Prochak
 
Posts: n/a

Default Re: Is it Possible to Enforce This Relationship at the DB Level? - 10-18-2007 , 10:57 PM



On Oct 16, 7:03 am, David Portas
<REMOVE_BEFORE_REPLYING_dpor... (AT) acm (DOT) org> wrote:
Quote:
On 15 Oct, 22:59, dutone <dut... (AT) hotmail (DOT) com> wrote:



I'd like to enforce this based on the data model and its
relationships.
Although to me, it doesn't seem possible without an additional layer
of logic.
The need for a check assertion in a RDMS tells me that cerain
cituations must be enforced at a higher level. This is one of them I
guess.

Maybe your definition of a data model differs from mine. All such
constraints are surely part of that model irrespective of what syntax
the DBMS uses.

If you have some particular DBMS in mind then maybe someone will have
other suggestions about features supported by that product. Perhaps a
redesign would also be possible but I'm reluctant to begin a design-by-
newsgroup exercise.

--
David Portas
I'm not trying to start a group design effort, but his original model
certainly seems to me to have the Cell Config in the wrong place. At
the logical lege, the connections should be described verbally (the
cardinality can be there but blank connections between entities leaves
too many unidentified assumptions.

So many business systems designers unconsciously think everything
about their application is "intuitively obvious" when the truth it, it
is not obvious, sometimes not even to the initiated.

Ed



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 - 2012, Jelsoft Enterprises Ltd.