You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Cheng Zhang <zh...@yahoo.com> on 2009/01/15 23:57:07 UTC
need feedback to store xml tree structure with jackrabbit
Hello,
I'm playing with Jackrabbit and thinking to store all Amazon product information in an Jackrabbit instance.
There are about millions of products. For each product, first I will create a node for it. For example, I will have a node /B001/114/162/K for product B00114162K which is a Canon camcorder.
For each product, I use Amazon API to get the product information from Amazon, which is in XML format. Below is an example.
<Item>
<ASIN>B00114162K</ASIN>
<CustomerReviews>
<AverageRating>4.5</AverageRating>
<TotalReviews>182</TotalReviews>
<TotalReviewPages>37</TotalReviewPages>
<Review>
<ASIN>B00114162K</ASIN>
<Rating>5</Rating>
<HelpfulVotes>0</HelpfulVotes>
<CustomerId>A1XWEK7KWEQ7OB</CustomerId>
<TotalVotes>0</TotalVotes>
<Date>2009-01-15</Date>
<Summary>please help</Summary>
<Content>i am very interested in buying the hf100 but have a couple of questions that i'm hoping someone can assist me with. first, how easy or difficult is it to share the video via email or post on the net. this is very important to me as my primary purpose for buying the camera is to regularly share video of my kids with family who live far away. </Content>
</Review>
</Review>
.........
</Review>
<CustomerReviews>
</Item>
Under the node I created for the product, I will map the xml structure to jcr node structure. For example, I will have a node at /B00/114/162/K/CustomerReviews to store the reviews. The node type is also called 'CustomerReviews'. This node has a property AverageRating which value is 4.5. This node
has child node Review which contains the review information.
Use cases:
Remove a product
Insert a product
select * from CustomerReivews where AverageRating > 4
select * from Review where ASIN='xxxx' and Rating>3
....
Do you guys see any problem here?
Thanks a lot,
Kevin
Re: need feedback to store xml tree structure with jackrabbit
Posted by Jukka Zitting <ju...@gmail.com>.
Hi,
On Thu, Jan 15, 2009 at 11:57 PM, Cheng Zhang <zh...@yahoo.com> wrote:
> Do you guys see any problem here?
Looks pretty good to me.
You probably won't need the ASIN property on the Review node, as that
can be looked up from the parent.
You may want to look at using for example the summary field and
perhaps the date as the starting point for generating unique names to
the review nodes. This allows you to avoid the same-name-siblings
feature, which is often a bit troublesome to handle in practice.
A good rule of thumb for converting XML models to JCR is to remember
that nodes in JCR are much heavier than elements in XML, so you'll
want to map any "data elements" (ones that contain no internal XML
structure) to JCR properties. It looks like you're already doing this
well.
BR,
Jukka Zitting