You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Amir Mistric <am...@nemours.org> on 2007/09/21 15:23:39 UTC
XPath - comparing dates
Hello
I am trying to compare 2 date properties to determine if the node has been modified.
Here are the queries I tried to use:
1. /jcr:root/www-mysite-org//element(*,mgnl:content)[MetaData/@mgnl:activated='true' and MetaData/@mgnl:lastmodified > MetaData/@mgnl:lastaction]
2. /jcr:root/www-mysite-org//element(*,mgnl:content)[MetaData/@mgnl:activated='true' and xs:dateTime(MetaData/@mgnl:lastmodified) > xs:dateTime(MetaData/@mgnl:lastaction)]
3. /jcr:root/www-mysite-org//element(*,mgnl:content)[MetaData/@mgnl:activated='true' and MetaData/xs:dateTime(@mgnl:lastmodified) > MetaData/xs:dateTime(@mgnl:lastaction)]
On the query #1 I don't get any results and on the queries #2 and #3 I get:
javax.jcr.query.InvalidQueryException: Wrong argument type for xs:dateTime
Also here is an example of the page called "index" and its metadata
/www-mysite-org/index/MetaData
/www-mysite-org/index/MetaData/mgnl:authorid=bsimpson
/www-mysite-org/index/MetaData/jcr:uuid=c35ed46e-53b3-4b57-be6b-9eaf78733ba5
/www-mysite-org/index/MetaData/mgnl:creationdate=2007-06-01T15:28:00.756-04:00
/www-mysite-org/index/MetaData/mgnl:lastaction=2007-09-13T16:42:34.198-04:00
/www-mysite-org/index/MetaData/jcr:created=2007-08-27T23:16:39.019-04:00
/www-mysite-org/index/MetaData/jcr:baseVersion=bd5305ae-fe82-4a80-bf15-5ed1c7771c1c
/www-mysite-org/index/MetaData/mgnl:lastmodified=2007-09-13T16:39:26.615-04:00
/www-mysite-org/index/MetaData/jcr:isCheckedOut=true
/www-mysite-org/index/MetaData/jcr:primaryType=mgnl:metaData
/www-mysite-org/index/MetaData/mgnl:activatorid=superuser
/www-mysite-org/index/MetaData/jcr:predecessors=bd5305ae-fe82-4a80-bf15-5ed1c7771c1c
/www-mysite-org/index/MetaData/jcr:versionHistory=45977c4f-a6f9-42e8-b8d4-fcf52897d91e
/www-mysite-org/index/MetaData/mgnl:template=www-homepage-3-column
/www-mysite-org/index/MetaData/mgnl:activated=true
Is there something wrong with the queries?
Thanks
Amir
Re: XPath - comparing dates
Posted by Jukka Zitting <ju...@gmail.com>.
Hi,
On 9/22/07, Amir Mistric <am...@nemours.org> wrote:
> From: Julian Reschke [mailto:julian.reschke@gmx.de]
> > Marcel Reutegger wrote:
> > > jackrabbit does not support property names on both sides of a
> > > comparison. one of them must be a literal.
> >
> > So that should result in an InvalidQueryException, right?
>
> And ....it does not :) A Bug? Improvement?
A bug report for not throwing the exeption, and a feature request for
supporting property to property comparisons. Feel free to file both in
Jira. :-)
BR,
Jukka Zitting
RE: XPath - comparing dates
Posted by Amir Mistric <am...@nemours.org>.
> -----Original Message-----
> From: Julian Reschke [mailto:julian.reschke@gmx.de]
> Sent: Friday, September 21, 2007 4:57 PM
> To: users@jackrabbit.apache.org
> Subject: Re: XPath - comparing dates
>
> Marcel Reutegger wrote:
> > Amir Mistric wrote:
> >> I am trying to compare 2 date properties to determine if
> the node has
> >> been modified.
> >> Here are the queries I tried to use:
> >>
> >> 1.
> >>
> /jcr:root/www-mysite-org//element(*,mgnl:content)[MetaData/@mg
> nl:activated='true'
> >> and MetaData/@mgnl:lastmodified > MetaData/@mgnl:lastaction]
> >
> > jackrabbit does not support property names on both sides of a
> > comparison. one of them must be a literal.
> > ...
>
> So that should result in an InvalidQueryException, right?
>
> BR, Julian
>
And ....it does not :) A Bug? Improvement?
Re: XPath - comparing dates
Posted by Julian Reschke <ju...@gmx.de>.
Marcel Reutegger wrote:
> Amir Mistric wrote:
>> I am trying to compare 2 date properties to determine if the node has
>> been modified.
>> Here are the queries I tried to use:
>>
>> 1.
>> /jcr:root/www-mysite-org//element(*,mgnl:content)[MetaData/@mgnl:activated='true'
>> and MetaData/@mgnl:lastmodified > MetaData/@mgnl:lastaction]
>
> jackrabbit does not support property names on both sides of a
> comparison. one of them must be a literal.
> ...
So that should result in an InvalidQueryException, right?
BR, Julian
Re: FileDataStore configuration
Posted by Thomas Mueller <th...@gmail.com>.
Hi,
The data store is not included in Jackrabbit 1.3.x. You need to
download the source trunk source code and build Jackrabbit yourself.
Running the garbage collection is currently a manual process. You can
run this as a separate thread concurrently to your application:
import org.apache.jackrabbit.core.data.GarbageCollector;
...
GarbageCollector gc = new GarbageCollector(null, 0);
gc.scan(session);
gc.stopScan();
gc.deleteUnused();
I have updated the documentation at
http://wiki.apache.org/jackrabbit/DataStore
Thomas
On 9/21/07, Lorenzo Dini <Lo...@cern.ch> wrote:
> Hi,
>
> I would like to integrate my BundlePersistenceManager (MySql) with a
> FileDataStore because I have about 30Gb to be stored in the repository.
>
> I am inserting the tag in the repository.xml file as you describe in the
> WIKI page (http://wiki.apache.org/jackrabbit/DataStore) but the
> FileDataStore is not loaded.
>
> I have also checked in the Jackrabbit core jar file but the class is not
> there and I could not find it in any jars of Jackrabbit 1.3.1.
>
> Can you please give me some hints on how to find the jar and how to
> properly configure Jackrabbit to use it instead of BLOBs??
>
> I would like also to know how launch the GarbageCollector mentioned (in
> the only manual way currently available).
>
> Thank you
>
> Lorenzo
>
>
> --
> *Lorenzo Dini*
>
> CERN - European Organization for Nuclear Research
> Information Technology Department
> CH-1211 Geneva 23
>
> Building 28 - Office 1-007
> Phone: +41 (0) 22 7674384
> Fax: +41 (0) 22 7668847
> E-mail: Lorenzo.Dini@cern.ch
>
FileDataStore configuration
Posted by Lorenzo Dini <Lo...@cern.ch>.
Hi,
I would like to integrate my BundlePersistenceManager (MySql) with a
FileDataStore because I have about 30Gb to be stored in the repository.
I am inserting the tag in the repository.xml file as you describe in the
WIKI page (http://wiki.apache.org/jackrabbit/DataStore) but the
FileDataStore is not loaded.
I have also checked in the Jackrabbit core jar file but the class is not
there and I could not find it in any jars of Jackrabbit 1.3.1.
Can you please give me some hints on how to find the jar and how to
properly configure Jackrabbit to use it instead of BLOBs??
I would like also to know how launch the GarbageCollector mentioned (in
the only manual way currently available).
Thank you
Lorenzo
--
*Lorenzo Dini*
CERN - European Organization for Nuclear Research
Information Technology Department
CH-1211 Geneva 23
Building 28 - Office 1-007
Phone: +41 (0) 22 7674384
Fax: +41 (0) 22 7668847
E-mail: Lorenzo.Dini@cern.ch
RE: XPath - comparing dates
Posted by Amir Mistric <am...@nemours.org>.
Marcel
1. Is there a plan to support comparing properties?
2. Is there an alternative way I could achieve this? It may sound weird but is it possible to subtract the 2 date properties and compare the result.
Something like
(@mgnl:lastmodified - @mgnl:lastaction) > 0
Would something like this work?
Thanks
> -----Original Message-----
> From: Marcel Reutegger [mailto:marcel.reutegger@gmx.net]
> Sent: Friday, September 21, 2007 11:23 AM
> To: users@jackrabbit.apache.org
> Subject: Re: XPath - comparing dates
>
> Amir Mistric wrote:
> > I am trying to compare 2 date properties to determine if
> the node has been modified.
> > Here are the queries I tried to use:
> >
> > 1.
> >
> /jcr:root/www-mysite-org//element(*,mgnl:content)[MetaData/@mgnl:activ
> > ated='true' and MetaData/@mgnl:lastmodified >
> > MetaData/@mgnl:lastaction]
>
> jackrabbit does not support property names on both sides of a
> comparison. one of them must be a literal.
>
> > 2.
> >
> /jcr:root/www-mysite-org//element(*,mgnl:content)[MetaData/@mgnl:activ
> > ated='true' and xs:dateTime(MetaData/@mgnl:lastmodified) >
> > xs:dateTime(MetaData/@mgnl:lastaction)]
> > 3.
> >
> /jcr:root/www-mysite-org//element(*,mgnl:content)[MetaData/@mgnl:activ
> > ated='true' and MetaData/xs:dateTime(@mgnl:lastmodified) >
> > MetaData/xs:dateTime(@mgnl:lastaction)]
>
> the xs:dateTime() function in jackrabbit only takes a string literal.
>
> e.g. this is a valid query:
>
> /jcr:root/www-mysite-org//element(*,mgnl:content)[MetaData/@mg
> nl:activated='true'
> and MetaData/@mgnl:lastmodified >
> xs:dateTime('2007-01-01T00:00:00.000TZ')]
>
> regards
> marcel
>
Re: XPath - comparing dates
Posted by Marcel Reutegger <ma...@gmx.net>.
Amir Mistric wrote:
> I am trying to compare 2 date properties to determine if the node has been modified.
> Here are the queries I tried to use:
>
> 1. /jcr:root/www-mysite-org//element(*,mgnl:content)[MetaData/@mgnl:activated='true' and MetaData/@mgnl:lastmodified > MetaData/@mgnl:lastaction]
jackrabbit does not support property names on both sides of a comparison. one of
them must be a literal.
> 2. /jcr:root/www-mysite-org//element(*,mgnl:content)[MetaData/@mgnl:activated='true' and xs:dateTime(MetaData/@mgnl:lastmodified) > xs:dateTime(MetaData/@mgnl:lastaction)]
> 3. /jcr:root/www-mysite-org//element(*,mgnl:content)[MetaData/@mgnl:activated='true' and MetaData/xs:dateTime(@mgnl:lastmodified) > MetaData/xs:dateTime(@mgnl:lastaction)]
the xs:dateTime() function in jackrabbit only takes a string literal.
e.g. this is a valid query:
/jcr:root/www-mysite-org//element(*,mgnl:content)[MetaData/@mgnl:activated='true'
and MetaData/@mgnl:lastmodified > xs:dateTime('2007-01-01T00:00:00.000TZ')]
regards
marcel