Re: Attribute-values in separate table

From: Neo <neo55592_at_hotmail.com>
Date: Thu, 30 Aug 2007 12:02:44 -0700
Message-ID: <1188500564.292052.252850_at_q4g2000prc.googlegroups.com>


> Table:
>   Furniture-attribute
> Attributes:
>   Furniture-ID
>   Attribute-Name
>   Attribute-Type
>   Attribute-Value
>   Validity-begin-date
>   Validity-end-date
>
> What are the pro's and con's for [above] approach?

Pros: Flexiblity, less NULLs, ability to add new attributes on-the-fly without having to modify db schema, less impact on code. Cons: Less SQL support, more initial coding, slower performance.

Alternatively, in a database that employs a network of nodes, whether things have samilar or different attributes makes little difference, requires no schema and does not incurr NULLs. Following dbd script models some furniture:

(; Note: is, from, to are part of system data)
(new 'component)
(new 'valid)

(new 'table1 'furniture)
(set+ table1 component 'wheel)

(new 'cabinet2 'furniture)
(set+ cabinet2 component 'wheel)
(set+ cabinet2 component 'shelve)
(set+ cabinet2 component 'lock)

(new 'desk3 'furniture)
(set+ desk3 component 'lock)
(set desk3 component (val+ 'drawer)

         is valid
         from (new '070101 'date)
         to (new '080101 'date))


(; Get furnitures with wheel)
(; Gets table1 and cabinet2)
(get * component wheel)

(; Following expression get node that represents:

   desk3 component drawer is valid from 070101 to 080101)
(new '060101 'date) (new '080101 'date)
(get (get furniture instance *) component (get component instance *)

       is valid
       from (>= (get date instance *) 060101)
       to (<= (get date instance *) 080101))


For related example "Persons with Varied Attributes", see www.dbfordummies.com/example/ex020.asp Received on Thu Aug 30 2007 - 21:02:44 CEST

Original text of this message