Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 84867 invoked from network); 12 Dec 2008 16:13:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 12 Dec 2008 16:13:16 -0000 Received: (qmail 8600 invoked by uid 500); 12 Dec 2008 16:13:27 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 8559 invoked by uid 500); 12 Dec 2008 16:13:27 -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 8548 invoked by uid 500); 12 Dec 2008 16:13:27 -0000 Delivered-To: apmail-incubator-couchdb-user@incubator.apache.org Received: (qmail 8544 invoked by uid 99); 12 Dec 2008 16:13:27 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Dec 2008 08:13:27 -0800 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of awolff@gmail.com designates 74.125.46.153 as permitted sender) Received: from [74.125.46.153] (HELO yw-out-1718.google.com) (74.125.46.153) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Dec 2008 16:13:12 +0000 Received: by yw-out-1718.google.com with SMTP id 5so735951ywr.0 for ; Fri, 12 Dec 2008 08:12:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:mime-version:content-type; bh=NmQxEvvZAYXOnVa0buzmgruWSk1VbBPGJNbjX9wXNvQ=; b=oThn3elW57hFVTwnrLEAM4PFasorxmSn0EDojrjtPEr+RbWmsVx5GA+iAv7E8paBZv 1oTrqEh6knr44u3UEr6yVFaGgp994cdhrcUzTLxQ4FxyvzLeGCI8mxA6v6C0Zg0wnhSF TnlmLChOM3d4JNkEHy7U8iNJH5RodudOhXd5w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=DHk8Q+Yseavmkc5R/lLMVcadeMr9E7bAOfqmikL6kOo3YCcKc96+UyV3Mbuzn1SKo/ jwHLN9FxZ1jWkruZxcLwfs1h9VZtVtVC5mu9D24IIGg/G9+fO86tc1VJYS/2U0CQgb9l CJ+1TpazFVrQ7gMo3MsQ/SJSWZqKvr7roFdmo= Received: by 10.100.128.2 with SMTP id a2mr2954278and.93.1229098371815; Fri, 12 Dec 2008 08:12:51 -0800 (PST) Received: by 10.100.135.17 with HTTP; Fri, 12 Dec 2008 08:12:51 -0800 (PST) Message-ID: Date: Fri, 12 Dec 2008 08:12:51 -0800 From: "Adam Wolff" To: couchdb-user@incubator.apache.org Subject: DAG on couch MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_6221_30260205.1229098371793" X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_6221_30260205.1229098371793 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline Hi everyone, I'm just getting started with CouchDB and I'm really excited about it. I'm working with a directed acyclic graph, and I'd like to be able to efficiently retrieve graph chunks with a single query. So conceptually, my data looks like this doc1: {content: ..., ancestor: null} doc2: {content: ..., ancestor: "doc1"} doc3: {content: ..., ancestor: "doc2"} doc4: {content: ..., ancestor: "doc3"} doc5: {content: ..., ancestor: "doc3"} Long runs of singly linked ancestors will be common; branches (e.g. after doc3 in the example above) will be less common but not rare. I get how you can use couch to retrieve a primary key and foreign key at the same time (through view collation) but I'm wondering if there's a clever way to do this recursively. If I could pull depths of 5 nodes or so at a time, that'd be fine. I can always go back for more if I need it. I can imagine a few hacky solutions, like retaining a list of ancestors, but that it makes it pretty much impossible to reorder the graph. Is there a clever solution I'm missing? Thanks in advance, A ------=_Part_6221_30260205.1229098371793--