On Jan 24, 2008 2:58 PM, Daniele Dellafiore <[EMAIL PROTECTED]> wrote:
> I have used jackrabbit for some time and now I want to clarify many
> doubt about how to handle some problems and how to architect the
> repository.
>
> Basically I am today wondering about referencing a node from another
> node. mix:referenceable seems to be useful but I do not understand,
> other than assigning the UUID, how can be useful. The UUID can be use
> as "external key" on another node?
mix:referenceable nodes can be set as properties of type Reference on other
nodes.
>
> Let's clarify. I am confused and I accept some advice about some books
> becouse all the few articles on the net do not help me in architecting
> even a simple (but not demo) application.
>
> I begin the discussion here, anyway.
>
> My app stores Pictures. I also have the concept of Author and Artwork.
> Relationship are simple:
> Author has many Artwork
> Artwork has many Pictures.
>
> In a relational, there are external keys. Here I can simply put all
> the pictures in a path like
>
> //picasso/guernica/pic1.jpg
>
> then the node picasso will contain properties like date of birth and
> death and so on, no need to have anything else.
>
> Then I want to introduce some label, or tag, to give a free
> classification to pictures, authors and artwork.
> I can add a property to every node with a String that contains the
> tag, in a comma separated format, for example.
>
> Now, When I have to search all the pictures with a certain tag, I have
> to make a query on that properties. I can also create a new hierarchy,
> like
>
> //tags/pictures/pic1.jpg
>
> now, how can I connect that pic1.jpg, that is the node name, with the
> actual node in the picasso/guernica/ tree?
> I can write in //tags/pictures/pic1.jpg node the UUID of the
> //picasso/guernica/pic1.jpg node? this is external key. Is this a good
> way? I do not think so...
pic1.jpg here would be a very simple node, containing only one property (of
type Reference) whose value would be the UUID of pic1.jpg under the
picasso/guernica/ tree. To use this, you'd do something like:
Node fakePic = root.getNode("//tags/pictures/pic1.jpg");
Node realPic = fakePic.getProperty("imgReference").getNode();
and then realPic would be the node from the /picasso/guernica/ tree.
>
>
> Thanks.
>
> --
> Daniele Dellafiore
> http://blog.ildella.net/
>
Hope this helps,
-Brian