You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Sa...@innovations.de on 2010/10/11 13:52:25 UTC

Support of < and <= operators in XPath queries

Hi all,

 

I have the following XPath query:

 

//element(*, nt:base) [@myapp:date > '2010-10-11T13:43:14.230+02:00']

 

If the condition of the query returns true then this query: 

 

//element(*, nt:base) ['2010-10-11T13:43:14.230+02:00' < @myapp:date]

 

will return false although it should not. I have only switched the order
of attribute and value including the operator. Both queries should
return the same result but they don`t. That is strange! Does Jackrabbit
not support the '<' and '<=' operators?

 

It is not a big problem since I can restructure all my queries to use
the > and >= operators. But it seems like a bug, doesn`t it?

 

Regards,

 

Sascha Theves

 


Re: Support of < and <= operators in XPath queries

Posted by Ard Schrijvers <a....@onehippo.com>.
Julian is correct about the second query: it is incorrect. That is
doesn't return you errors surprises me. I just tested the following:

 'A' < @demosite:title and
 @demosite:title < 'A'

both return the same hits! Thus currently ( 'A' < @demosite:title  )
is not equal to (@demosite:title > 'A') !!

For safety, I'd stick to first stating the property, then the value.

Last, I assume @myapp:date contains Calendar instances? In that case
you should use as value in xpath:


"xs:dateTime('"+ValueFactoryImpl.getInstance().createValue(value).getString()
+ "')"

where value is the Calendar instance

Regards Ard

On Tue, Oct 12, 2010 at 8:31 AM,  <Sa...@innovations.de> wrote:
>
> Hi,
>
> the query is not invalid, it works. I have tested it and it is the only way to get it working.
>
> Cheers
>
> Sascha
>
> -----Ursprüngliche Nachricht-----
> Von: Julian Reschke [mailto:julian.reschke@gmx.de]
> Gesendet: Mo 11.10.2010 18:50
> An: users@jackrabbit.apache.org
> Cc: Theves Sascha
> Betreff: Re: Support of < and <= operators in XPath queries
>
> On 11.10.2010 13:52, Sascha.Theves@innovations.de wrote:
>> Hi all,
>>
>>
>>
>> I have the following XPath query:
>>
>>
>>
>> //element(*, nt:base) [@myapp:date>  '2010-10-11T13:43:14.230+02:00']
>>
>>
>>
>> If the condition of the query returns true then this query:
>>
>>
>>
>> //element(*, nt:base) ['2010-10-11T13:43:14.230+02:00'<  @myapp:date]
>> ...
>
> As far as I recall, the second one should be an invalid query, as you
> have the property on the wrong side of the comparison.
>
> Best regards, Julian
>
>



-- 
Hippo
Europe  •  Amsterdam  Oosteinde 11  •  1017 WT Amsterdam  •  +31 (0)20 522 4466
USA  • San Francisco  185 H Street Suite B  •  Petaluma CA 94952-5100
•  +1 (707) 773 4646
Canada    •   Montréal  5369 Boulevard St-Laurent  •  Montréal QC H2T
1S5  •  +1 (514) 316 8966
www.onehippo.com  •  www.onehippo.org  •  info@onehippo.com

AW: Support of < and <= operators in XPath queries

Posted by Sa...@innovations.de.
Hi,

the query is not invalid, it works. I have tested it and it is the only way to get it working.

Cheers

Sascha

-----Ursprüngliche Nachricht-----
Von: Julian Reschke [mailto:julian.reschke@gmx.de]
Gesendet: Mo 11.10.2010 18:50
An: users@jackrabbit.apache.org
Cc: Theves Sascha
Betreff: Re: Support of < and <= operators in XPath queries
 
On 11.10.2010 13:52, Sascha.Theves@innovations.de wrote:
> Hi all,
>
>
>
> I have the following XPath query:
>
>
>
> //element(*, nt:base) [@myapp:date>  '2010-10-11T13:43:14.230+02:00']
>
>
>
> If the condition of the query returns true then this query:
>
>
>
> //element(*, nt:base) ['2010-10-11T13:43:14.230+02:00'<  @myapp:date]
> ...

As far as I recall, the second one should be an invalid query, as you 
have the property on the wrong side of the comparison.

Best regards, Julian


Re: Support of < and <= operators in XPath queries

Posted by Julian Reschke <ju...@gmx.de>.
On 11.10.2010 13:52, Sascha.Theves@innovations.de wrote:
> Hi all,
>
>
>
> I have the following XPath query:
>
>
>
> //element(*, nt:base) [@myapp:date>  '2010-10-11T13:43:14.230+02:00']
>
>
>
> If the condition of the query returns true then this query:
>
>
>
> //element(*, nt:base) ['2010-10-11T13:43:14.230+02:00'<  @myapp:date]
> ...

As far as I recall, the second one should be an invalid query, as you 
have the property on the wrong side of the comparison.

Best regards, Julian