Return-Path: X-Original-To: apmail-couchdb-user-archive@www.apache.org Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 08DC9732C for ; Sat, 5 Nov 2011 23:06:35 +0000 (UTC) Received: (qmail 8108 invoked by uid 500); 5 Nov 2011 23:06:33 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 8062 invoked by uid 500); 5 Nov 2011 23:06:32 -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 8054 invoked by uid 99); 5 Nov 2011 23:06:32 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Nov 2011 23:06:32 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of alex.barbalex@gmail.com designates 209.85.212.52 as permitted sender) Received: from [209.85.212.52] (HELO mail-vw0-f52.google.com) (209.85.212.52) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 05 Nov 2011 23:06:26 +0000 Received: by vws10 with SMTP id 10so1124702vws.11 for ; Sat, 05 Nov 2011 16:06:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:content-type; bh=JTXbzm0ateFi1KYlX6M7wSHgdISYgsp9Geug/ewpZCc=; b=KrAu5A8P8ljzCVTTHM9VblVZr/SWpoYxvlnljSk/JjFvA05VuhmZdE9T67Qh2P3CzV CFma+wtxPqt2LKWLCdZhiPQy3PbErdqX4PEOKkbU1pYtbSvNsB7MG+4XrA7Ip/YKMEvj 3dGt2At+k6xY5Yu4sHraHyhD+S+IW3SrvlAjk= MIME-Version: 1.0 Received: by 10.52.94.102 with SMTP id db6mr19233991vdb.118.1320534364665; Sat, 05 Nov 2011 16:06:04 -0700 (PDT) Sender: alex.barbalex@gmail.com Received: by 10.52.114.196 with HTTP; Sat, 5 Nov 2011 16:06:04 -0700 (PDT) Date: Sun, 6 Nov 2011 00:06:04 +0100 X-Google-Sender-Auth: vUb6cm3JIHUPErHy44d6NoBhLY4 Message-ID: Subject: How to get hierarchicaly linked data into one line? From: Alexander Gabriel To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=20cf307cff0ab8355d04b104dd65 X-Virus-Checked: Checked by ClamAV on apache.org --20cf307cff0ab8355d04b104dd65 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi experts I am developing a CouchApp. People can record sightings of species. There will be a webpage and apps for Android and iOS. CouchDB and CouchApps are a perfect tool for this. You can see the webpage here: http://barbalex.iriscouch.com/evab-ch_barbalex_evab/_design/index.html. Log in as "z" with password "z" and feel free to do anything - this is just for testing. Beginners and Hobbyists can record sightings in a simple list. This is easy to program and not part of the question (1 sighting =3D one document). Professionals will record attributes in a hierarchical manner: Project > n locations > n times/relev=C3=A9s (for repeated recordings) > n (sightings o= f) species. My goal is to create a list of all the sightings of species. On the same line should be all the attributes of all the hierarchies of a sighting. First attributes of the project, followed by the attributes of the location, time and species. With this list users will be able to export their data and easyly analyse it. I am not sure what is the best strategy to do this. I have pondered two: 1. Save attributes of hierarchies as separate documents with type =3D Project/location/time/species. This is my favored approach. But I can't figure out how to create a view/list with all the data of a sighting on one line. This would be easy peasy with a relational database. I must be missing something. I've seen this ( http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views#Linked_documen= ts) but it puts related data on neighbouring lines. 2. Save attributes of hierarchies as separate documents and save all the attributes of all the overlaying hierarchies in the document containing sightings of species. This is easy to query and has the advantage that all documents that record sightings of species include all the data of the sighting. Saving the data is easy to program. There are some downsides to this though: Data is stored redundantly. Approximately doubles or trippels the size of the database. When data is changed I have to make sure it is changed everywhere. This is hard to program. So here are my questions: a. Is there a way I can get hierarchicaly linked data into one line? b. Are there better strategies? Help is much appreciated Alex --20cf307cff0ab8355d04b104dd65--