jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Reutegger <marcel.reuteg...@gmx.net>
Subject Re: Node search based on children properties
Date Fri, 11 May 2007 12:04:31 GMT
Luca Tagliani wrote:
> I have a logical hierarchy made by "Documents" and "Folders";
> "Folders" can contain some other "Folders" and "Documents";
> the same "Document" can logically be positioned under several "Folders".
> I thought to model the nodes in a hierarchy of path
> E.g.:
> /Folder1
> /Folder1/Folder2
> /Folder1/Document1
> /Folder1/Folder2/Document1
> I have two questions:
> 1. Is this the correct model for the entities involved?

yes that makes sense. the jsr 170 spec contains predefined node types that work 
exactly that way (nt:folder / nt:file (+nt:resource)

> 2. Is it possible to have the same node under two different nodes (using the
> path)?

no, a node only has a single location. but you may use nt:likedFile to create 
references to an existing nt:resource node.

> 3. How can I find a "Folder" basing the search on one of its contained
> "Document" property?

//element(*, nt:folder)[*/jcr:content/@jcr:mimeType = 'text/xml']

finds all folders that contain XML documents, assuming you are using nt:file and 
nt:resource nodes to represent your documents.


View raw message