[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: Can there be any hierarchy in attributes (ITS#896)



NOTE: Moved discussion from ITS to software list.

arai@cse.iitkgp.ernet.in wrote:
>   I am new to openldap .  As far as I understand the  attributes for an
> object is stored in a flat manner.  Can the attributes be stored in an
> hierarchal manner ??

An entry can be a branch.

1. o=Tree

2. dn=trunk=main, o=Tree

3. dn=branch=3,trunk=main, o=Tree

4. dn=arm=6,branch=3,trunk=main, o=Tree

5. dn=twig=234,arm=6,branch=3,trunk=main,o=Tree

6. dn=leaf=18167,twig=234,arm=6,branch=3,trunk=main,o=Tree

All of these are separate entries, and all can have their own attributes.

> Ex: Suppose I am storing information about hotels in my city, and I want
> to check whether a double room is available in any hotel.  Can someone
> please suggest a suitable way of doing this ??

Er.. not the best use for LDAP (this sounds like a relational DB might
be better), but see explanation above for data model. You could walk
the tree.

> As far as I understand the object hotel should have an attribue Rooms,
> which should have two leaves say single and double, and then I store the
> number of available rooms at each of the leaf.  got the idea??

You're almost there.  You just need to abstract the attributes away
from the parents, and place them on the children, which each have their
own entries in ldap.

Entry 1:
kind=single,name=SleepInn,city=london, o=Hotelfinder
room_avail=yes

Entry 2:
kind=double,name=SleepInn,city=london, o=Hotelfinder
room_avail=yes

and their children:
Entry 3:
room=167A,kind=single,name=SleepInn,city=london, o=Hotelfinder
room_avail=yes

Entry 4:
room=167B,kind=single,name=SleepInn,city=london, o=Hotelfinder
room_avail=no

But now you're adding a pretty heavy churn, where you're doing a
great deal of updating to keep it all current (which is why you
might want to use an RDBMS, instead.)

-Ronabop

--
Brought to you from iBop the iMac, a MacOS, Win95, Win98, LinuxPPC machine,
which is currently in MacOS land.  Your bopping may vary.