需要Jackrabbit sql 2等效查询xpath查询

时间:2014-01-09 09:22:10

标签: java jackrabbit jcr jcr-sql2

我需要一个针对此xpath查询的jackrabbit sql 2等效查询

xpath = "/jcr:root//institutes/institute[*]/(@title | @overallScore)"

我已经为sql2做了这个 我可以通过使用ISCHILDNODE()约束

获得'/IN/institues/institute'

但我希望以这种方式返回所有学院'/%/institutes/institute'。如果我能通过加入实现这一点,请告诉我完整的声明

Currenlty我正在使用此查询但没有成功

参考:reference link

sql2 = "SELECT institute.title, institute.overallScore FROM [nt:unstructured] AS country "
            + "INNER JOIN [nt:unstructured] AS institutes ON ISCHILDNODE(institutes, country) "
            + "INNER JOIN [nt:unstructured] AS institute ON ISCHILDNODE(institute, institutes) "
            + "WHERE NAME(institutes) = 'institutes' ORDER BY institute.overallScore DESC";

我还发现PATH()之类没有在jackrabbit中实现

1 个答案:

答案 0 :(得分:0)

我自己没有测试过,我不确定它是否有效,但这个查询应该有效:

select b.[jcr:path] as [jcr:path], 
       b.[title] as [title], 
       b.[overallScore] as [overallScore] 
from [nt:base] as a 
inner join [nt:base] as b on ischildnode(b, a) 
where name(a) = 'institutes' 
and name(b) = 'institute'