OW2 Consortium
Search OW2 Mail Archive: 

Advanced Search - Powered by Google


Mail Archive Home | exoplatform List | October 2006 Index

<--  Date Index  --> <--  Thread Index  -->

[exo-jcr] xpath: @p=1 vs @p='1'


Hello.

I work on XWikiJCRStore project -
http://www.xwiki.org/xwiki/bin/view/Dev/XWikiJCRStore
Currently XWiki works on JackRabbit. Now I try to support eXoJCR
(1.0.1). Configuration is standard, copies from
exosrc/services/jcr/impl/src/java/conf/standalone.

I have a problem:

Why "@p=1" works with integer properties, but "@p='1'" do not works? It
is searching only for string properties? In JackRabbit "@p=1" and
"@p='1'" has no difference.

This is problem for me, because I generate xpath queries and do not know
types of properties. I write "@property='value'" for all properties.
The same problem with criteria-like QueryManager of Graffito
jcr-mappings project - http://incubator.apache.org/graffito/jcr-mapping/
. It is write "@property='value'" for all properties too.

JUnit Test:
-----
Session ses = getSession();
Node rn = ses.getRootNode().addNode("test");
Node tn1 = rn.addNode("tn1");
Node tn2 = rn.addNode("tn2");
tn1.setProperty("prop1", 1);
tn2.setProperty("prop1", 2);
ses.save();             
QueryManager qm = ses.getWorkspace().getQueryManager();
QueryResult qr;

qr = qm.createQuery("//*[@prop1=1]", Query.XPATH).execute();
assertEquals(1, qr.getNodes().getSize());

qr = qm.createQuery("//*[@prop1='1']", Query.XPATH).execute();
assertEquals(1, qr.getNodes().getSize()); // on eXoJCR returns 0!
-----

This test is ok for JackRabbit, but fail for eXoJCR.


-- 
  Artem Melentyev, UralSU, CS401



<--  Date Index  --> <--  Thread Index  -->

Reply via email to:

Powered by MHonArc.

Copyright © 2006-2007, OW2 Consortium | contact | webmaster.