Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 80940 invoked from network); 3 Sep 2009 13:07:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 3 Sep 2009 13:07:16 -0000 Received: (qmail 63376 invoked by uid 500); 3 Sep 2009 13:07:15 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 63325 invoked by uid 500); 3 Sep 2009 13:07:15 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 63315 invoked by uid 99); 3 Sep 2009 13:07:15 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Sep 2009 13:07:15 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of akat.metin@gmail.com designates 209.85.218.211 as permitted sender) Received: from [209.85.218.211] (HELO mail-bw0-f211.google.com) (209.85.218.211) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Sep 2009 13:07:06 +0000 Received: by bwz7 with SMTP id 7so1743306bwz.11 for ; Thu, 03 Sep 2009 06:06:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=I9usL4g1i73SZvJl5YGnyyQ3iqmIAnZPV/8EXlJp3Ik=; b=NEdCHr2M+5uh4rgUe8TcOnAw1b1wPI1exVoK14Ik8qzsUz7NCmEtXC5mpcB/YdDKbV 27hfpOZ0d5zFtoab3F+euv6DhHUENYEyTqXqu2I/T14v87yJyAKa+yyPxouQaJMgVeRx wSsBMwPi95h1xhIp7Cr6XEigy5hhvkKMUnLRQ= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=ljO/MGuO2FRqDrLDB6s7/wFTvtErHlN3em8ifhOWkBEVA1sgXKYcQZPyvguwkczpJx DUM1Q2qwVYrR9RLpkD5EaazsY8PH7WIwNqwRx9gWO2i8k8pK6utjcDlZOp6SnY1uXbL9 LmNBo5YDrrn4VtSu3PVTRcFmobxK/YSxq1w+w= MIME-Version: 1.0 Received: by 10.102.249.10 with SMTP id w10mr4178070muh.49.1251983205654; Thu, 03 Sep 2009 06:06:45 -0700 (PDT) In-Reply-To: References: <98a246a10909030535r59b1ecc2m32bfb1b0dc93fe46@mail.gmail.com> Date: Thu, 3 Sep 2009 16:06:45 +0300 Message-ID: <98a246a10909030606q4c02cfe1id2312054bea11b04@mail.gmail.com> Subject: Re: Tree structure: how to calculate branch node sum, using results from a view that calculates leaf node sums. From: Metin Akat To: user@couchdb.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Well, there is a problem with this. I don't like the idea of recording the whole path in each transaction, because it is anticipated that accounts are able to change places in the tree. So my TRANSACTION only holds information for only the "actual" account it's issued against, not for its whole lineage. On the other hand, ACCOUNTS do have the information for THEIR path(lineage), exactly as you suggested. So the problem now is making the connection between an account and its balance :) > > query your reduce view with group_level=1 (or 2 or 3 .. depending on how > many level you want to descend into your tree). Your "path" to the root node > should be an array as in: ["toplevel", "firstlevel", "secondlevel"] as the > key of your view. > > Cheers > Jan > -- > > >