jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marian Schedenig (qs)" <Marian.Schede...@qualysoft.com>
Subject Looking up reference properties in reverse (over DAV)
Date Mon, 04 May 2009 14:14:27 GMT

Hi!

I've been re-implementing the dependency system I've been asking about
earlier. The concept is this:

On every file node, I have an (optional) property
"myapp:internal-dependency-set". This property holds paths (relative or
absolute) to other files on which the file containing the property "depends"
(e.g. an XSL file may depend on files referenced by include statements).
Files and properties are accessed through WebDAV. Now I want to determine
which files *depend on* a certain file, i.e. the reversed dependencies. The
recommendation was to use DASL to determine these files. I.e. I have to send
a query for all files whose internal-dependency-set contains the path of the
file I'm querying "on".

This gives me two problems:

1) How to deal with multi-value properties. Since DAV properties are
different from JCR properties, I haven't found a standard way to set
multi-value properties over DAV. For now, I'm actually using
internal-dependency-set as a single string property, with multiple values
separated by newlines. As a first proof of concept hack, I can successfully
resolve these dependencies with a query like this:

//element(*,
myapp:File)[jcr:like(jcr:content/@myapp:internal-dependency-set,
'%MY_PATH%')]

This returns all file nodes whose dependency set *contains* MY_PATH, i.e.
the path of the node I'm querying on. Obviously, the substring query is
dangerously unstable. But how could I set and query a multi-value property?
(Otherwise, I could make sure that every dependency path is surrounded by
newlines by putting newline characters at the beginning and end of the
property string... but that would still look a bit too much like a hack for
my taste)

2) The bigger problem: Relative dependencies. Typically, files will mostly
depend on other files in the same, or a related, directory. These are
referenced by relative paths, so that moving the directory does not destroy
the dependencies. This makes resolving the reverse dependencies much more
difficult, of course. An XPath query like this should theoretically do what
I need, I believe:

//element(*,
myapp:File)[jcr:like(jcr:deref(jcr:content/@myapp:internal-dependency-set,
'*'), 'MY_PATH')]

However, this will not work with properties split by newlines as described
above, and it also fails because jcr:deref is now allowed in predicates. I
haven't been able to come up with a query that does not require a jcr:deref
in a predicated though.


If what I need cannot be done with a regular query, I suppose I have two
other options:

1) add a custom query language to my SearchResource
2) create a custom DAV report

Both would simplify the client request, but I'd still have to solve the
query on the server side. So I'm not certain looking deeper into either
option would really get me any further.

Any thoughts appreciated.

Cheers,
Marian.

-- 
View this message in context: http://www.nabble.com/Looking-up-reference-properties-in-reverse-%28over-DAV%29-tp23368671p23368671.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message