[daisy] Dereference operator for query language
Bruno Dumon
bruno at outerthought.org
Fri Jan 26 10:11:14 CST 2007
Hi,
I've been working on a new construct for the query language called the
"dereference operator". It allows queries to traverse link fields in
order to test on the values in the linked-to documents.
For example:
select $LinkField=>name where $LinkField=>name like 'foo%'
The "=>" is used as notation for the link dereference operator (it is
not "->" because dash is a valid character in identifiers in Daisy).
So this query will return all documents that have a link field
"$LinkField" which points to documents of which the name start with
"foo". Doing a query like this was previously impossible.
The link dereferencing can work as many levels of links deep as you
like, so it's possible to do things like:
... where $LinkField=>$OtherLinkField=>$YetAnotherLinkField like 'foo%'
It can basically be used everywhere where you can put a "value
expression", thus also in the order by clause, as argument to functions,
etc. It also works in the stand-alone expressions as used in the ACL or
the publisher.
Access control is also taken care of: if you try to dereference a link
in the where clause, but you have no access to the document in the link,
then the corresponding row will be removed from the result set (this is
a special filtering performed by Daisy after executing the query on the
SQL engine). In the select or order-by parts, a non-traversable link
will simply give a "null" value.
I've developed this functionality on a separate branch (BRANCH_DEREF),
which I'll merge into trunk soon.
Thoughts, remarks, questions welcome.
--
Bruno Dumon http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno at outerthought.org bruno at apache.org
More information about the daisy
mailing list