Boolean function true() in query string

View: New views
4 Messages — Rating Filter:   Alert me  

Boolean function true() in query string

by MARTINEZ Antonio :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

And according to the JSR170 document, it should work since the Boolean
function true() should just be a true expression.

Using this query returns all my "pon" objects
  //Inventory//ne/rack/subrack/slot/pon

But using
   //Inventory//ne/rack/subrack/slot/pon[true()]
 
I get error  
   "java.lang.RuntimeException: Query failed: Unsupported location for
true()"


Is there an error in my query string or is it not supported ?

Thanks,
Antonio

Re: Boolean function true() in query string

by Alexander Klimetschek :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

What is the use-case for this query? JCR only supports a subset of
XPath, so it might be correct, that this query is not valid... the
true() predicate does not bring any new information anyway.

Regards,
Alex

On Thu, Jul 10, 2008 at 9:12 PM, MARTINEZ Antonio
<Antonio.Martinez@...> wrote:

> Hello,
>
> And according to the JSR170 document, it should work since the Boolean
> function true() should just be a true expression.
>
> Using this query returns all my "pon" objects
>  //Inventory//ne/rack/subrack/slot/pon
>
> But using
>   //Inventory//ne/rack/subrack/slot/pon[true()]
>
> I get error
>   "java.lang.RuntimeException: Query failed: Unsupported location for
> true()"
>
>
> Is there an error in my query string or is it not supported ?
>
> Thanks,
> Antonio
>



--
Alexander Klimetschek
alexander.klimetschek@...

Re: Boolean function true() in query string

by Michael Dürig-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The use case is the spec. AFAIK the query is valid XPath and JSR 170
explicitly requires support for true() and false(). So I guess this is a
bug.

Note: the following works: //*[@jcr:created = true()].

Michael


Alexander Klimetschek wrote:

> What is the use-case for this query? JCR only supports a subset of
> XPath, so it might be correct, that this query is not valid... the
> true() predicate does not bring any new information anyway.
>
> Regards,
> Alex
>
> On Thu, Jul 10, 2008 at 9:12 PM, MARTINEZ Antonio
> <Antonio.Martinez@...> wrote:
>> Hello,
>>
>> And according to the JSR170 document, it should work since the Boolean
>> function true() should just be a true expression.
>>
>> Using this query returns all my "pon" objects
>>  //Inventory//ne/rack/subrack/slot/pon
>>
>> But using
>>   //Inventory//ne/rack/subrack/slot/pon[true()]
>>
>> I get error
>>   "java.lang.RuntimeException: Query failed: Unsupported location for
>> true()"
>>
>>
>> Is there an error in my query string or is it not supported ?
>>
>> Thanks,
>> Antonio
>>
>
>
>


Re: Boolean function true() in query string

by Marcel Reutegger :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Michael Dürig wrote:
> The use case is the spec. AFAIK the query is valid XPath and JSR 170
> explicitly requires support for true() and false().

from a mere syntactic standpoint that correct, but jackrabbit only supports
true() and false() in specific locations of a statement.

> So I guess this is a bug.

it actually is expected behaviour.

> Note: the following works: //*[@jcr:created = true()].

that's exactly where you can use the true() and false(). to check if a boolean
property is true or false.


regards
  marcel