jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexander Klimetschek" <aklim...@day.com>
Subject Re: importXML() fails with a ConstraintViolationException
Date Wed, 28 May 2008 08:13:35 GMT
Hi Frederic,

in general using import/export XML (especially for larger XML chunks)
is not the most efficient way to work with JCR. Using the API directly
in combination with an effective content model is the way to go. An
effective content model tries to reduce the number of nodes (XML
imports tend to create lots of nodes with a single property at the
leaf) and has a high properties/nodes ratio: something around 10 is
good (ie. 10 times more properties than nodes). This is especially
true if you use a bundle persistence manager (which you should ;-)),
because it reads/writes bundles that consist of a node and all its
properties (except for larger binary properties that will go into the
DataStore, if configured).

Having flat hierarchies ("repository in width") is not efficient,
since Jackrabbit has a limitation when you have many child nodes (>
1000) under one node - it will be quite slow then. In favor of human
explorability one should avoid that anyway, since it is easier when
the content is structured, eg. by date (/2008/april/*), so that only a
few children are visible at each level.

Hope this helps,
Alex

On Tue, May 27, 2008 at 6:07 PM, Frederic BOY <frederic.v4x@gmail.com> wrote:
> Thanks Jukka, you just saved my life here.
>
> I would like to ask another question, which somehow is linked:
> How can I speed up access to my content repository, seeing how it's
> organized? (cf CND below)
>
> I've read that a repository "in depth" allows better performances (on search
> queries) than a rep in width. Is that true? Are XPATH queries faster than
> SQL for example?  Is there any trick I could give a try?
>
> Again, thanks a million.
>
>
> Fred
>
> -----Message d'origine-----
> De : Jukka Zitting [mailto:jukka.zitting@gmail.com]
> Envoyé : mardi 27 mai 2008 16:59
> À : users@jackrabbit.apache.org
> Objet : Re: importXML() fails with a ConstraintViolationException
>
> Hi,
>
> On Tue, May 27, 2008 at 5:15 PM, Frederic BOY <frederic.v4x@gmail.com>
> wrote:
>> session.exportSystemView("/Video", videoOut, true, false);
>> [...]
>> session.importXML("/Video", videoIn,
>>     ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING);
>> [...]
>> ConstraintViolationException: no matching child node definition found for
>> child node {}Video.
>
> You're trying to import the "Video" subtree under an existing "Video" node.
> Try:
>
>    session.importXML("/", videoIn,
>        ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING);
>
> Also, you might want to consider adding a "/content" top-level node
> under which you'd place your "Video", "Audio", and "Template" subtrees
> (and any other content you may have). This way you could backup your
> entire content in a single operation.
>
> BR,
>
> Jukka Zitting
>
>



-- 
Alexander Klimetschek
alexander.klimetschek@day.com

>> Day JCR Cup 08 | Win a MacBook Pro: http://dev.day.com/ <<

----------------------------< alexander.klimetschek@day.com >----------
Alexander Klimetschek, Day Management AG, Barfuesserplatz 6,
CH - 4001 Basel, T +41 61 226 55 31, M +49 151 15 77 20 56
---------------------------------------< http://www.day.com >-----------------

Xing: http://www.xing.com/go/invite/3268380.32d2d4
LinkedIn: http://www.linkedin.com/in/klimetschek
Blog: http://weblogs.goshaky.com/weblogs/alexkli/

Mime
View raw message