Re: Getting a grip on nested intervals and matrix encoding

From: creecode <creecode_at_gmail.com>
Date: Sat, 3 Jul 2010 12:09:24 -0700 (PDT)
Message-ID: <f3881827-e117-4205-8531-ddcdac2eb084_at_a6g2000pro.googlegroups.com>


On Jul 1, 2:05 pm, creecode <creec..._at_gmail.com> wrote:

> I'm attempting to use Vadim Tropashko's nested intervals and matrix
> encoding technique.  As described in chapter 5 of his "SQL Design
> Patterns" book and also in various online articles and discussion
> groups.

Hello again,

I'm now onto the ancestors portion of the chapter starting on page 177 and the formula for calculating ancestor matrices seems to work OK except for the the root node. Is the root node a special case that I should detect and then just insert it manually?

Let's use our friend FORD from my MatrixTreeNodes table shown previously and run the formula.

name materialized_path a11 a12 a21 a22

FORD   1.1.2                       7     3     5     2


SELECT 3 AS a11, 3 - MOD ( 7, 3 ) AS a12, 2 AS a21, 2 - MOD ( 5, 2 ) AS a22;

a11	a12	a21	a22
3	2	2	1


SELECT 2 AS a11, 2 - MOD ( 3, 2 ) AS a12, 1 AS a21, 1 - MOD ( 2, 1 ) AS a22;

a11	a12	a21	a22
2	1	1	1

  • that isn't what we want **

Toodle-loooooooo..........
creecode Received on Sat Jul 03 2010 - 21:09:24 CEST

Original text of this message