You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by Joy <Kr...@infosys.com> on 2013/02/08 07:26:22 UTC

Help to convert xpath to jcr SQl2

Hi


Can u plz help me to convert 
xpath :
//wiki:encyclopedia/wiki:entry[@wiki:title = 'rose ' 

to JCR SQL


is it like 

select * from [wiki:encyclopedia/wiki:entry] where wiki:title like 'rose' 

i want to get a hold on this

Thanks 
Joy 



--
View this message in context: http://jackrabbit.510166.n4.nabble.com/Help-to-convert-xpath-to-jcr-SQl2-tp4657657.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Re: Help to convert xpath to jcr SQl2

Posted by ms...@email.cz.

-- 
Marek Slama
mslama@email.cz



---------- Původní zpráva ----------
Od: Joy <Kr...@infosys.com>
Datum: 8. 2. 2013
Předmět: Help to convert xpath to jcr SQl2

"Hi


Can u plz help me to convert 
xpath :
//wiki:encyclopedia/wiki:entry[@wiki:title = 'rose ' 

to JCR SQL


is it like 

select * from [wiki:encyclopedia/wiki:entry] where wiki:title like 'rose' 
"
No it is wrong AFAIK in FROM you give type if you do not have any specific 
type give there [nt:base]




For property constraint just use = ie. equals.




Path constraint use ischildnode. Look at http://svn.apache.org/viewvc/
jackrabbit/trunk/jackrabbit-spi-commons/src/test/resources/org/apache/
jackrabbit/spi/commons/query/sql2/test.sql2.txt?view=markup for examples.




My version would be

select * from [nt:base] where ischildnode([/wiki:encyclopedia/wiki:entry]) 
and title='rose'




I recommend to use absolute path ie. starting with / it corresponds to 
original XPath.





Hope it helps




Marek

"
i want to get a hold on this

Thanks 
Joy 



--
View this message in context: http://jackrabbit.510166.n4.nabble.com/Help-to
-convert-xpath-to-jcr-SQl2-tp4657657.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com."