jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Torsten Curdt" <tcu...@apache.org>
Subject non-hierarchical content
Date Thu, 11 Dec 2008 14:40:03 GMT
Hey folks,

I am after a little bit of 'best practice" here. I wondering how to
handle content that is less hierarchical.

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.

content/
  documents/
    document
      @title = "Introduction to Jackrabbit"
      @data = "..."
      tag = "java"
      tag = "jcr"


Maybe a better approach could be to list the tags nodes in jcr and tag
the documents with the tag node's uuid. So searching would become
looking up the uuid

content/
  documents/
    document
      @title = "Introduction to Jackrabbit"
      @data = "..."
      tag = 1
      tag = 2

tags/
  tag
    @uuid = 1
    @name = "java"
  tag
    @uuid = 2
    @name = "jcr"

So search for content tagged with java would be looking up and then
searching for documents that have the tag with that uuid.

 uuid = /tags/tag[@name = 'java']/@uuid
 documents = /content/documents/document[tag = $uuid]

Versioning adds another interesting aspect to all this.

Let's say you have a document that has several versions. One of the
versions is the "published" version. Newer versions are changed since
then and still in draft status. Releasing the new version is basically
switch the "published" version to the latest revision. I assume one
could use the same technique as above.

content/
  documents/
    document
      @uuid = 1
      content = "..."
        @title = "Intro to Jackrabbit"
        @data = "..."
        @version = 1
      content = "..."
        @title = "Introduction to Jackrabbit"
        @data = "..."
        @version = 2
      @published = 1
      tag = 1
      tag = 2

published = /content/documents/document[@uuid = 1]/@published
publishedContent = /content/documents/document[@uuid =
1]/content[@version = published]

Comments? Suggestions?

Some other questions:

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?

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?

cheers
--
Torsten

Mime
View raw message