public
Homepage: http://www.melgray.org
Clone URL: git://github.com/melito/dm-is-nested_interval.git
name age message
file LICENSE Mon Jun 23 21:39:39 -0700 2008 DEV: Commiting skeleton of future plugin. [melito]
file README Tue Aug 19 17:55:18 -0700 2008 [melito]
file TODO Mon Jun 23 21:29:04 -0700 2008 first [melito]
directory lib/ Mon Jul 21 14:10:47 -0700 2008 DEV: Minor changes...still nothing here. [melito]
directory spec/ Mon Jun 30 22:49:11 -0700 2008 DEV: Making a little progress....very little pr... [melito]
README
dm-is-nested_interval
=====================

################
## DO NOT USE ##
################

I haven't done anything here yet.

Nested Intervals are a great way of overcoming some of the write problems associated with nested sets.

They are also a great way of driving you insane.

DataMapper is a great way of abstracting the database.  It has a fun syntax and makes talking to the database and moving 
things around it a snap.  I intend on building an interface for Nested Intervals around the simple API which makes up 
DataMapper.

What is a Nested Set ?
======================

Look at the DataMapper plugin 'dm-is-nested_set' for a brief explanation. 
(http://github.com/sam/dm-more/tree/master/dm-is-nested_set)

Here is a pretty diagram lifted from the dm-is-nested_set README file.
 _____________________________________________________________________________
|   _________________________________    __________________________________   |
|  |   ______    _____    ________   |  |   _______________    _________   |  |
|  |  |      |  |     |  |        |  |  |  |               |  |         |  |  |
1  2  3      4  5     6  7        8  9  10 11             12  13  CD-  14 15 16
|  |  | Tube |  | LCD |  | Plasma |  |  |  |  MP3 Players  |  | Players |  |  |
|  |  |______|  |_____|  |________|  |  |  |_______________|  |_________|  |  |
|  |                                 |  |                                  |  |
|  |          Televisions            |  |       Portable Electronics       |  |
|  |_________________________________|  |__________________________________|  |
|                                                                             |
|                                 Electronics                                 |
|_____________________________________________________________________________|


What is a Nested Interval ?
===========================

Nested Intervals generalize Nested Sets.

Using Nested Intervals you don't limit your self to using integers for boundaries.
Instead, Nested Intervals use rational numbers for boundaries (not rational in the sense they are calm and sane, but 
rather they are a fractions; think 1/2 = 0.5)

Look at the diagram above.  It's going to work great for hierarchal data that is going to remain relatively static. 
Problems will arise if you have a lot of concurrent writes, because anytime a new record is inserted (say into the 
middle of the hierarchy) you have to recompute the boundaries for everything around the insert point.

A solution that I've come across for this problem is to allow for gaps in the boundaries when inserting new records (IE, 
all new records have boundaries set well beyond their means to allow for a number of children).  I believe the formula 
for this is: (rgt-lft+1)/2

This may sound complex, but its not (hopefully).  
I am NOT a smart person by any means (actually quite dense), but after discussing simple math with a good friend of 
mine, I was able to wrap my head around it.  

The whole point of writing this plugin is to allow for an easy means of creating and updating records using Nested 
Intervals.

Continued Fractionz
====================
To be continued...


Irrational numbers ?
====================

WtF? We need more sanity not less!
I have no time for dealing with anything irrational.
Coming soon.


Using
=====
Coming soon.


License
=======

Well, I haven't done anything yet, but what the hell: