[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[FR-devel] Added simple links in databus
From: |
Rich Kilmer |
Subject: |
[FR-devel] Added simple links in databus |
Date: |
Fri, 13 Sep 2002 00:19:17 -0400 |
As the subject says, I added the ability to create simple links in the
databus between two paths. So if you have a slot:
db = FreeBASE::DataBus.new
slot1 = db['slot1']
You can create a link to another path in the databus:
slot1.link("subslot1", "/slot2/subslot2")
Then if you access subslot1:
puts db['slot1/subslot1'].path #=> /slot2/subslot2
I also added:
slot1.is_linked?("subslot1") #=> true
and
slot1.unlink("subslot1")
The reason I call this simple linking is that if you traverse a relative
path through a link you could have problems:
db = FreeBASE::DataBus.new
slot1 = db['slot1']
slot1.link('subslot1', 'slot2/subslot2')
and then you go:
x = db['slot1/subslot1/..']
puts x.path #=> /slot2
In other words, the links are a single (forward) direction. Creating
something like symbolic links in Linux that maintain their reverse
direction would be very hard to do in the current databus architecture.
Why is this useful:
db = DataBus.new
db['/system/ui/component/pool/EditPane/pane1']
db['/system/ui/component/pool/EditPane/pane2']
db['/system/ui/component/pool/EditPane/pane2']
db['/system/ui/component/pool/EditPane'].link('current', '../pane1')
and then as you swith between panes:
db['/system/ui/component/pool/EditPane'].link('current', '../pane2')
but you will always reference the current pane by:
db['/system/ui/component/pool/EditPane/current']
Hope this makes sense. I am going to look for opportunities in the GUI
to use this.
Regards,
-rich
- [FR-devel] Added simple links in databus,
Rich Kilmer <=