Hi,

I'd suggest going with option 1 from your original email.  It's the most
natural mapping of application data to JCR nodes.  For getting all answers
or all comments, I'd use a search query (very simple in SQL syntax:  Just do
"select * from my:answer").

Given what I've read about Jackrabbit performance on very large, flat (>5000
nodes as first-level children of a single node) node trees, I'd try to come
up with a way to group the my:questions nodes to avoid getting an overly
large set of children from a single my:qna node.

It also seems to me that using references to keep track of which comments
are associated with a given answer would be simulating the organization of
RDBMS tables.  Better, IMO, to keep it with a simple, easily-understood node
structure.

Hope this helps,

-Brian


On 3/21/07, alartin <[EMAIL PROTECTED]> wrote:


Hi all,
  I am trying to write a QnA (question and answer) demo of jackrabbit and
have a few questions about Object and Content Mapping.
  Given three objects: qeustion, answer, and comment. One question may has
many answers and comments; one answer may have many comments. Answer and
comment can not exist alone.
  In OCM, I have two choice:
1. subnodes:
            1 root -- 1 my:qna -- * my:question
                                                    |__  * my:answer  ___
                                                    |__  *
my:comment    |__
* my:comment
2. same level(use reference):
            1 root -- 1 my:qna -- 1 my:questions
                                                             |__ *
my:question
                                       -- 1 my:answers
                                                             |__ *
my:answer
                                       -- 1 my:comments
                                                               |__ *
my:comment
   I can use the multi-value property to store the references. For
example,
one my:question has a multi-value property named "answers" and each value
is
the uuid of one my:answer node and each my:answer hold the uuid of the
question node.
My question is : what's the difference between the two choice?
If I need do a lot of access or calculating to answers or comments, is it
better to choose the 2th choice? Thus, I do not need to iterate all
questions to find all answers or comments.
The second question is: Is it important to make a single my:questions
node/my:answers node/my:comments node?
If not, there are many different nodes in one level. Is it a big problem
in
the future such as searching performance?
Many thanks!
--
View this message in context:
http://www.nabble.com/Node-mapping-question%3A-when-should-I-use-subnode--tf3439621.html#a9590761
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Reply via email to