Re: 1 NF
Date: 1 Mar 2007 10:17:55 -0800
Message-ID: <1172773075.067671.28790_at_v33g2000cwv.googlegroups.com>
Apologies if this post is duplicated...
On Feb 28, 1:14 pm, "frebe" <freb..._at_gmail.com> wrote:
> Hi,
> I read an interview with Chris Date (http://www.dbmsmag.com/
> int9410.html) which made me a little bit confused. He claims that
> having an array as a column values doesn't violates 1NF. Is this the
> common opinion at comp.databases.theory too? If yes, how is it
> possible at apply 1NF at all, in that case?
>
Here's my take on 1NF: I agree with Date above; in fact, I'd say it is
impossible to violate 1NF using relations. That said, I do think
there is a more informal version of 1NF which *can* be violated.
During conceptual modeling, one identifies the domains useful to an
enterprise in regards to the segment of reality being modeled. This
might mean answering questions like:
As far as the business is conerned, do employess have 1-to-many
relationships to CHILD entities, each of which has a NAME from a
"short string of alphabetic characters" domain, DOB from a "date
within the last 100 years" domain, and GENDER from a "1-character (M/
F)" domain; do employees have 1-to-many relationships with CHILD_NAME
from a "short string of <30 alphabetic characters" domain; or do
employees have 1:1 relationships with CHILD_LISTS from a "mediumlength
string of < 100 alphabetic, comma, and space characters"
domain; do employees have 1:(0/1) relationships with
FAMILY_DESCRIPTIONS from a "300 character string" domain ; etc.?
Given the above, I consider (informally!) 1NF to be violated when a logical model does not agree with the conceptual model in either of the following ways:
- Coneptual relationship between attributes A and B is not the same as the logical model. For example, a 1:(0/1) conceptual relationship logically modeled as 1:1, or a 1:many conceptual relationship logicaly modeled as 1:{N=1, 2, 3,...}). So the following would violate 1NF for those reasons (repsecitvely): EMP declared as {EMP(key), EMP_NAME, FAMILY_DESCRIPTION} where EMP:FAMILY_DESCRIPTION was conceptually modeled as 1:(0/1); or EMP defined as {EMP(key), EMP_NAME, CHILD_NAME1, CHILD_NAME2, CHILD_NAME3} where EMP:CHILD_NAME was conceptually modeled as 1:(0-many).
- Conceptual entity/property domains do not match logical relationattribute domains. For example, if the conceptual model identified CHILD as having NAME, DOB, and GENDER properties as above, but the logical layer simply used a single CHILD_ATTRIBUTES with values like 'Alice*09-Feb-1992*F', that would violate 1NF.
> Does a blob containing an image violates 1NF? Wouldn't the correct way
> to model images be something like this:
>
> pixels(imageid, x, y, color)
>
Probably not - most enterprises probably couldn't care less about the
hue of the pixel at x coordinate 203 and y-coordinate 46 in their
employee's digital photo. I suppose I could see a niche photomanipulation
shop, interested in writing their own in-house imaging
tools w/out relying on propreitary formats, using a logical design
similar to what you describe. Certainly, the above representation
might make some manipulation functions easy to specify:
//crop
display.clear;
display.draw (SELECT x, y, color FROM pixels where imageid = 'IMG2'
AND x between mouse_down.x and mouse_up.x and y between mouse_down.y
and mouse_up.y) ;
//darken by 3 shades
display.clear;
display.draw (SELECT x, y, darken(color, 3) FROM pixels where
imageid='IMG2');
> Does it exists any attempts to implement a relational database that
> would be able to handle images like this, in an efficient way?
>
> /Fredrik
Dunno - as indicated above, I can imagine there being advantages to a
relational layer in image manipualation apps - many manipulation tasks
might be much more cleanly specified declaratively. However, I have a
hunch that most implementations are micro-optimized algorithms coded
for specific physical image representations.
Received on Thu Mar 01 2007 - 19:17:55 CET