incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander Gabriel <a...@barbalex.ch>
Subject How to get hierarchicaly linked data into one line?
Date Sat, 05 Nov 2011 23:06:04 GMT
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 = one document).

Professionals will record attributes in a hierarchical manner: Project > n
locations > n times/relev├ęs (for repeated recordings) > n (sightings of)
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 =
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_documents)
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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message