jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jukka Zitting <jukka.zitt...@gmail.com>
Subject Re: SQL2 (via davex)
Date Wed, 10 Aug 2011 09:37:30 GMT

On Wed, Aug 10, 2011 at 11:11 AM, Lukas Kahwe Smith <mls@pooteeweet.org> wrote:
> On 10.08.2011, at 11:02, Jukka Zitting wrote:
>> constraints in SQL2 were designed to replace the rather vague
>> "jcr:path LIKE ..." construct in SQL1.
> But these do not replace all uses cases for wanting to filter on a path.

Together with joins as shown by Mark they should actually be quite a
bit more powerful than the "jcr:path LIKE ..." construct. What kind of
a use case are you looking for that isn't covered by these SQL2

I agree that needing multiple joins for something like this is pretty
verbose, but it should be possible to implement some syntactic sugar
(perhaps along the lines of "jcr:path LIKE ...") to make such queries
more compact.

>> Regarding your specific use case: If you need a simple way to query
>> for all the day nodes, you could use a specific node type or a marker
>> mixin for all those nodes. Then you could simply use a query like
>> SELECT * FROM [my:day].
> yeah, but then i would still have no way to do the sort i need,

For that I'd recommend having a DATE property on the day nodes and
sorting by that:

    ORDER BY date

If you prefer not to duplicate information from the path, you can use
a join to get the parent node names:

    ORDER BY NAME(years), NAME(months), NAME(days)

> nor ensure that only day's within a certain subpath are selected:

That should be easy to do with an ISDESCENDANTNODE constraint:

    SELECT * FROM [my:day] WHERE ISDESCENDANTNODE('/issues/2011')

More generally, it could be that we're chasing the wrong solution
here. Could you describe your use case for needing the list of dates
as opposed to the list of issues stored within the subtree? Typically
when using a date-based content tree like this people are only really
interested in the stuff that's stored at the leaf nodes.


Jukka Zitting

View raw message