jackrabbit-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1299713 - in /jackrabbit/sandbox/jackrabbit-microkernel/src: main/java/org/apache/jackrabbit/query/qom/ main/java/org/apache/jackrabbit/query/qom/tree/ main/java/org/apache/jackrabbit/query/reader/ test/resources/
Date Mon, 12 Mar 2012 15:34:01 GMT
Author: thomasm
Date: Mon Mar 12 15:34:00 2012
New Revision: 1299713

URL: http://svn.apache.org/viewvc?rev=1299713&view=rev
Log:
Query implementation (WIP)

Modified:
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/QueryObjectModelImpl.java
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ChildNodeImpl.java
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ChildNodeJoinConditionImpl.java
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ColumnImpl.java
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/DescendantNodeImpl.java
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/EquiJoinConditionImpl.java
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/NodeLocalNameImpl.java
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/NodeNameImpl.java
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/PropertyExistenceImpl.java
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/PropertyValueImpl.java
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SameNodeImpl.java
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SameNodeJoinConditionImpl.java
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SelectorImpl.java
    jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/reader/TraversingCursor.java
    jackrabbit/sandbox/jackrabbit-microkernel/src/test/resources/queryTest.txt

Modified: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/QueryObjectModelImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/QueryObjectModelImpl.java?rev=1299713&r1=1299712&r2=1299713&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/QueryObjectModelImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/QueryObjectModelImpl.java
Mon Mar 12 15:34:00 2012
@@ -96,6 +96,7 @@ public class QueryObjectModelImpl implem
             @Override
             public boolean visit(ChildNodeImpl node) {
                 node.setQuery(query);
+                node.bindSelector(source);
                 return true;
             }
 
@@ -148,12 +149,14 @@ public class QueryObjectModelImpl implem
             @Override
             public boolean visit(NodeLocalNameImpl node) {
                 node.setQuery(query);
+                node.bindSelector(source);
                 return true;
             }
 
             @Override
             public boolean visit(NodeNameImpl node) {
                 node.setQuery(query);
+                node.bindSelector(source);
                 return true;
             }
 

Modified: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ChildNodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ChildNodeImpl.java?rev=1299713&r1=1299712&r2=1299713&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ChildNodeImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ChildNodeImpl.java
Mon Mar 12 15:34:00 2012
@@ -19,6 +19,7 @@
 package org.apache.jackrabbit.query.qom.tree;
 
 import javax.jcr.query.qom.ChildNode;
+import org.apache.jackrabbit.mk.util.PathUtils;
 
 
 /**
@@ -28,6 +29,7 @@ public class ChildNodeImpl extends Const
 
     private final String selectorName;
     private final String parentPath;
+    private SelectorImpl selector;
 
     public ChildNodeImpl(String selectorName, String parentPath) {
         this.selectorName = selectorName;
@@ -51,10 +53,19 @@ public class ChildNodeImpl extends Const
         return "ISCHILDNODE(" + selectorName + ", " + quotePath(parentPath) + ')';
     }
 
+    public void bindSelector(SourceImpl source) {
+        selector = source.getSelector(selectorName);
+        if (selector == null) {
+            throw new RuntimeException("Unknown selector: " + selectorName);
+        }
+    }
+
     @Override
     public boolean evaluate() {
-        // TODO Auto-generated method stub
-        return false;
+        String p = selector.currentPath();
+        // the parent of the root is the root,
+        // so we need to special case this
+        return !PathUtils.denotesRoot(p) && PathUtils.getParentPath(p).equals(parentPath);
     }
 
 }
\ No newline at end of file

Modified: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ChildNodeJoinConditionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ChildNodeJoinConditionImpl.java?rev=1299713&r1=1299712&r2=1299713&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ChildNodeJoinConditionImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ChildNodeJoinConditionImpl.java
Mon Mar 12 15:34:00 2012
@@ -19,6 +19,7 @@
 package org.apache.jackrabbit.query.qom.tree;
 
 import javax.jcr.query.qom.ChildNodeJoinCondition;
+import org.apache.jackrabbit.mk.util.PathUtils;
 
 /**
  * The implementation of the corresponding JCR interface.
@@ -67,7 +68,11 @@ public class ChildNodeJoinConditionImpl 
 
     @Override
     public boolean evaluate() {
-        return parentSelector.currentPath().equals(childSelector.currentPath());
+        String p = parentSelector.currentPath();
+        String c = childSelector.currentPath();
+        // the parent of the root is the root,
+        // so we need to special case this
+        return !PathUtils.denotesRoot(c) && PathUtils.getParentPath(c).equals(p);
     }
 
 }
\ No newline at end of file

Modified: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ColumnImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ColumnImpl.java?rev=1299713&r1=1299712&r2=1299713&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ColumnImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/ColumnImpl.java
Mon Mar 12 15:34:00 2012
@@ -67,8 +67,7 @@ public class ColumnImpl extends QOMNode 
             String p = selector.currentPath();
             return p == null ? null : query.getValueFactory().createValue(p);
         }
-        String v = selector.currentNode().getProperty(propertyName);
-        return v == null ? null : query.getValueFactory().createValue(v);
+        return selector.currentProperty(propertyName);
     }
 
     public void bindSelector(SourceImpl source) {

Modified: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/DescendantNodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/DescendantNodeImpl.java?rev=1299713&r1=1299712&r2=1299713&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/DescendantNodeImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/DescendantNodeImpl.java
Mon Mar 12 15:34:00 2012
@@ -45,7 +45,8 @@ public class DescendantNodeImpl extends 
 
     @Override
     public boolean evaluate() {
-        return PathUtils.isAncestor(ancestorPath, selector.currentNode().getPath());
+        String p = selector.currentPath();
+        return PathUtils.isAncestor(ancestorPath, p);
     }
 
     @Override

Modified: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/EquiJoinConditionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/EquiJoinConditionImpl.java?rev=1299713&r1=1299712&r2=1299713&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/EquiJoinConditionImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/EquiJoinConditionImpl.java
Mon Mar 12 15:34:00 2012
@@ -18,8 +18,8 @@
  */
 package org.apache.jackrabbit.query.qom.tree;
 
+import javax.jcr.Value;
 import javax.jcr.query.qom.EquiJoinCondition;
-import org.apache.jackrabbit.mk.simple.NodeImpl;
 
 /**
  * The implementation of the corresponding JCR interface.
@@ -81,14 +81,12 @@ public class EquiJoinConditionImpl exten
 
     @Override
     public boolean evaluate() {
-        NodeImpl n1 = selector1.currentNode();
-        String v1 = n1.getProperty(property1Name);
+        Value v1 = selector1.currentProperty(property1Name);
         if (v1 == null) {
             return false;
         }
         // TODO data type mapping
-        NodeImpl n2 = selector2.currentNode();
-        String v2 = n2.getProperty(property2Name);
+        Value v2 = selector2.currentProperty(property2Name);
         if (v2 == null) {
             return false;
         }

Modified: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/NodeLocalNameImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/NodeLocalNameImpl.java?rev=1299713&r1=1299712&r2=1299713&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/NodeLocalNameImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/NodeLocalNameImpl.java
Mon Mar 12 15:34:00 2012
@@ -20,6 +20,7 @@ package org.apache.jackrabbit.query.qom.
 
 import javax.jcr.Value;
 import javax.jcr.query.qom.NodeLocalName;
+import org.apache.jackrabbit.mk.util.PathUtils;
 
 /**
  * The implementation of the corresponding JCR interface.
@@ -27,6 +28,7 @@ import javax.jcr.query.qom.NodeLocalName
 public class NodeLocalNameImpl extends DynamicOperandImpl implements NodeLocalName {
 
     private final String selectorName;
+    private SelectorImpl selector;
 
     public NodeLocalNameImpl(String selectorName) {
         this.selectorName = selectorName;
@@ -45,10 +47,20 @@ public class NodeLocalNameImpl extends D
         return "LOCALNAME(" + getSelectorName() + ')';
     }
 
+    public void bindSelector(SourceImpl source) {
+        selector = source.getSelector(selectorName);
+        if (selector == null) {
+            throw new RuntimeException("Unknown selector: " + selectorName);
+        }
+    }
+
     @Override
-    public Value currentValue() {
-        // TODO Auto-generated method stub
-        return null;
+    public  Value currentValue() {
+        String name = PathUtils.getName(selector.currentPath());
+        int colon = name.indexOf(':');
+        // TODO LOCALNAME: evaluation of local name might not be correct
+        String localName = colon < 0 ? name : name.substring(colon + 1);
+        return query.getValueFactory().createValue(localName);
     }
 
 }

Modified: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/NodeNameImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/NodeNameImpl.java?rev=1299713&r1=1299712&r2=1299713&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/NodeNameImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/NodeNameImpl.java
Mon Mar 12 15:34:00 2012
@@ -20,6 +20,7 @@ package org.apache.jackrabbit.query.qom.
 
 import javax.jcr.Value;
 import javax.jcr.query.qom.NodeName;
+import org.apache.jackrabbit.mk.util.PathUtils;
 
 /**
  * The implementation of the corresponding JCR interface.
@@ -27,6 +28,7 @@ import javax.jcr.query.qom.NodeName;
 public class NodeNameImpl extends DynamicOperandImpl implements NodeName {
 
     private final String selectorName;
+    private SelectorImpl selector;
 
     public NodeNameImpl(String selectorName) {
         this.selectorName = selectorName;
@@ -45,10 +47,17 @@ public class NodeNameImpl extends Dynami
         return "NAME(" + getSelectorName() + ')';
     }
 
+    public void bindSelector(SourceImpl source) {
+        selector = source.getSelector(selectorName);
+        if (selector == null) {
+            throw new RuntimeException("Unknown selector: " + selectorName);
+        }
+    }
+
     @Override
     public  Value currentValue() {
-        // TODO Auto-generated method stub
-        return null;
+        String name = PathUtils.getName(selector.currentPath());
+        return query.getValueFactory().createValue(name);
     }
 
 }

Modified: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/PropertyExistenceImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/PropertyExistenceImpl.java?rev=1299713&r1=1299712&r2=1299713&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/PropertyExistenceImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/PropertyExistenceImpl.java
Mon Mar 12 15:34:00 2012
@@ -18,8 +18,8 @@
  */
 package org.apache.jackrabbit.query.qom.tree;
 
+import javax.jcr.Value;
 import javax.jcr.query.qom.PropertyExistence;
-import org.apache.jackrabbit.mk.simple.NodeImpl;
 
 /**
  * The implementation of the corresponding JCR interface.
@@ -45,8 +45,8 @@ public class PropertyExistenceImpl exten
 
     @Override
     public boolean evaluate() {
-        NodeImpl n = selector.currentNode();
-        return n == null ? false : n.hasProperty(propertyName);
+        Value v = selector.currentProperty(propertyName);
+        return v != null;
     }
 
     @Override

Modified: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/PropertyValueImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/PropertyValueImpl.java?rev=1299713&r1=1299712&r2=1299713&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/PropertyValueImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/PropertyValueImpl.java
Mon Mar 12 15:34:00 2012
@@ -20,8 +20,6 @@ package org.apache.jackrabbit.query.qom.
 
 import javax.jcr.Value;
 import javax.jcr.query.qom.PropertyValue;
-import org.apache.jackrabbit.mk.json.JsopTokenizer;
-import org.apache.jackrabbit.mk.simple.NodeImpl;
 
 /**
  * The implementation of the corresponding JCR interface.
@@ -57,14 +55,7 @@ public class PropertyValueImpl extends D
 
     @Override
     public Value currentValue() {
-        NodeImpl n = selector.currentNode();
-        String value = n.getProperty(propertyName);
-        if (value == null) {
-            return null;
-        }
-        // TODO data type mapping
-        value = JsopTokenizer.decodeQuoted(value);
-        return query.getValueFactory().createValue(value);
+        return selector.currentProperty(propertyName);
     }
 
     public void bindSelector(SourceImpl source) {

Modified: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SameNodeImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SameNodeImpl.java?rev=1299713&r1=1299712&r2=1299713&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SameNodeImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SameNodeImpl.java
Mon Mar 12 15:34:00 2012
@@ -44,7 +44,7 @@ public class SameNodeImpl extends Constr
 
     @Override
     public boolean evaluate() {
-        return selector.currentNode().getPath().equals(path);
+        return selector.currentPath().equals(path);
     }
 
     @Override

Modified: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SameNodeJoinConditionImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SameNodeJoinConditionImpl.java?rev=1299713&r1=1299712&r2=1299713&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SameNodeJoinConditionImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SameNodeJoinConditionImpl.java
Mon Mar 12 15:34:00 2012
@@ -82,8 +82,9 @@ public class SameNodeJoinConditionImpl e
 
     @Override
     public boolean evaluate() {
-        // TODO Auto-generated method stub
-        return false;
+        String p1 = selector1.currentPath();
+        String p2 = selector2.currentPath();
+        return p1.equals(p2);
     }
 
 }

Modified: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SelectorImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SelectorImpl.java?rev=1299713&r1=1299712&r2=1299713&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SelectorImpl.java
(original)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/qom/tree/SelectorImpl.java
Mon Mar 12 15:34:00 2012
@@ -18,8 +18,10 @@
  */
 package org.apache.jackrabbit.query.qom.tree;
 
+import javax.jcr.Value;
 import javax.jcr.query.qom.Selector;
 import org.apache.jackrabbit.mk.api.MicroKernel;
+import org.apache.jackrabbit.mk.json.JsopTokenizer;
 import org.apache.jackrabbit.mk.simple.NodeImpl;
 import org.apache.jackrabbit.query.qom.QueryObjectModelImpl;
 import org.apache.jackrabbit.query.reader.Cursor;
@@ -32,6 +34,8 @@ import org.apache.jackrabbit.query.reade
  */
 public class SelectorImpl extends SourceImpl implements Selector {
 
+    private static final String JCR_PATH = "jcr:path";
+
     private final String nodeTypeName, selectorName;
     protected NodeReader reader;
     private Cursor cursor;
@@ -89,6 +93,24 @@ public class SelectorImpl extends Source
         return cursor.currentNode();
     }
 
+    public Value currentProperty(String propertyName) {
+        if (propertyName.equals(JCR_PATH)) {
+            String p = currentPath();
+            return p == null ? null : query.getValueFactory().createValue(p);
+        }
+        NodeImpl n = currentNode();
+        if (n == null) {
+            return null;
+        }
+        String value = n.getProperty(propertyName);
+        if (value == null) {
+            return null;
+        }
+        // TODO data type mapping
+        value = JsopTokenizer.decodeQuoted(value);
+        return query.getValueFactory().createValue(value);
+    }
+
     @Override
     public void init(QueryObjectModelImpl qom) {
         // TODO Auto-generated method stub

Modified: jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/reader/TraversingCursor.java
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/reader/TraversingCursor.java?rev=1299713&r1=1299712&r2=1299713&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/reader/TraversingCursor.java
(original)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/main/java/org/apache/jackrabbit/query/reader/TraversingCursor.java
Mon Mar 12 15:34:00 2012
@@ -57,6 +57,7 @@ public class TraversingCursor implements
                 return null;
             }
             currentNode = NodeImpl.parse(mk.getNodes(currentPath, revisionId));
+            currentNode.setPath(currentPath);
         }
         return currentNode;
     }

Modified: jackrabbit/sandbox/jackrabbit-microkernel/src/test/resources/queryTest.txt
URL: http://svn.apache.org/viewvc/jackrabbit/sandbox/jackrabbit-microkernel/src/test/resources/queryTest.txt?rev=1299713&r1=1299712&r2=1299713&view=diff
==============================================================================
--- jackrabbit/sandbox/jackrabbit-microkernel/src/test/resources/queryTest.txt (original)
+++ jackrabbit/sandbox/jackrabbit-microkernel/src/test/resources/queryTest.txt Mon Mar 12
15:34:00 2012
@@ -6,18 +6,58 @@
 # * new tests are typically be added on top, after the syntax docs
 # * use ascii character only
 
++ "test": { "jcr:resource": {}, "resource": { "x" : {}}}
+
+select * from [nt:base] as b where ischildnode(b, '/test')
+/test/jcr:resource
+/test/resource
+
+select * from [nt:base] as b where issamenode(b, '/test')
+/test
+
+select * from [nt:base] where name() = 'resource'
+/test/resource
+
+select * from [nt:base] as b where localname(b) = 'resource'
+/test/jcr:resource
+/test/resource
+
+select * from [nt:base] as x where isdescendantnode(x, '/')
+/
+/test
+/test/jcr:resource
+/test/resource
+/test/resource/x
+
+- "test"
+
 + "parents": { "p0": {"id": "0"}, "p1": {"id": "1"}, "p2": {"id": "2"}}
 + "children": { "c1": {"p": "1"}, "c2": {"p": "1"}, "c3": {"p": "2"}, "c4": {"p": "3"}}
 
+select * from [nt:base] as p where p.[jcr:path] = '/parents'
+/parents
+
+select * from [nt:base] as p inner join [nt:base] as p2 on ischildnode(p2, p) where p.[jcr:path]
= '/'
+/, /parents
+/, /children
+
+select * from [nt:base] as p inner join [nt:base] as p2 on isdescendantnode(p2, p) where
p.[jcr:path] = '/parents'
+/parents, /parents/p0
+/parents, /parents/p1
+/parents, /parents/p2
+
+select * from [nt:base] as p inner join [nt:base] as p2 on issamenode(p2, p) where p.[jcr:path]
= '/parents'
+/parents, /parents
+
 select id from [nt:base] where id is not null
-"0"
-"1"
-"2"
+0
+1
+2
 
 select id from [nt:base] where id is not null order by id desc
-"2"
-"1"
-"0"
+2
+1
+0
 
 select * from [nt:base] as c right outer join [nt:base] as p on p.id = c.p where p.id is
not null
 null, /parents/p0
@@ -89,11 +129,11 @@ select * from [nt:base] where x is null
 + "test5": { "name": "10 percent" }
 
 select name from [nt:base] order by upper(name)
-"10 percent"
-"10%"
-"Hallo"
-"hello"
-"World!"
+10 percent
+10%
+Hallo
+hello
+World!
 null
 
 select * from [nt:base] where length(name) = 5



Mime
View raw message