jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1143418 - in /incubator/jena/Jena2/ARQ/trunk: ./ src-dev/dev/ src-test/com/hp/hpl/jena/sparql/algebra/optimize/ src/com/hp/hpl/jena/sparql/algebra/op/ src/com/hp/hpl/jena/sparql/engine/ src/com/hp/hpl/jena/sparql/expr/ src/com/hp/hpl/jena/...
Date Wed, 06 Jul 2011 13:59:29 GMT
Author: andy
Date: Wed Jul  6 13:59:28 2011
New Revision: 1143418

URL: http://svn.apache.org/viewvc?rev=1143418&view=rev
Log:
Bug fix: ORDER BY in sub-SELECT was not rewritten correctly.

Added:
    incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-01.rq
    incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-02.rq
    incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-03.rq
    incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-04.rq
Removed:
    incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/X
    incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-01.arq
    incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-02.arq
    incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-03.arq
    incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-04.arq
Modified:
    incubator/jena/Jena2/ARQ/trunk/ChangeLog.txt
    incubator/jena/Jena2/ARQ/trunk/src-dev/dev/RunARQ.java
    incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/algebra/optimize/TestVarRename.java
    incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/algebra/op/OpOrder.java
    incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/engine/VarRename.java
    incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/expr/ExprAggregator.java
    incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/graph/NodeTransformLib.java
    incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/graph/NodeTransformOp.java
    incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/data-sq.ttl
    incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/data.ttl
    incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/graph-subquery-1.rq
    incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/manifest.ttl
    incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-01.srx
    incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-02.srx
    incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-03.srx
    incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-04.srx

Modified: incubator/jena/Jena2/ARQ/trunk/ChangeLog.txt
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/ChangeLog.txt?rev=1143418&r1=1143417&r2=1143418&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/ChangeLog.txt (original)
+++ incubator/jena/Jena2/ARQ/trunk/ChangeLog.txt Wed Jul  6 13:59:28 2011
@@ -3,6 +3,8 @@ ChangeLog for ARQ
 
 ==== ARQ 2.8.10
 
++ Bug fix: ORDER BY in sub-selects didn't work if ordering by non-SELECT variables.
++ Bug fix: Equality of algebra operator (order) wasn't checkign all aspects of the op.
 + Bug fix: SUM and AVG over errors didn't generate an error as they should do.
 
 ==== ARQ 2.8.9

Modified: incubator/jena/Jena2/ARQ/trunk/src-dev/dev/RunARQ.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src-dev/dev/RunARQ.java?rev=1143418&r1=1143417&r2=1143418&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src-dev/dev/RunARQ.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src-dev/dev/RunARQ.java Wed Jul  6 13:59:28 2011
@@ -128,7 +128,7 @@ public class RunARQ
     public static void main(String[] argv) throws Exception
     {
         //arq.sparql.main("--data=D.ttl", "--query=Q.rq") ;
-        arq.qparse.main("--query=Q.rq") ;
+        arq.qparse.main("--query=testing/ARQ/SubQuery/sub-select-03.rq", "--print=opt") ;
         exit(0) ;
         
         

Modified: incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/algebra/optimize/TestVarRename.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/algebra/optimize/TestVarRename.java?rev=1143418&r1=1143417&r2=1143418&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/algebra/optimize/TestVarRename.java
(original)
+++ incubator/jena/Jena2/ARQ/trunk/src-test/com/hp/hpl/jena/sparql/algebra/optimize/TestVarRename.java
Wed Jul  6 13:59:28 2011
@@ -49,6 +49,16 @@ public class TestVarRename extends BaseT
                                            "(project (?s ?/p) (bgp (?s ?/p ?/o)))",
                                            true,
                                            "s") ; }
+    
+    @Test public void rename_10() { rename("(order (?s ?p) (bgp (?s ?p ?o)))",  
+                                           "(order (?s ?/p) (bgp (?s ?/p ?/o)))",
+                                           true,
+                                           "s") ; }
+    
+    @Test public void rename_11() { rename("(project (?s) (order (?s ?p) (bgp (?s ?p ?o))))",
 
+                                           "(project (?s) (order (?s ?/p) (bgp (?s ?/p ?/o))))",
+                                           true,
+                                           "s") ; }
 
     @Test public void rename_reverse_01() { reverse("(project (?s ?/p) (bgp (?s ?/p ?/o)))",
                                                     "(project (?s ?p) (bgp (?s ?p ?o)))",
true ) ; }  

Modified: incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/algebra/op/OpOrder.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/algebra/op/OpOrder.java?rev=1143418&r1=1143417&r2=1143418&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/algebra/op/OpOrder.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/algebra/op/OpOrder.java Wed
Jul  6 13:59:28 2011
@@ -46,6 +46,10 @@ public class OpOrder extends OpModifier
     {
         if ( ! (other instanceof OpOrder) ) return false ;
         OpOrder opOrder = (OpOrder)other ;
+        
+        if ( ! opOrder.getConditions().equals(this.getConditions()) )
+            return false ;
+        
         //
         return getSubOp().equalTo(opOrder.getSubOp(), labelMap) ;
     }

Modified: incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/engine/VarRename.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/engine/VarRename.java?rev=1143418&r1=1143417&r2=1143418&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/engine/VarRename.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/engine/VarRename.java Wed Jul
 6 13:59:28 2011
@@ -38,27 +38,6 @@ public class VarRename
         return NodeTransformLib.transform(renamer, exprList) ;
     }
         
-//    public static ExprList transform(ExprList exprList, NodeTransform transform)
-//    {
-//        ExprList exprList2 = new ExprList() ;
-//        boolean changed = false ;
-//        for(Expr expr : exprList)
-//        {
-//            Expr expr2 = expr.copyNodeTransform(transform) ;
-//            if ( expr != expr2 )
-//                changed = true ;
-//            exprList2.add(expr2) ;
-//        }
-//        if ( ! changed ) return exprList ;
-//        return exprList2 ;
-//    }
-//    
-//    /** Rename all variables in an expression, EXCEPT for those named as constant */ 
-//    public static Expr transform(Expr expr, NodeTransform transform)
-//    {
-//        return expr.copyNodeTransform(transform) ;
-//    }
-
     public static Expr rename(Expr expr, Set<Var> constants)
     {
         NodeTransform renamer = new RenamerVars(constants, prefix) ;

Modified: incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/expr/ExprAggregator.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/expr/ExprAggregator.java?rev=1143418&r1=1143417&r2=1143418&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/expr/ExprAggregator.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/expr/ExprAggregator.java Wed
Jul  6 13:59:28 2011
@@ -6,6 +6,7 @@
 
 package com.hp.hpl.jena.sparql.expr;
 
+import static org.openjena.atlas.lib.Lib.equal ;
 import org.openjena.atlas.logging.Log ;
 
 import com.hp.hpl.jena.graph.Node ;
@@ -65,7 +66,9 @@ public class ExprAggregator extends Expr
         if ( ! ( other instanceof ExprAggregator ) )
             return false ;
         ExprAggregator agg = (ExprAggregator)other ;
-        return aggregator.equals(agg.aggregator) ;
+        if ( ! equal(var, agg.var) )
+            return false ;
+        return equal(aggregator, agg.aggregator) ;
     }
 
     // Ensure no confusion - in an old design, an ExprAggregator was a subclass of ExprVar.


Modified: incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/graph/NodeTransformLib.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/graph/NodeTransformLib.java?rev=1143418&r1=1143417&r2=1143418&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/graph/NodeTransformLib.java
(original)
+++ incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/graph/NodeTransformLib.java
Wed Jul  6 13:59:28 2011
@@ -13,6 +13,7 @@ import static org.openjena.atlas.lib.Lib
 
 import com.hp.hpl.jena.graph.Node ;
 import com.hp.hpl.jena.graph.Triple ;
+import com.hp.hpl.jena.query.SortCondition ;
 import com.hp.hpl.jena.sparql.algebra.Op ;
 import com.hp.hpl.jena.sparql.algebra.Transform ;
 import com.hp.hpl.jena.sparql.algebra.Transformer ;
@@ -184,10 +185,28 @@ public class NodeTransformLib
         return expr.applyNodeTransform(nodeTransform) ;
     }
 
+    public static List<SortCondition> transform(NodeTransform nodeTransform, List<SortCondition>
conditions)
+    {
+        List<SortCondition> conditions2 = new ArrayList<SortCondition>() ;
+        boolean same = true ;
+        for ( SortCondition sc : conditions )
+        {
+            Expr expr = sc.getExpression() ;
+            Expr expr2 = transform(nodeTransform, expr) ;
+            if ( expr != expr2 )
+                same = false ;
+            SortCondition sc2 = new SortCondition(expr2, sc.getDirection()) ;
+            conditions2.add(sc2) ;
+        }
+
+        if ( same )
+            return conditions ;
+        return conditions2 ;
+    }
 }
 
 /*
- * (c) Copyright 2010 Epimorphics Ltd.
+ * (c) Copyright 2010, 2011 Epimorphics Ltd.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without

Modified: incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/graph/NodeTransformOp.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/graph/NodeTransformOp.java?rev=1143418&r1=1143417&r2=1143418&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/graph/NodeTransformOp.java (original)
+++ incubator/jena/Jena2/ARQ/trunk/src/com/hp/hpl/jena/sparql/graph/NodeTransformOp.java Wed
Jul  6 13:59:28 2011
@@ -11,6 +11,7 @@ import java.util.List ;
 
 import com.hp.hpl.jena.graph.Node ;
 import com.hp.hpl.jena.graph.Triple ;
+import com.hp.hpl.jena.query.SortCondition ;
 import com.hp.hpl.jena.sparql.ARQNotImplemented ;
 import com.hp.hpl.jena.sparql.algebra.Op ;
 import com.hp.hpl.jena.sparql.algebra.TransformCopy ;
@@ -21,6 +22,7 @@ import com.hp.hpl.jena.sparql.algebra.op
 import com.hp.hpl.jena.sparql.algebra.op.OpFilter ;
 import com.hp.hpl.jena.sparql.algebra.op.OpGraph ;
 import com.hp.hpl.jena.sparql.algebra.op.OpGroup ;
+import com.hp.hpl.jena.sparql.algebra.op.OpOrder ;
 import com.hp.hpl.jena.sparql.algebra.op.OpPath ;
 import com.hp.hpl.jena.sparql.algebra.op.OpProject ;
 import com.hp.hpl.jena.sparql.algebra.op.OpQuadPattern ;
@@ -54,6 +56,8 @@ class NodeTransformOp extends TransformC
     { 
         ExprList exprList = opFilter.getExprs() ;
         ExprList exprList2 = NodeTransformLib.transform(transform, exprList) ;
+        if ( exprList2 == exprList )
+            return super.transform(opFilter, subOp) ;
         return OpFilter.filter(exprList2, subOp) ;
     }        
     
@@ -73,9 +77,9 @@ class NodeTransformOp extends TransformC
         Node o = tp.getObject() ;
         Node o1 = transform.convert(o) ;
         
-        if ( s1 == s || o1 == o )
+        if ( s1 == s && o1 == o )
             // No change.
-            return opPath ;
+            return super.transform(opPath) ;
         
         Path path = tp.getPath() ;
         TriplePath tp2 ;
@@ -131,6 +135,8 @@ class NodeTransformOp extends TransformC
     { 
         List<Var> x = opProject.getVars() ;
         List<Var> x2 = NodeTransformLib.transformVars(transform, x) ;
+        if ( x == x2 )
+            return super.transform(opProject, subOp) ;
         return new OpProject(subOp, x2) ; 
     }
     
@@ -138,6 +144,8 @@ class NodeTransformOp extends TransformC
     { 
         VarExprList varExprList = opAssign.getVarExprList() ;
         VarExprList varExprList2 = NodeTransformLib.transform(transform, varExprList) ;
+        if ( varExprList == varExprList2 )
+            return super.transform(opAssign, subOp) ;
         return OpAssign.assign(subOp, varExprList2) ;
     }
     
@@ -145,19 +153,38 @@ class NodeTransformOp extends TransformC
     { 
         VarExprList varExprList = opExtend.getVarExprList() ;
         VarExprList varExprList2 = NodeTransformLib.transform(transform, varExprList) ;
+        if ( varExprList == varExprList2 )
+            return super.transform(opExtend, subOp) ;
         return OpExtend.extend(subOp, varExprList2) ;
     }
     
+    @Override public Op transform(OpOrder opOrder, Op subOp)
+    {
+        List<SortCondition> conditions = NodeTransformLib.transform(transform, opOrder.getConditions())
;
+        
+        if ( conditions == opOrder.getConditions() )
+            return super.transform(opOrder, subOp) ;
+        return new OpOrder(subOp, conditions) ;
+    }
+    
     @Override public Op transform(OpGroup opGroup, Op subOp)
     {
         VarExprList groupVars = NodeTransformLib.transform(transform, opGroup.getGroupVars())
;
-
+        
+        
         // Rename the vars in the expression as well.
         // .e.g max(?y) ==> max(?/y)  
         // These need renaming as well.
         List<ExprAggregator> aggregators = new ArrayList<ExprAggregator>() ;
         for ( ExprAggregator agg : opGroup.getAggregators() )
             aggregators.add(agg.applyNodeTransform(transform)) ;
+        
+        if ( aggregators.equals(opGroup.getAggregators())) 
+        {
+            if ( groupVars == opGroup.getGroupVars() )
+                return super.transform(opGroup, subOp) ;
+        }
+        
         return new OpGroup(subOp, groupVars, aggregators) ;
     }
 }

Modified: incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/data-sq.ttl
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/data-sq.ttl?rev=1143418&r1=1143417&r2=1143418&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/data-sq.ttl (original)
+++ incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/data-sq.ttl Wed Jul  6 13:59:28 2011
@@ -1,5 +1,5 @@
-@prefix : <http://example/> .
-
-:a :p : .
-# And this is the graph name.
-:b :q <data-sq.ttl> .
+@prefix : <http://example/> .
+
+:a :p : .
+# And this is the graph name.
+:b :q <data-sq.ttl> .

Modified: incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/data.ttl
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/data.ttl?rev=1143418&r1=1143417&r2=1143418&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/data.ttl (original)
+++ incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/data.ttl Wed Jul  6 13:59:28 2011
@@ -1,27 +1,27 @@
-@prefix : <http://example/> .
-
-:x1 a :X ;
-    :p 1 .
-
-:x2 a :X ;
-    :p 2 .
-
-:x3 a :X ;
-    :p 3 .
-
-:x4 a :X ;
-    :p 4 .
-
-:x5 a :X ;
-    :p 5 .
-
-
-:x6 a :X ;
-    :p "a" .
-
-:x7 a :X ;
-    :p "2" .
-
-:x8 a :X ;
-    :q 100 .
-
+@prefix : <http://example/> .
+
+:x1 a :X ;
+    :p 1 .
+
+:x2 a :X ;
+    :p 2 .
+
+:x3 a :X ;
+    :p 3 .
+
+:x4 a :X ;
+    :p 4 .
+
+:x5 a :X ;
+    :p 5 .
+
+
+:x6 a :X ;
+    :p "a" .
+
+:x7 a :X ;
+    :p "2" .
+
+:x8 a :X ;
+    :q 100 .
+

Modified: incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/graph-subquery-1.rq
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/graph-subquery-1.rq?rev=1143418&r1=1143417&r2=1143418&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/graph-subquery-1.rq (original)
+++ incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/graph-subquery-1.rq Wed Jul  6 13:59:28
2011
@@ -1,9 +1,9 @@
-PREFIX  afn:     <http://jena.hpl.hp.com/ARQ/function#>
-
-# Take local name ro make a more portable test
-SELECT ?x (afn:localname(?g) AS ?gn)
-{
-  GRAPH ?g
-  # Scope: different ?g
-     { SELECT ?x { ?x ?p ?g } }
-}
+PREFIX  afn:     <http://jena.hpl.hp.com/ARQ/function#>
+
+# Take local name ro make a more portable test
+SELECT ?x (afn:localname(?g) AS ?gn)
+{
+  GRAPH ?g
+  # Scope: different ?g
+     { SELECT ?x { ?x ?p ?g } }
+}

Modified: incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/manifest.ttl
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/manifest.ttl?rev=1143418&r1=1143417&r2=1143418&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/manifest.ttl (original)
+++ incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/manifest.ttl Wed Jul  6 13:59:28 2011
@@ -1,48 +1,48 @@
-@prefix rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
-@prefix rdfs:	<http://www.w3.org/2000/01/rdf-schema#> .
-@prefix mf:     <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
-@prefix mfx:    <http://jena.hpl.hp.com/2005/05/test-manifest-extra#> .
-@prefix qt:     <http://www.w3.org/2001/sw/DataAccess/tests/test-query#> .
-
-<>  rdf:type mf:Manifest ;
-    rdfs:label "Sub Query" ;
-    mf:entries
-    ( 
-      [  mf:name    "Sub SELECT 1" ;
-         rdf:type   mfx:TestQuery ; 
-         mf:action
-            [ qt:query  <sub-select-01.arq> ;
-              qt:data   <data.ttl> ] ;
-        mf:result  <sub-select-01.srx>
-      ]
-      [  mf:name    "Sub SELECT 2" ;
-         rdf:type   mfx:TestQuery ; 
-         mf:action
-            [ qt:query  <sub-select-02.arq> ;
-              qt:data   <data.ttl> ] ;
-        mf:result  <sub-select-02.srx>
-      ]
-      [  mf:name    "Sub SELECT 3" ;
-         rdf:type   mfx:TestQuery ; 
-         mf:action
-            [ qt:query  <sub-select-03.arq> ;
-              qt:data   <data.ttl> ] ;
-        mf:result  <sub-select-03.srx>
-      ]
-      [  mf:name    "Sub SELECT 4" ;
-         rdf:type   mfx:TestQuery ; 
-         mf:action
-            [ qt:query  <sub-select-04.arq> ;
-              qt:data   <data.ttl> ] ;
-        mf:result  <sub-select-04.srx>
-      ] 
-
-      ## Scoping related tests.
-      [  mf:name    "graph-subquery-1.rq" ;
-         mf:action
-            [ qt:query  <graph-subquery-1.rq> ;
-              qt:graphData  <data-sq.ttl> ;
-            ] ;
-         mf:result  <graph-subquery-1.srj>
-      ]
-    ).
+@prefix rdf:    <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs:	<http://www.w3.org/2000/01/rdf-schema#> .
+@prefix mf:     <http://www.w3.org/2001/sw/DataAccess/tests/test-manifest#> .
+@prefix mfx:    <http://jena.hpl.hp.com/2005/05/test-manifest-extra#> .
+@prefix qt:     <http://www.w3.org/2001/sw/DataAccess/tests/test-query#> .
+
+<>  rdf:type mf:Manifest ;
+    rdfs:label "Sub Query" ;
+    mf:entries
+    ( 
+      [  mf:name    "Sub SELECT 1" ;
+         rdf:type   mfx:TestQuery ; 
+         mf:action
+            [ qt:query  <sub-select-01.rq> ;
+              qt:data   <data.ttl> ] ;
+        mf:result  <sub-select-01.srx>
+      ]
+      [  mf:name    "Sub SELECT 2" ;
+         rdf:type   mfx:TestQuery ; 
+         mf:action
+            [ qt:query  <sub-select-02.rq> ;
+              qt:data   <data.ttl> ] ;
+        mf:result  <sub-select-02.srx>
+      ]
+      [  mf:name    "Sub SELECT 3" ;
+         rdf:type   mfx:TestQuery ; 
+         mf:action
+            [ qt:query  <sub-select-03.rq> ;
+              qt:data   <data.ttl> ] ;
+        mf:result  <sub-select-03.srx>
+      ]
+      [  mf:name    "Sub SELECT 4" ;
+         rdf:type   mfx:TestQuery ; 
+         mf:action
+            [ qt:query  <sub-select-04.rq> ;
+              qt:data   <data.ttl> ] ;
+        mf:result  <sub-select-04.srx>
+      ] 
+
+      ## Scoping related tests.
+      [  mf:name    "graph-subquery-1.rq" ;
+         mf:action
+            [ qt:query  <graph-subquery-1.rq> ;
+              qt:graphData  <data-sq.ttl> ;
+            ] ;
+         mf:result  <graph-subquery-1.srj>
+      ]
+    ).

Added: incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-01.rq
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-01.rq?rev=1143418&view=auto
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-01.rq (added)
+++ incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-01.rq Wed Jul  6 13:59:28
2011
@@ -0,0 +1,6 @@
+PREFIX : <http://example/> 
+
+SELECT ?s
+{
+  { SELECT * { ?s a ?o } }
+}
\ No newline at end of file

Modified: incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-01.srx
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-01.srx?rev=1143418&r1=1143417&r2=1143418&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-01.srx (original)
+++ incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-01.srx Wed Jul  6 13:59:28
2011
@@ -1,48 +1,48 @@
-<?xml version="1.0"?>
-<sparql xmlns="http://www.w3.org/2005/sparql-results#">
-  <head>
-    <variable name="s"/>
-  </head>
-  <results>
-    <result>
-      <binding name="s">
-        <uri>http://example/x8</uri>
-      </binding>
-    </result>
-    <result>
-      <binding name="s">
-        <uri>http://example/x7</uri>
-      </binding>
-    </result>
-    <result>
-      <binding name="s">
-        <uri>http://example/x6</uri>
-      </binding>
-    </result>
-    <result>
-      <binding name="s">
-        <uri>http://example/x5</uri>
-      </binding>
-    </result>
-    <result>
-      <binding name="s">
-        <uri>http://example/x4</uri>
-      </binding>
-    </result>
-    <result>
-      <binding name="s">
-        <uri>http://example/x3</uri>
-      </binding>
-    </result>
-    <result>
-      <binding name="s">
-        <uri>http://example/x2</uri>
-      </binding>
-    </result>
-    <result>
-      <binding name="s">
-        <uri>http://example/x1</uri>
-      </binding>
-    </result>
-  </results>
-</sparql>
+<?xml version="1.0"?>
+<sparql xmlns="http://www.w3.org/2005/sparql-results#">
+  <head>
+    <variable name="s"/>
+  </head>
+  <results>
+    <result>
+      <binding name="s">
+        <uri>http://example/x8</uri>
+      </binding>
+    </result>
+    <result>
+      <binding name="s">
+        <uri>http://example/x7</uri>
+      </binding>
+    </result>
+    <result>
+      <binding name="s">
+        <uri>http://example/x6</uri>
+      </binding>
+    </result>
+    <result>
+      <binding name="s">
+        <uri>http://example/x5</uri>
+      </binding>
+    </result>
+    <result>
+      <binding name="s">
+        <uri>http://example/x4</uri>
+      </binding>
+    </result>
+    <result>
+      <binding name="s">
+        <uri>http://example/x3</uri>
+      </binding>
+    </result>
+    <result>
+      <binding name="s">
+        <uri>http://example/x2</uri>
+      </binding>
+    </result>
+    <result>
+      <binding name="s">
+        <uri>http://example/x1</uri>
+      </binding>
+    </result>
+  </results>
+</sparql>

Added: incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-02.rq
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-02.rq?rev=1143418&view=auto
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-02.rq (added)
+++ incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-02.rq Wed Jul  6 13:59:28
2011
@@ -0,0 +1,6 @@
+PREFIX : <http://example/> 
+
+SELECT *
+{
+  SELECT ?s { ?s a ?o }
+}
\ No newline at end of file

Modified: incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-02.srx
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-02.srx?rev=1143418&r1=1143417&r2=1143418&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-02.srx (original)
+++ incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-02.srx Wed Jul  6 13:59:28
2011
@@ -1,48 +1,48 @@
-<?xml version="1.0"?>
-<sparql xmlns="http://www.w3.org/2005/sparql-results#">
-  <head>
-    <variable name="s"/>
-  </head>
-  <results>
-    <result>
-      <binding name="s">
-        <uri>http://example/x8</uri>
-      </binding>
-    </result>
-    <result>
-      <binding name="s">
-        <uri>http://example/x7</uri>
-      </binding>
-    </result>
-    <result>
-      <binding name="s">
-        <uri>http://example/x6</uri>
-      </binding>
-    </result>
-    <result>
-      <binding name="s">
-        <uri>http://example/x5</uri>
-      </binding>
-    </result>
-    <result>
-      <binding name="s">
-        <uri>http://example/x4</uri>
-      </binding>
-    </result>
-    <result>
-      <binding name="s">
-        <uri>http://example/x3</uri>
-      </binding>
-    </result>
-    <result>
-      <binding name="s">
-        <uri>http://example/x2</uri>
-      </binding>
-    </result>
-    <result>
-      <binding name="s">
-        <uri>http://example/x1</uri>
-      </binding>
-    </result>
-  </results>
-</sparql>
+<?xml version="1.0"?>
+<sparql xmlns="http://www.w3.org/2005/sparql-results#">
+  <head>
+    <variable name="s"/>
+  </head>
+  <results>
+    <result>
+      <binding name="s">
+        <uri>http://example/x8</uri>
+      </binding>
+    </result>
+    <result>
+      <binding name="s">
+        <uri>http://example/x7</uri>
+      </binding>
+    </result>
+    <result>
+      <binding name="s">
+        <uri>http://example/x6</uri>
+      </binding>
+    </result>
+    <result>
+      <binding name="s">
+        <uri>http://example/x5</uri>
+      </binding>
+    </result>
+    <result>
+      <binding name="s">
+        <uri>http://example/x4</uri>
+      </binding>
+    </result>
+    <result>
+      <binding name="s">
+        <uri>http://example/x3</uri>
+      </binding>
+    </result>
+    <result>
+      <binding name="s">
+        <uri>http://example/x2</uri>
+      </binding>
+    </result>
+    <result>
+      <binding name="s">
+        <uri>http://example/x1</uri>
+      </binding>
+    </result>
+  </results>
+</sparql>

Added: incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-03.rq
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-03.rq?rev=1143418&view=auto
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-03.rq (added)
+++ incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-03.rq Wed Jul  6 13:59:28
2011
@@ -0,0 +1,7 @@
+PREFIX : <http://example/> 
+
+SELECT *
+{
+  ?x a :X .
+  { SELECT ?x ( count(*) AS ?c) { ?x :p ?v } GROUP BY ?x }
+}

Modified: incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-03.srx
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-03.srx?rev=1143418&r1=1143417&r2=1143418&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-03.srx (original)
+++ incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-03.srx Wed Jul  6 13:59:28
2011
@@ -1,65 +1,65 @@
-<?xml version="1.0"?>
-<sparql xmlns="http://www.w3.org/2005/sparql-results#">
-  <head>
-    <variable name="x"/>
-    <variable name="c"/>
-  </head>
-  <results>
-    <result>
-      <binding name="x">
-        <uri>http://example/x7</uri>
-      </binding>
-      <binding name="c">
-        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal>
-      </binding>
-    </result>
-    <result>
-      <binding name="x">
-        <uri>http://example/x6</uri>
-      </binding>
-      <binding name="c">
-        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal>
-      </binding>
-    </result>
-    <result>
-      <binding name="x">
-        <uri>http://example/x5</uri>
-      </binding>
-      <binding name="c">
-        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal>
-      </binding>
-    </result>
-    <result>
-      <binding name="x">
-        <uri>http://example/x4</uri>
-      </binding>
-      <binding name="c">
-        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal>
-      </binding>
-    </result>
-    <result>
-      <binding name="x">
-        <uri>http://example/x3</uri>
-      </binding>
-      <binding name="c">
-        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal>
-      </binding>
-    </result>
-    <result>
-      <binding name="x">
-        <uri>http://example/x2</uri>
-      </binding>
-      <binding name="c">
-        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal>
-      </binding>
-    </result>
-    <result>
-      <binding name="x">
-        <uri>http://example/x1</uri>
-      </binding>
-      <binding name="c">
-        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal>
-      </binding>
-    </result>
-  </results>
-</sparql>
+<?xml version="1.0"?>
+<sparql xmlns="http://www.w3.org/2005/sparql-results#">
+  <head>
+    <variable name="x"/>
+    <variable name="c"/>
+  </head>
+  <results>
+    <result>
+      <binding name="x">
+        <uri>http://example/x7</uri>
+      </binding>
+      <binding name="c">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal>
+      </binding>
+    </result>
+    <result>
+      <binding name="x">
+        <uri>http://example/x6</uri>
+      </binding>
+      <binding name="c">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal>
+      </binding>
+    </result>
+    <result>
+      <binding name="x">
+        <uri>http://example/x5</uri>
+      </binding>
+      <binding name="c">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal>
+      </binding>
+    </result>
+    <result>
+      <binding name="x">
+        <uri>http://example/x4</uri>
+      </binding>
+      <binding name="c">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal>
+      </binding>
+    </result>
+    <result>
+      <binding name="x">
+        <uri>http://example/x3</uri>
+      </binding>
+      <binding name="c">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal>
+      </binding>
+    </result>
+    <result>
+      <binding name="x">
+        <uri>http://example/x2</uri>
+      </binding>
+      <binding name="c">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal>
+      </binding>
+    </result>
+    <result>
+      <binding name="x">
+        <uri>http://example/x1</uri>
+      </binding>
+      <binding name="c">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal>
+      </binding>
+    </result>
+  </results>
+</sparql>

Added: incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-04.rq
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-04.rq?rev=1143418&view=auto
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-04.rq (added)
+++ incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-04.rq Wed Jul  6 13:59:28
2011
@@ -0,0 +1,8 @@
+PREFIX : <http://example/> 
+
+SELECT *
+{
+  ?x :p ?p .
+  # A silly thing to do ... shows the ?x is different
+  { SELECT ?q { ?x :q ?q } }
+}

Modified: incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-04.srx
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-04.srx?rev=1143418&r1=1143417&r2=1143418&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-04.srx (original)
+++ incubator/jena/Jena2/ARQ/trunk/testing/ARQ/SubQuery/sub-select-04.srx Wed Jul  6 13:59:28
2011
@@ -1,87 +1,87 @@
-<?xml version="1.0"?>
-<sparql xmlns="http://www.w3.org/2005/sparql-results#">
-  <head>
-    <variable name="x"/>
-    <variable name="p"/>
-    <variable name="q"/>
-  </head>
-  <results>
-    <result>
-      <binding name="x">
-        <uri>http://example/x7</uri>
-      </binding>
-      <binding name="p">
-        <literal>2</literal>
-      </binding>
-      <binding name="q">
-        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">100</literal>
-      </binding>
-    </result>
-    <result>
-      <binding name="x">
-        <uri>http://example/x6</uri>
-      </binding>
-      <binding name="p">
-        <literal>a</literal>
-      </binding>
-      <binding name="q">
-        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">100</literal>
-      </binding>
-    </result>
-    <result>
-      <binding name="x">
-        <uri>http://example/x5</uri>
-      </binding>
-      <binding name="p">
-        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">5</literal>
-      </binding>
-      <binding name="q">
-        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">100</literal>
-      </binding>
-    </result>
-    <result>
-      <binding name="x">
-        <uri>http://example/x4</uri>
-      </binding>
-      <binding name="p">
-        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">4</literal>
-      </binding>
-      <binding name="q">
-        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">100</literal>
-      </binding>
-    </result>
-    <result>
-      <binding name="x">
-        <uri>http://example/x3</uri>
-      </binding>
-      <binding name="p">
-        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">3</literal>
-      </binding>
-      <binding name="q">
-        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">100</literal>
-      </binding>
-    </result>
-    <result>
-      <binding name="x">
-        <uri>http://example/x2</uri>
-      </binding>
-      <binding name="p">
-        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">2</literal>
-      </binding>
-      <binding name="q">
-        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">100</literal>
-      </binding>
-    </result>
-    <result>
-      <binding name="x">
-        <uri>http://example/x1</uri>
-      </binding>
-      <binding name="p">
-        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal>
-      </binding>
-      <binding name="q">
-        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">100</literal>
-      </binding>
-    </result>
-  </results>
-</sparql>
+<?xml version="1.0"?>
+<sparql xmlns="http://www.w3.org/2005/sparql-results#">
+  <head>
+    <variable name="x"/>
+    <variable name="p"/>
+    <variable name="q"/>
+  </head>
+  <results>
+    <result>
+      <binding name="x">
+        <uri>http://example/x7</uri>
+      </binding>
+      <binding name="p">
+        <literal>2</literal>
+      </binding>
+      <binding name="q">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">100</literal>
+      </binding>
+    </result>
+    <result>
+      <binding name="x">
+        <uri>http://example/x6</uri>
+      </binding>
+      <binding name="p">
+        <literal>a</literal>
+      </binding>
+      <binding name="q">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">100</literal>
+      </binding>
+    </result>
+    <result>
+      <binding name="x">
+        <uri>http://example/x5</uri>
+      </binding>
+      <binding name="p">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">5</literal>
+      </binding>
+      <binding name="q">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">100</literal>
+      </binding>
+    </result>
+    <result>
+      <binding name="x">
+        <uri>http://example/x4</uri>
+      </binding>
+      <binding name="p">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">4</literal>
+      </binding>
+      <binding name="q">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">100</literal>
+      </binding>
+    </result>
+    <result>
+      <binding name="x">
+        <uri>http://example/x3</uri>
+      </binding>
+      <binding name="p">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">3</literal>
+      </binding>
+      <binding name="q">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">100</literal>
+      </binding>
+    </result>
+    <result>
+      <binding name="x">
+        <uri>http://example/x2</uri>
+      </binding>
+      <binding name="p">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">2</literal>
+      </binding>
+      <binding name="q">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">100</literal>
+      </binding>
+    </result>
+    <result>
+      <binding name="x">
+        <uri>http://example/x1</uri>
+      </binding>
+      <binding name="p">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">1</literal>
+      </binding>
+      <binding name="q">
+        <literal datatype="http://www.w3.org/2001/XMLSchema#integer">100</literal>
+      </binding>
+    </result>
+  </results>
+</sparql>



Mime
View raw message