You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by François Cassistat <f...@maya-systems.com> on 2010/05/21 01:11:17 UTC

JQOM question

I'm learning JQOM. Just one question, in XPath, I used to do queries like :

//*[... and path/to/subnode/@value='somevalue' and ...]

in JQOM, I can't use this :
qom.comparison
(
	qom.propertyValue("mainselector", "path/to/subnode/@value"),
	qom.JCR_OPERATOR_EQUAL_TO,
	qom.literal(value.createValue("somevalue"))
)

it gives :
Exception in thread "main" javax.jcr.query.InvalidQueryException: '/' not allowed in name

Is it possible to do something like this? or should I need to do a join ?


Frank


Re: JQOM question

Posted by Ard Schrijvers <a....@onehippo.com>.
2010/5/26 François Cassistat <f...@maya-systems.com>:
> Thanks Alex,
>
> but that's what I fear, it makes JQOM queries more complex.
>
> Also, I don't know if by chance you would know if a JQOM join is a fast as a path operation on a subnode like on the XPath example above.
>
>>> //*[... and path/to/subnode/@value='somevalue' and ...]

They both are being translated to a ,most likely the same, lucene
query, so there should be no difference in execution time

Ard

>
>
>
> Frank
>
>
>
> Le 2010-05-26 à 9:50 AM, Alexander Klimetschek a écrit :
>
>> 2010/5/21 François Cassistat <f...@maya-systems.com>:
>>> I'm learning JQOM. Just one question, in XPath, I used to do queries like :
>>>
>>> //*[... and path/to/subnode/@value='somevalue' and ...]
>>>
>>> in JQOM, I can't use this :
>>> qom.comparison
>>> (
>>>        qom.propertyValue("mainselector", "path/to/subnode/@value"),
>>>        qom.JCR_OPERATOR_EQUAL_TO,
>>>        qom.literal(value.createValue("somevalue"))
>>> )
>>>
>>> it gives :
>>> Exception in thread "main" javax.jcr.query.InvalidQueryException: '/' not allowed in name
>>>
>>> Is it possible to do something like this? or should I need to do a join ?
>>
>> Not sure, but I think you need a join in this case, using sth like
>> ISDESCENDANTNODE().
>>
>> Regards,
>> Alex
>>
>> --
>> Alexander Klimetschek
>> alexander.klimetschek@day.com
>
>

Re: JQOM question

Posted by François Cassistat <f...@maya-systems.com>.
Thanks Alex,

but that's what I fear, it makes JQOM queries more complex.

Also, I don't know if by chance you would know if a JQOM join is a fast as a path operation on a subnode like on the XPath example above.

>> //*[... and path/to/subnode/@value='somevalue' and ...]



Frank



Le 2010-05-26 à 9:50 AM, Alexander Klimetschek a écrit :

> 2010/5/21 François Cassistat <f...@maya-systems.com>:
>> I'm learning JQOM. Just one question, in XPath, I used to do queries like :
>> 
>> //*[... and path/to/subnode/@value='somevalue' and ...]
>> 
>> in JQOM, I can't use this :
>> qom.comparison
>> (
>>        qom.propertyValue("mainselector", "path/to/subnode/@value"),
>>        qom.JCR_OPERATOR_EQUAL_TO,
>>        qom.literal(value.createValue("somevalue"))
>> )
>> 
>> it gives :
>> Exception in thread "main" javax.jcr.query.InvalidQueryException: '/' not allowed in name
>> 
>> Is it possible to do something like this? or should I need to do a join ?
> 
> Not sure, but I think you need a join in this case, using sth like
> ISDESCENDANTNODE().
> 
> Regards,
> Alex
> 
> -- 
> Alexander Klimetschek
> alexander.klimetschek@day.com


Re: JQOM question

Posted by Alexander Klimetschek <ak...@day.com>.
2010/5/21 François Cassistat <f...@maya-systems.com>:
> I'm learning JQOM. Just one question, in XPath, I used to do queries like :
>
> //*[... and path/to/subnode/@value='somevalue' and ...]
>
> in JQOM, I can't use this :
> qom.comparison
> (
>        qom.propertyValue("mainselector", "path/to/subnode/@value"),
>        qom.JCR_OPERATOR_EQUAL_TO,
>        qom.literal(value.createValue("somevalue"))
> )
>
> it gives :
> Exception in thread "main" javax.jcr.query.InvalidQueryException: '/' not allowed in name
>
> Is it possible to do something like this? or should I need to do a join ?

Not sure, but I think you need a join in this case, using sth like
ISDESCENDANTNODE().

Regards,
Alex

-- 
Alexander Klimetschek
alexander.klimetschek@day.com