Re: Getting transitive closure?

2012-10-15 Thread John English
Best solution I've been able to come up with is this, which does N selects where N is the path length from the start to the furthest leaf. Can anyone suggest anything better? /** * Process all descendants of a specified row in a table * with a recursive key relationship. A method

AW: Getting transitive closure?

2012-10-15 Thread Malte.Kempff
] Gesendet: Montag, 15. Oktober 2012 12:02 An: derby-user@db.apache.org Betreff: Re: Getting transitive closure? Best solution I've been able to come up with is this, which does N selects where N is the path length from the start to the furthest leaf. Can anyone suggest anything better

Getting transitive closure?

2012-10-14 Thread John English
If I have a table defined like so: create table COMPONENTS ( ID integer generated always as identity, COMPONENT varchar(255) not null, PARENT integer, constraint COMPONENTS_PK primary key (ID), constraint COMPONENTS_1 foreign key (PARENT)

RE: Getting transitive closure?

2012-10-14 Thread John I. Moore, Jr.
...@softmoore.com web:www.softmoore.com cell: 843-906-7887 -Original Message- From: John English [mailto:john.fore...@gmail.com] Sent: Sunday, October 14, 2012 7:53 AM To: Derby Discussion Subject: Getting transitive closure? If I have a table defined like so: create table

Re: Getting transitive closure?

2012-10-14 Thread José Ventura
I might be mistaken, but I think Derby does not support this out-of-the-box. There are, however, a few interesting solutions suggested in this (2009) thread: http://old.nabble.com/Recursive-query-on-common-table-td25819772.html On Sun, Oct 14, 2012 at 8:52 AM, John English

Re: Getting transitive closure?

2012-10-14 Thread John English
On 14/10/2012 14:37, John I. Moore, Jr. wrote: John, I suggest that you take a look at Warshall's Algorithm. Thanks, I'm familiar with Warshall's algorithm. What I'm trying to avoid is issuing gazillions of selects; I thought there might be a clever tricky SQL way of doing this that I

Re: Getting transitive closure?

2012-10-14 Thread John English
On 14/10/2012 14:45, José Ventura wrote: I might be mistaken, but I think Derby does not support this out-of-the-box. There are, however, a few interesting solutions suggested in this (2009) thread: http://old.nabble.com/Recursive-query-on-common-table-td25819772.html Thanks! I'm now in the

Re: Getting transitive closure?

2012-10-14 Thread david myers
Hi all, I learnt something today. COOL. So I had a quick look to understand what a weighted graph was see: http://www.informatics.susx.ac.uk/courses/dats/notes/html/node130.html Then I had a look at the http://en.wikipedia.org/wiki/Floyd%E2%80%93Warshall_algorithm link provided by John

Re: Getting transitive closure?

2012-10-14 Thread Katherine Marsden
On 10/14/2012 6:34 AM, John English wrote: On 14/10/2012 14:45, José Ventura wrote: I might be mistaken, but I think Derby does not support this out-of-the-box. There are, however, a few interesting solutions suggested in this (2009) thread: