jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Alexander Klimetschek" <aklim...@day.com>
Subject Re: non-hierarchical content
Date Sun, 14 Dec 2008 16:25:52 GMT
Hi Torsten!

On Thu, Dec 11, 2008 at 3:40 PM, Torsten Curdt <tcurdt@apache.org> wrote:
> A simple example would be tagging. Let's assume you have a whole set
> of documents. Of course you could use a certain node to reflect the
> tags and then search for nodes with that tag. But renaming tags would
> not be easily possible. At least you would have to touch all documents
> nodes. Remove the old tag node and add the new tag node. Not a very
> scalable operation.

The most simple way to get tagging - ignoring the rename use case - is
to simple have a multi-value string property named "tags" in your
nodes. Search (incl. full text search, where you configure the tags
propery to boost the score of a result, see the indexing configuration
[1]) is easy then.

If you need the ability to rename, you should "define" tags in a
separate location, eg. under /tags. Then you would have a my:Tag node
type that includes a title (and maybe a description) using jcr:title
and jcr:description (standard property names for this purpose, will be
included as mix:title mixin in JCR 2.0) for the tags. A tag would then
be identified by the node path /tags/flower (or just "flower" if the
/tags prefix is fixed and known) and now content can be tagged by
having a multivalue tags property that includes those paths (using
reference properties here could be a little performance issue and are
not very readable when exploring the content, see David's model, rule
5). This requires an extra step when displaying content to retrieve
the actual title of a tag, but that is not a big problem, since the
tags, which are effectively nodes then, would be managed by
jackrabbit's internal node cache for free - and if the number of them
is limited (say a few 10000 tags), this should work out fast.

Renaming a tag is simple then, simply change the title property of
your tag. Removing tags and other operations can be either done
through observation or in a lazy-way. With observation, ie. modify all
tags properties in the content when you delete a tag, you have the
problem that there might be a lot of write operations at once. Since
you have that extra step during display of content anyway, you could
also do it the lazy way and don't display tags that are not under
/tags anymore. Removing tags can also be lazy, ie. on the next write
operation on the content node, again using observation.

> 1. Is "mix:versionable" of recursive nature? When this is set on the
> document node will all the descending-or-self nodes be versioned? Or
> is this per node?

There is a separate setting called "OnParentVersion" for node types
that specifies what happens with a node when its parent is versioned.
Have a look at section 8.2.11 "OnParentVersion Attribute" of the JCR
1.0 specification [2].

> 2. Why would you want to use "jcr:data" vs "my:body"? That just a
> convention for e.g. the explorer or webdav servlets? Where could I
> find information about these standard attributes? Are they defined in
> the spec?

With a JCR, you should always try to standardize your property names
and/or nodetypes. This gives you maximum reuse. The generic (simple)
WebDAV servlet is only one integration that works with nt:file and
nt:folder - others are possible. Have a look at rule 6 of David's
model [3].

[1] http://wiki.apache.org/jackrabbit/IndexingConfiguration
[2] http://jcp.org/en/jsr/detail?id=170
[3] http://wiki.apache.org/jackrabbit/DavidsModel

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com

Mime
View raw message