jackrabbit-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smieci24 <smiec...@gmail.com>
Subject Re: XPath exists/not exists question
Date Thu, 16 Oct 2008 17:39:16 GMT

Hi

I have problem with such queries using child node properties in new OCM
module.
I have tried build query using Filter but it only works with current object
property (not childs).

Example:

+ nodeA
  - prop1 = 'value'
  + child
     - subprop1 = 'something'

Code to build query:
Filter filter = queryManager.createFilter(NodeA.class);
filter.addEqualTo("prope1/subprop1", "plain/text");
Query query = queryManager.createQuery(filter)
Collection result = objectContentManager().getObjects(query);

Result is always 0. I log also generated jcr expression:
"//element(*, nt:unstructured) [(@null = 'plain/text') and  (
@ocm:classname='com.test.NodeA')]"

@null - it means that property was not found. And it is true because in log
we can see:
"Impossible to find the jcrFieldName for the attribute :prope1/subprop1"

It is a bug or I missed something ?

Best regards
Marcin Muras


Frederic Laugier wrote:
> 
> Hello,
> 
> I have a question regarding the Exists / Not exists XPath operators.
> 
> 
> My test data contains three nodes :
> 
> + nodeA
>   - prop1 = 'value'
>   + child
>      - subprop1 = 'something'
> 
> + nodeB
>   - prop1 = 'value'
>   + child
> 
> + nodeC
>   - prop1 = 'value'
> 
> 
> 
> The query //*[child/@subprop1)] returns nodeA
> 
> The query //*[child/not(@subprop1)] returns nodeB
> 
> The query //*[not(child/@subprop1)] returns nodeB
> 
> I may be mistaken but I thought the third query would return nodeC as well
> 
> Can anybody tell me if I'm wrong, or if there is any other way to test
> the non existence of a property in a child node regardless if the child
> node exists or not ?
> 
> I'm using Jackrabbit 1.5 (r633030).
> 
> Best regards,
> Frederic Laugier.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/XPath-exists-not-exists-question-tp15802262p20015955.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.


Mime
View raw message