You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by sa...@apache.org on 2013/01/31 03:01:06 UTC

svn commit: r1440789 - in /jena/branches/streaming-update/jena-arq: Grammar/ src/main/java/com/hp/hpl/jena/sparql/lang/ src/main/java/com/hp/hpl/jena/sparql/lang/arq/ src/main/java/com/hp/hpl/jena/sparql/lang/sparql_11/ src/main/java/com/hp/hpl/jena/sp...

Author: sallen
Date: Thu Jan 31 02:01:05 2013
New Revision: 1440789

URL: http://svn.apache.org/viewvc?rev=1440789&view=rev
Log:
JENA-330 Fix out-of-order triples/paths when using blank node [] or list () syntactic shortcuts.

Added:
    jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/syntax/TripleCollectorMark.java
Modified:
    jena/branches/streaming-update/jena-arq/Grammar/arq.jj
    jena/branches/streaming-update/jena-arq/Grammar/master.jj
    jena/branches/streaming-update/jena-arq/Grammar/sparql_11.jj
    jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/ParserBase.java
    jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/arq/ARQParser.java
    jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/sparql_11/SPARQLParser11.java
    jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/request/QuadDataAcc.java
    jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/syntax/ElementPathBlock.java

Modified: jena/branches/streaming-update/jena-arq/Grammar/arq.jj
URL: http://svn.apache.org/viewvc/jena/branches/streaming-update/jena-arq/Grammar/arq.jj?rev=1440789&r1=1440788&r2=1440789&view=diff
==============================================================================
--- jena/branches/streaming-update/jena-arq/Grammar/arq.jj (original)
+++ jena/branches/streaming-update/jena-arq/Grammar/arq.jj Thu Jan 31 02:01:05 2013
@@ -888,8 +888,10 @@ void TriplesSameSubject(TripleCollector 
   PropertyListNotEmpty(s, acc)
 |
   // Any of the triple generating syntax elements
-  s = TriplesNode(acc)
-  PropertyList(s, acc)
+  { ElementPathBlock tempAcc = new ElementPathBlock() ; }
+  s = TriplesNode(tempAcc)
+  PropertyList(s, tempAcc)
+  { insert(acc, tempAcc) ; }
 }
 void PropertyList(Node s, TripleCollector acc) : { }
 {
@@ -921,8 +923,9 @@ void ObjectList(Node s, Node p, Path pat
 }
 void Object(Node s, Node p, Path path, TripleCollector acc): { Node o ; }
 {
-  o = GraphNode(acc)
-  { insert(acc, s, p, path, o) ; }
+  { ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; }
+  o = GraphNode(tempAcc)
+  { insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; }
 }
 // -------- BGPs with paths.
 // -------- Entry point: TriplesSameSubjectPath
@@ -932,8 +935,10 @@ void TriplesSameSubjectPath(TripleCollec
   PropertyListPathNotEmpty(s, acc)
 |
   // Any of the triple generating syntax elements
-  s = TriplesNodePath(acc)
-  PropertyListPath(s, acc)
+  { ElementPathBlock tempAcc = new ElementPathBlock() ; }
+  s = TriplesNodePath(tempAcc)
+  PropertyListPath(s, tempAcc)
+  { insert(acc, tempAcc) ; }
 }
 void PropertyListPath(Node s, TripleCollector acc) : { }
 {
@@ -974,8 +979,9 @@ void ObjectListPath(Node s, Node p, Path
 }
 void ObjectPath(Node s, Node p, Path path, TripleCollector acc): { Node o ; }
 {
-  o = GraphNodePath(acc)
-  { insert(acc, s, p, path, o) ; }
+  { ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; }
+  o = GraphNodePath(tempAcc)
+  { insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; }
 }
 // End paths stuff.
 // -------- Paths
@@ -1118,7 +1124,7 @@ long Integer() : {Token t ;}
 // -------- Triple expansions
 // Anything that can stand in a node slot and which is
 // a number of triples
-Node TriplesNode(TripleCollector acc) : { Node n ; }
+Node TriplesNode(TripleCollectorMark acc) : { Node n ; }
 {
   n = Collection(acc) { return n ; }
  |
@@ -1132,7 +1138,7 @@ Node BlankNodePropertyList(TripleCollect
   <RBRACKET>
     { return n ; }
 }
-Node TriplesNodePath(TripleCollector acc) : { Node n ; }
+Node TriplesNodePath(TripleCollectorMark acc) : { Node n ; }
 {
   n = CollectionPath(acc) { return n ; }
  |
@@ -1147,8 +1153,8 @@ Node BlankNodePropertyListPath(TripleCol
     { return n ; }
 }
 // ------- RDF collections
-Node Collection(TripleCollector acc) :
-    { Node listHead = nRDFnil ; Node lastCell = null ; Node n ; Token t ; }
+Node Collection(TripleCollectorMark acc) :
+    { Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; }
 {
   t = <LPAREN>
   { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
@@ -1158,10 +1164,11 @@ Node Collection(TripleCollector acc) :
          listHead = cell ;
       if ( lastCell != null )
         insert(acc, lastCell, nRDFrest, cell) ;
+      mark = acc.mark() ;
     }
     n = GraphNode(acc)
     {
-      insert(acc, cell, nRDFfirst, n) ;
+      insert(acc, mark, cell, nRDFfirst, n) ;
       lastCell = cell ;
     }
   ) +
@@ -1171,8 +1178,8 @@ Node Collection(TripleCollector acc) :
        insert(acc, lastCell, nRDFrest, nRDFnil) ;
      return listHead ; }
 }
-Node CollectionPath(TripleCollector acc) :
-    { Node listHead = nRDFnil ; Node lastCell = null ; Node n ; Token t ; }
+Node CollectionPath(TripleCollectorMark acc) :
+    { Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; }
 {
   t = <LPAREN>
   { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
@@ -1182,10 +1189,11 @@ Node CollectionPath(TripleCollector acc)
          listHead = cell ;
       if ( lastCell != null )
         insert(acc, lastCell, nRDFrest, cell) ;
+      mark = acc.mark() ;
     }
     n = GraphNodePath(acc)
     {
-      insert(acc, cell, nRDFfirst, n) ;
+      insert(acc, mark, cell, nRDFfirst, n) ;
       lastCell = cell ;
     }
   ) +
@@ -1196,13 +1204,13 @@ Node CollectionPath(TripleCollector acc)
      return listHead ; }
 }
 // -------- Nodes in a graph pattern or template
-Node GraphNode(TripleCollector acc) : { Node n ; }
+Node GraphNode(TripleCollectorMark acc) : { Node n ; }
 {
   n = VarOrTerm() { return n ; }
  |
   n = TriplesNode(acc) { return n ; }
 }
-Node GraphNodePath(TripleCollector acc) : { Node n ; }
+Node GraphNodePath(TripleCollectorMark acc) : { Node n ; }
 {
   n = VarOrTerm() { return n ; }
  |

Modified: jena/branches/streaming-update/jena-arq/Grammar/master.jj
URL: http://svn.apache.org/viewvc/jena/branches/streaming-update/jena-arq/Grammar/master.jj?rev=1440789&r1=1440788&r2=1440789&view=diff
==============================================================================
--- jena/branches/streaming-update/jena-arq/Grammar/master.jj (original)
+++ jena/branches/streaming-update/jena-arq/Grammar/master.jj Thu Jan 31 02:01:05 2013
@@ -1084,8 +1084,10 @@ void TriplesSameSubject(TripleCollector 
   PropertyListNotEmpty(s, acc) 
 |
   // Any of the triple generating syntax elements
-  s = TriplesNode(acc)
-  PropertyList(s, acc)
+  { ElementPathBlock tempAcc = new ElementPathBlock() ; }
+  s = TriplesNode(tempAcc)
+  PropertyList(s, tempAcc)
+  { insert(acc, tempAcc) ; }
 }
 
 void PropertyList(Node s, TripleCollector acc) : { }
@@ -1122,8 +1124,9 @@ void ObjectList(Node s,  Node p, Path pa
 
 void Object(Node s, Node p, Path path, TripleCollector acc): { Node o ; }
 {
-  o = GraphNode(acc) 
-  { insert(acc, s, p, path, o) ; }
+  { ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; }
+  o = GraphNode(tempAcc) 
+  { insert(tempAcc, mark, s, p, path, o) ;  insert(acc, tempAcc) ; }
 }
 
 // -------- BGPs with paths.
@@ -1135,8 +1138,10 @@ void TriplesSameSubjectPath(TripleCollec
   PropertyListPathNotEmpty(s, acc) 
 |
   // Any of the triple generating syntax elements
-  s = TriplesNodePath(acc)
-  PropertyListPath(s, acc)
+  { ElementPathBlock tempAcc = new ElementPathBlock() ; }
+  s = TriplesNodePath(tempAcc)
+  PropertyListPath(s, tempAcc)
+  { insert(acc, tempAcc) ; }
 }
 
 
@@ -1189,8 +1194,9 @@ void ObjectListPath(Node s,  Node p, Pat
 
 void ObjectPath(Node s, Node p, Path path, TripleCollector acc): { Node o ; }
 {
-  o = GraphNodePath(acc) 
-  { insert(acc, s, p, path, o) ; }
+  { ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; }
+  o = GraphNodePath(tempAcc) 
+  { insert(tempAcc, mark, s, p, path, o) ;  insert(acc, tempAcc) ; }
 }
 
 
@@ -1359,7 +1365,7 @@ long Integer() : {Token t ;}
 // Anything that can stand in a node slot and which is
 // a number of triples
 
-Node TriplesNode(TripleCollector acc) : { Node n ; }
+Node TriplesNode(TripleCollectorMark acc) : { Node n ; }
 {
   n = Collection(acc) { return n ; }
  |
@@ -1379,7 +1385,7 @@ Node BlankNodePropertyList(TripleCollect
     { return n ; }
 }
 
-Node TriplesNodePath(TripleCollector acc) : { Node n ; }
+Node TriplesNodePath(TripleCollectorMark acc) : { Node n ; }
 {
   n = CollectionPath(acc) { return n ; }
  |
@@ -1400,8 +1406,8 @@ Node BlankNodePropertyListPath(TripleCol
 }
 
 #if 0
-Node Reification(Node id, TripleCollector acc) : 
-    { Node s , p , o ; Token t ; }
+Node Reification(Node id, TripleCollectorMark acc) : 
+    { Node s , p , o ; int mark ; Token t ; }
 {
   // For generality, should be AndNode for s/p/o
   // Insert reification triple before the resulting subtriples (if any)
@@ -1409,13 +1415,17 @@ Node Reification(Node id, TripleCollecto
     { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
     { if ( id == null )
         id = createBNode(beginLine, beginColumn() ;
-    }
+      mark = acc.mark() ; }
   s = GraphNode(acc)
-    { insert(acc, id, nRDFsubject, s) ; }
+    { insert(acc, mark, id, nRDFsubject, s) ;
+      mark = acc.mark() ; 
+    }
   p = GraphNode(acc)
-    { insert(acc, id, nRDFpredicate, p) ; }
+    { insert(acc, mark, id, nRDFpredicate, p) ;
+      mark = acc.mark() ;
+    }
   o = GraphNode(acc)
-    { insert(acc, id, nRDFobject, o) ; }
+    { insert(acc, mark, id, nRDFobject, o) ; }
   ">>"
     { return id ; }
 }
@@ -1423,8 +1433,8 @@ Node Reification(Node id, TripleCollecto
 
 // ------- RDF collections
 
-Node Collection(TripleCollector acc) : 
-    { Node listHead = nRDFnil ; Node lastCell = null ; Node n ; Token t ; }
+Node Collection(TripleCollectorMark acc) : 
+    { Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; }
 {
   t = <LPAREN>
   { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
@@ -1434,10 +1444,11 @@ Node Collection(TripleCollector acc) : 
          listHead = cell ;
       if ( lastCell != null )
         insert(acc, lastCell, nRDFrest,  cell) ;
+      mark = acc.mark() ;
     }
     n = GraphNode(acc)
     {
-      insert(acc, cell, nRDFfirst, n) ;
+      insert(acc, mark, cell, nRDFfirst, n) ;
       lastCell = cell ;
     }
   ) +
@@ -1448,8 +1459,8 @@ Node Collection(TripleCollector acc) : 
      return listHead ; }
 }
 
-Node CollectionPath(TripleCollector acc) : 
-    { Node listHead = nRDFnil ; Node lastCell = null ; Node n ; Token t ; }
+Node CollectionPath(TripleCollectorMark acc) : 
+    { Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; }
 {
   t = <LPAREN>
   { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
@@ -1459,10 +1470,11 @@ Node CollectionPath(TripleCollector acc)
          listHead = cell ;
       if ( lastCell != null )
         insert(acc, lastCell, nRDFrest,  cell) ;
+      mark = acc.mark() ;
     }
     n = GraphNodePath(acc)
     {
-      insert(acc, cell, nRDFfirst, n) ;
+      insert(acc, mark, cell, nRDFfirst, n) ;
       lastCell = cell ;
     }
   ) +
@@ -1475,14 +1487,14 @@ Node CollectionPath(TripleCollector acc)
 
 // -------- Nodes in a graph pattern or template
 
-Node GraphNode(TripleCollector acc) : { Node n ; }
+Node GraphNode(TripleCollectorMark acc) : { Node n ; }
 {
   n = VarOrTerm() { return n ; }
  |
   n = TriplesNode(acc) { return n ; }
 }
 
-Node GraphNodePath(TripleCollector acc) : { Node n ; }
+Node GraphNodePath(TripleCollectorMark acc) : { Node n ; }
 {
   n = VarOrTerm() { return n ; }
  |

Modified: jena/branches/streaming-update/jena-arq/Grammar/sparql_11.jj
URL: http://svn.apache.org/viewvc/jena/branches/streaming-update/jena-arq/Grammar/sparql_11.jj?rev=1440789&r1=1440788&r2=1440789&view=diff
==============================================================================
--- jena/branches/streaming-update/jena-arq/Grammar/sparql_11.jj (original)
+++ jena/branches/streaming-update/jena-arq/Grammar/sparql_11.jj Thu Jan 31 02:01:05 2013
@@ -831,8 +831,10 @@ void TriplesSameSubject(TripleCollector 
   PropertyListNotEmpty(s, acc)
 |
   // Any of the triple generating syntax elements
-  s = TriplesNode(acc)
-  PropertyList(s, acc)
+  { ElementPathBlock tempAcc = new ElementPathBlock() ; }
+  s = TriplesNode(tempAcc)
+  PropertyList(s, tempAcc)
+  { insert(acc, tempAcc) ; }
 }
 void PropertyList(Node s, TripleCollector acc) : { }
 {
@@ -864,8 +866,9 @@ void ObjectList(Node s, Node p, Path pat
 }
 void Object(Node s, Node p, Path path, TripleCollector acc): { Node o ; }
 {
-  o = GraphNode(acc)
-  { insert(acc, s, p, path, o) ; }
+  { ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; }
+  o = GraphNode(tempAcc)
+  { insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; }
 }
 // -------- BGPs with paths.
 // -------- Entry point: TriplesSameSubjectPath
@@ -875,8 +878,10 @@ void TriplesSameSubjectPath(TripleCollec
   PropertyListPathNotEmpty(s, acc)
 |
   // Any of the triple generating syntax elements
-  s = TriplesNodePath(acc)
-  PropertyListPath(s, acc)
+  { ElementPathBlock tempAcc = new ElementPathBlock() ; }
+  s = TriplesNodePath(tempAcc)
+  PropertyListPath(s, tempAcc)
+  { insert(acc, tempAcc) ; }
 }
 void PropertyListPath(Node s, TripleCollector acc) : { }
 {
@@ -917,8 +922,9 @@ void ObjectListPath(Node s, Node p, Path
 }
 void ObjectPath(Node s, Node p, Path path, TripleCollector acc): { Node o ; }
 {
-  o = GraphNodePath(acc)
-  { insert(acc, s, p, path, o) ; }
+  { ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ; }
+  o = GraphNodePath(tempAcc)
+  { insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ; }
 }
 // End paths stuff.
 // -------- Paths
@@ -1012,7 +1018,7 @@ long Integer() : {Token t ;}
 // -------- Triple expansions
 // Anything that can stand in a node slot and which is
 // a number of triples
-Node TriplesNode(TripleCollector acc) : { Node n ; }
+Node TriplesNode(TripleCollectorMark acc) : { Node n ; }
 {
   n = Collection(acc) { return n ; }
  |
@@ -1026,7 +1032,7 @@ Node BlankNodePropertyList(TripleCollect
   <RBRACKET>
     { return n ; }
 }
-Node TriplesNodePath(TripleCollector acc) : { Node n ; }
+Node TriplesNodePath(TripleCollectorMark acc) : { Node n ; }
 {
   n = CollectionPath(acc) { return n ; }
  |
@@ -1041,8 +1047,8 @@ Node BlankNodePropertyListPath(TripleCol
     { return n ; }
 }
 // ------- RDF collections
-Node Collection(TripleCollector acc) :
-    { Node listHead = nRDFnil ; Node lastCell = null ; Node n ; Token t ; }
+Node Collection(TripleCollectorMark acc) :
+    { Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; }
 {
   t = <LPAREN>
   { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
@@ -1052,10 +1058,11 @@ Node Collection(TripleCollector acc) :
          listHead = cell ;
       if ( lastCell != null )
         insert(acc, lastCell, nRDFrest, cell) ;
+      mark = acc.mark() ;
     }
     n = GraphNode(acc)
     {
-      insert(acc, cell, nRDFfirst, n) ;
+      insert(acc, mark, cell, nRDFfirst, n) ;
       lastCell = cell ;
     }
   ) +
@@ -1065,8 +1072,8 @@ Node Collection(TripleCollector acc) :
        insert(acc, lastCell, nRDFrest, nRDFnil) ;
      return listHead ; }
 }
-Node CollectionPath(TripleCollector acc) :
-    { Node listHead = nRDFnil ; Node lastCell = null ; Node n ; Token t ; }
+Node CollectionPath(TripleCollectorMark acc) :
+    { Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; }
 {
   t = <LPAREN>
   { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
@@ -1076,10 +1083,11 @@ Node CollectionPath(TripleCollector acc)
          listHead = cell ;
       if ( lastCell != null )
         insert(acc, lastCell, nRDFrest, cell) ;
+      mark = acc.mark() ;
     }
     n = GraphNodePath(acc)
     {
-      insert(acc, cell, nRDFfirst, n) ;
+      insert(acc, mark, cell, nRDFfirst, n) ;
       lastCell = cell ;
     }
   ) +
@@ -1090,13 +1098,13 @@ Node CollectionPath(TripleCollector acc)
      return listHead ; }
 }
 // -------- Nodes in a graph pattern or template
-Node GraphNode(TripleCollector acc) : { Node n ; }
+Node GraphNode(TripleCollectorMark acc) : { Node n ; }
 {
   n = VarOrTerm() { return n ; }
  |
   n = TriplesNode(acc) { return n ; }
 }
-Node GraphNodePath(TripleCollector acc) : { Node n ; }
+Node GraphNodePath(TripleCollectorMark acc) : { Node n ; }
 {
   n = VarOrTerm() { return n ; }
  |

Modified: jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/ParserBase.java
URL: http://svn.apache.org/viewvc/jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/ParserBase.java?rev=1440789&r1=1440788&r2=1440789&view=diff
==============================================================================
--- jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/ParserBase.java (original)
+++ jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/ParserBase.java Thu Jan 31 02:01:05 2013
@@ -35,6 +35,7 @@ import com.hp.hpl.jena.query.ARQ ;
 import com.hp.hpl.jena.query.QueryParseException ;
 import com.hp.hpl.jena.sparql.ARQInternalErrorException ;
 import com.hp.hpl.jena.sparql.core.Prologue ;
+import com.hp.hpl.jena.sparql.core.Quad ;
 import com.hp.hpl.jena.sparql.core.TriplePath ;
 import com.hp.hpl.jena.sparql.core.Var ;
 import com.hp.hpl.jena.sparql.expr.E_Exists ;
@@ -45,7 +46,9 @@ import com.hp.hpl.jena.sparql.modify.req
 import com.hp.hpl.jena.sparql.path.Path ;
 import com.hp.hpl.jena.sparql.syntax.Element ;
 import com.hp.hpl.jena.sparql.syntax.ElementGroup ;
+import com.hp.hpl.jena.sparql.syntax.ElementPathBlock ;
 import com.hp.hpl.jena.sparql.syntax.TripleCollector ;
+import com.hp.hpl.jena.sparql.syntax.TripleCollectorMark ;
 import com.hp.hpl.jena.sparql.util.ExprUtils ;
 import com.hp.hpl.jena.sparql.util.LabelToNodeMap ;
 import com.hp.hpl.jena.vocabulary.RDF ;
@@ -377,6 +380,11 @@ public class ParserBase
         acc.addTriple(new Triple(s, p, o)) ;
     }
     
+    protected void insert(TripleCollectorMark acc, int index, Node s, Node p, Node o)
+    {
+        acc.addTriple(index, new Triple(s, p, o)) ;
+    }
+    
     protected void insert(TripleCollector acc, Node s, Node p, Path path, Node o)
     {
         if ( p == null )
@@ -384,6 +392,29 @@ public class ParserBase
         else
             acc.addTriple(new Triple(s, p, o)) ;
     }
+    
+    protected void insert(TripleCollectorMark acc, int index, Node s, Node p, Path path, Node o)
+    {
+        if ( p == null )
+            acc.addTriplePath(index, new TriplePath(s, path, o)) ;
+        else
+            acc.addTriple(index, new Triple(s, p, o)) ;
+    }
+    
+    protected void insert(TripleCollector target, ElementPathBlock source)
+    {
+        for (TriplePath path : source.getPattern())
+        {
+            if (path.isTriple())
+            {
+                target.addTriple(path.asTriple());
+            }
+            else
+            {
+                target.addTriplePath(path);
+            }
+        }
+    }
 
     protected Expr asExpr(Node n)
     {

Modified: jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/arq/ARQParser.java
URL: http://svn.apache.org/viewvc/jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/arq/ARQParser.java?rev=1440789&r1=1440788&r2=1440789&view=diff
==============================================================================
--- jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/arq/ARQParser.java (original)
+++ jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/arq/ARQParser.java Thu Jan 31 02:01:05 2013
@@ -2822,9 +2822,10 @@ public class ARQParser extends ARQParser
       break;
     case LPAREN:
     case LBRACKET:
-      // Any of the triple generating syntax elements
-        s = TriplesNode(acc);
-      PropertyList(s, acc);
+    ElementPathBlock tempAcc = new ElementPathBlock() ;
+      s = TriplesNode(tempAcc);
+      PropertyList(s, tempAcc);
+    insert(acc, tempAcc) ;
       break;
     default:
       jj_la1[89] = jj_gen;
@@ -2924,8 +2925,9 @@ public class ARQParser extends ARQParser
 
   final public void Object(Node s, Node p, Path path, TripleCollector acc) throws ParseException {
                                                                Node o ;
-    o = GraphNode(acc);
-    insert(acc, s, p, path, o) ;
+    ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ;
+    o = GraphNode(tempAcc);
+    insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ;
   }
 
 // -------- BGPs with paths.
@@ -2961,9 +2963,10 @@ public class ARQParser extends ARQParser
       break;
     case LPAREN:
     case LBRACKET:
-      // Any of the triple generating syntax elements
-        s = TriplesNodePath(acc);
-      PropertyListPath(s, acc);
+    ElementPathBlock tempAcc = new ElementPathBlock() ;
+      s = TriplesNodePath(tempAcc);
+      PropertyListPath(s, tempAcc);
+    insert(acc, tempAcc) ;
       break;
     default:
       jj_la1[95] = jj_gen;
@@ -3111,8 +3114,9 @@ public class ARQParser extends ARQParser
 
   final public void ObjectPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException {
                                                                    Node o ;
-    o = GraphNodePath(acc);
-    insert(acc, s, p, path, o) ;
+    ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ;
+    o = GraphNodePath(tempAcc);
+    insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ;
   }
 
 // End paths stuff.
@@ -3472,8 +3476,8 @@ public class ARQParser extends ARQParser
 // -------- Triple expansions
 // Anything that can stand in a node slot and which is
 // a number of triples
-  final public Node TriplesNode(TripleCollector acc) throws ParseException {
-                                          Node n ;
+  final public Node TriplesNode(TripleCollectorMark acc) throws ParseException {
+                                              Node n ;
     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
     case LPAREN:
       n = Collection(acc);
@@ -3501,8 +3505,8 @@ public class ARQParser extends ARQParser
     throw new Error("Missing return statement in function");
   }
 
-  final public Node TriplesNodePath(TripleCollector acc) throws ParseException {
-                                              Node n ;
+  final public Node TriplesNodePath(TripleCollectorMark acc) throws ParseException {
+                                                  Node n ;
     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
     case LPAREN:
       n = CollectionPath(acc);
@@ -3531,8 +3535,8 @@ public class ARQParser extends ARQParser
   }
 
 // ------- RDF collections
-  final public Node Collection(TripleCollector acc) throws ParseException {
-      Node listHead = nRDFnil ; Node lastCell = null ; Node n ; Token t ;
+  final public Node Collection(TripleCollectorMark acc) throws ParseException {
+      Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ;
     t = jj_consume_token(LPAREN);
     int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null;
     label_32:
@@ -3542,8 +3546,9 @@ public class ARQParser extends ARQParser
          listHead = cell ;
       if ( lastCell != null )
         insert(acc, lastCell, nRDFrest, cell) ;
+      mark = acc.mark() ;
       n = GraphNode(acc);
-      insert(acc, cell, nRDFfirst, n) ;
+      insert(acc, mark, cell, nRDFfirst, n) ;
       lastCell = cell ;
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case IRIref:
@@ -3585,8 +3590,8 @@ public class ARQParser extends ARQParser
     throw new Error("Missing return statement in function");
   }
 
-  final public Node CollectionPath(TripleCollector acc) throws ParseException {
-      Node listHead = nRDFnil ; Node lastCell = null ; Node n ; Token t ;
+  final public Node CollectionPath(TripleCollectorMark acc) throws ParseException {
+      Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ;
     t = jj_consume_token(LPAREN);
     int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null;
     label_33:
@@ -3596,8 +3601,9 @@ public class ARQParser extends ARQParser
          listHead = cell ;
       if ( lastCell != null )
         insert(acc, lastCell, nRDFrest, cell) ;
+      mark = acc.mark() ;
       n = GraphNodePath(acc);
-      insert(acc, cell, nRDFfirst, n) ;
+      insert(acc, mark, cell, nRDFfirst, n) ;
       lastCell = cell ;
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case IRIref:
@@ -3640,8 +3646,8 @@ public class ARQParser extends ARQParser
   }
 
 // -------- Nodes in a graph pattern or template
-  final public Node GraphNode(TripleCollector acc) throws ParseException {
-                                        Node n ;
+  final public Node GraphNode(TripleCollectorMark acc) throws ParseException {
+                                            Node n ;
     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
     case IRIref:
     case PNAME_NS:
@@ -3682,8 +3688,8 @@ public class ARQParser extends ARQParser
     throw new Error("Missing return statement in function");
   }
 
-  final public Node GraphNodePath(TripleCollector acc) throws ParseException {
-                                            Node n ;
+  final public Node GraphNodePath(TripleCollectorMark acc) throws ParseException {
+                                                Node n ;
     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
     case IRIref:
     case PNAME_NS:
@@ -5447,9 +5453,9 @@ public class ARQParser extends ARQParser
     finally { jj_save(4, xla); }
   }
 
-  private boolean jj_3R_111() {
-    if (jj_scan_token(NOT)) return true;
+  private boolean jj_3R_110() {
     if (jj_scan_token(EXISTS)) return true;
+    if (jj_3R_124()) return true;
     return false;
   }
 
@@ -5458,12 +5464,6 @@ public class ARQParser extends ARQParser
     return false;
   }
 
-  private boolean jj_3R_110() {
-    if (jj_scan_token(EXISTS)) return true;
-    if (jj_3R_124()) return true;
-    return false;
-  }
-
   private boolean jj_3R_130() {
     if (jj_3R_135()) return true;
     return false;
@@ -5496,17 +5496,17 @@ public class ARQParser extends ARQParser
     return false;
   }
 
-  private boolean jj_3_1() {
-    if (jj_3R_40()) return true;
-    return false;
-  }
-
   private boolean jj_3R_109() {
     if (jj_scan_token(REGEX)) return true;
     if (jj_scan_token(LPAREN)) return true;
     return false;
   }
 
+  private boolean jj_3_1() {
+    if (jj_3R_40()) return true;
+    return false;
+  }
+
   private boolean jj_3R_131() {
     if (jj_scan_token(IRIref)) return true;
     return false;
@@ -5559,11 +5559,6 @@ public class ARQParser extends ARQParser
     return false;
   }
 
-  private boolean jj_3R_102() {
-    if (jj_3R_115()) return true;
-    return false;
-  }
-
   private boolean jj_3R_94() {
     if (jj_scan_token(IS_BLANK)) return true;
     if (jj_scan_token(LPAREN)) return true;
@@ -5581,21 +5576,6 @@ public class ARQParser extends ARQParser
     return false;
   }
 
-  private boolean jj_3R_42() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_101()) {
-    jj_scanpos = xsp;
-    if (jj_3R_102()) return true;
-    }
-    return false;
-  }
-
-  private boolean jj_3R_101() {
-    if (jj_3R_114()) return true;
-    return false;
-  }
-
   private boolean jj_3R_165() {
     if (jj_scan_token(PNAME_LN)) return true;
     return false;
@@ -5623,9 +5603,8 @@ public class ARQParser extends ARQParser
     return false;
   }
 
-  private boolean jj_3_4() {
-    if (jj_scan_token(DOT)) return true;
-    if (jj_3R_42()) return true;
+  private boolean jj_3R_102() {
+    if (jj_3R_115()) return true;
     return false;
   }
 
@@ -5646,6 +5625,21 @@ public class ARQParser extends ARQParser
     return false;
   }
 
+  private boolean jj_3R_42() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_101()) {
+    jj_scanpos = xsp;
+    if (jj_3R_102()) return true;
+    }
+    return false;
+  }
+
+  private boolean jj_3R_101() {
+    if (jj_3R_114()) return true;
+    return false;
+  }
+
   private boolean jj_3R_147() {
     if (jj_3R_131()) return true;
     return false;
@@ -5661,21 +5655,15 @@ public class ARQParser extends ARQParser
     return false;
   }
 
-  private boolean jj_3R_113() {
-    if (jj_3R_126()) return true;
-    return false;
-  }
-
   private boolean jj_3R_88() {
     if (jj_scan_token(IF)) return true;
     if (jj_scan_token(LPAREN)) return true;
     return false;
   }
 
-  private boolean jj_3R_126() {
-    if (jj_scan_token(PREFIX)) return true;
-    if (jj_scan_token(PNAME_NS)) return true;
-    if (jj_3R_131()) return true;
+  private boolean jj_3_4() {
+    if (jj_scan_token(DOT)) return true;
+    if (jj_3R_42()) return true;
     return false;
   }
 
@@ -5689,6 +5677,11 @@ public class ARQParser extends ARQParser
     return false;
   }
 
+  private boolean jj_3R_113() {
+    if (jj_3R_126()) return true;
+    return false;
+  }
+
   private boolean jj_3R_159() {
     if (jj_scan_token(STRING_LITERAL2)) return true;
     return false;
@@ -5705,12 +5698,6 @@ public class ARQParser extends ARQParser
     return false;
   }
 
-  private boolean jj_3R_125() {
-    if (jj_scan_token(BASE)) return true;
-    if (jj_3R_131()) return true;
-    return false;
-  }
-
   private boolean jj_3R_149() {
     Token xsp;
     xsp = jj_scanpos;
@@ -5727,27 +5714,10 @@ public class ARQParser extends ARQParser
     return false;
   }
 
-  private boolean jj_3R_112() {
-    if (jj_3R_125()) return true;
-    return false;
-  }
-
-  private boolean jj_3R_100() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_112()) {
-    jj_scanpos = xsp;
-    if (jj_3R_113()) return true;
-    }
-    return false;
-  }
-
-  private boolean jj_3R_41() {
-    Token xsp;
-    while (true) {
-      xsp = jj_scanpos;
-      if (jj_3R_100()) { jj_scanpos = xsp; break; }
-    }
+  private boolean jj_3R_126() {
+    if (jj_scan_token(PREFIX)) return true;
+    if (jj_scan_token(PNAME_NS)) return true;
+    if (jj_3R_131()) return true;
     return false;
   }
 
@@ -5789,14 +5759,15 @@ public class ARQParser extends ARQParser
     return false;
   }
 
-  private boolean jj_3R_123() {
+  private boolean jj_3R_83() {
+    if (jj_scan_token(SHA384)) return true;
     if (jj_scan_token(LPAREN)) return true;
     return false;
   }
 
-  private boolean jj_3R_83() {
-    if (jj_scan_token(SHA384)) return true;
-    if (jj_scan_token(LPAREN)) return true;
+  private boolean jj_3R_125() {
+    if (jj_scan_token(BASE)) return true;
+    if (jj_3R_131()) return true;
     return false;
   }
 
@@ -5812,6 +5783,21 @@ public class ARQParser extends ARQParser
     return false;
   }
 
+  private boolean jj_3R_112() {
+    if (jj_3R_125()) return true;
+    return false;
+  }
+
+  private boolean jj_3R_100() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_112()) {
+    jj_scanpos = xsp;
+    if (jj_3R_113()) return true;
+    }
+    return false;
+  }
+
   private boolean jj_3R_80() {
     if (jj_scan_token(MD5)) return true;
     if (jj_scan_token(LPAREN)) return true;
@@ -5834,12 +5820,11 @@ public class ARQParser extends ARQParser
     return false;
   }
 
-  private boolean jj_3R_106() {
+  private boolean jj_3R_41() {
     Token xsp;
-    xsp = jj_scanpos;
-    if (jj_scan_token(165)) {
-    jj_scanpos = xsp;
-    if (jj_3R_123()) return true;
+    while (true) {
+      xsp = jj_scanpos;
+      if (jj_3R_100()) { jj_scanpos = xsp; break; }
     }
     return false;
   }
@@ -5885,6 +5870,11 @@ public class ARQParser extends ARQParser
     return false;
   }
 
+  private boolean jj_3R_123() {
+    if (jj_scan_token(LPAREN)) return true;
+    return false;
+  }
+
   private boolean jj_3R_75() {
     if (jj_scan_token(TIMEZONE)) return true;
     if (jj_scan_token(LPAREN)) return true;
@@ -5990,6 +5980,16 @@ public class ARQParser extends ARQParser
     return false;
   }
 
+  private boolean jj_3R_106() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_scan_token(165)) {
+    jj_scanpos = xsp;
+    if (jj_3R_123()) return true;
+    }
+    return false;
+  }
+
   private boolean jj_3R_70() {
     if (jj_scan_token(MONTH)) return true;
     if (jj_scan_token(LPAREN)) return true;
@@ -6472,11 +6472,6 @@ public class ARQParser extends ARQParser
     return false;
   }
 
-  private boolean jj_3R_124() {
-    if (jj_scan_token(LBRACE)) return true;
-    return false;
-  }
-
   private boolean jj_3R_117() {
     if (jj_scan_token(SUM)) return true;
     if (jj_scan_token(LPAREN)) return true;
@@ -6488,18 +6483,48 @@ public class ARQParser extends ARQParser
     return false;
   }
 
-  private boolean jj_3_3() {
-    if (jj_scan_token(DOT)) return true;
-    if (jj_3R_42()) return true;
-    return false;
-  }
-
   private boolean jj_3R_116() {
     if (jj_scan_token(COUNT)) return true;
     if (jj_scan_token(LPAREN)) return true;
     return false;
   }
 
+  private boolean jj_3R_124() {
+    if (jj_scan_token(LBRACE)) return true;
+    return false;
+  }
+
+  private boolean jj_3R_103() {
+    Token xsp;
+    xsp = jj_scanpos;
+    if (jj_3R_116()) {
+    jj_scanpos = xsp;
+    if (jj_3R_117()) {
+    jj_scanpos = xsp;
+    if (jj_3R_118()) {
+    jj_scanpos = xsp;
+    if (jj_3R_119()) {
+    jj_scanpos = xsp;
+    if (jj_3R_120()) {
+    jj_scanpos = xsp;
+    if (jj_3R_121()) {
+    jj_scanpos = xsp;
+    if (jj_3R_122()) return true;
+    }
+    }
+    }
+    }
+    }
+    }
+    return false;
+  }
+
+  private boolean jj_3_3() {
+    if (jj_scan_token(DOT)) return true;
+    if (jj_3R_42()) return true;
+    return false;
+  }
+
   private boolean jj_3_2() {
     if (jj_scan_token(SEMICOLON)) return true;
     if (jj_3R_41()) return true;
@@ -6548,28 +6573,9 @@ public class ARQParser extends ARQParser
     return false;
   }
 
-  private boolean jj_3R_103() {
-    Token xsp;
-    xsp = jj_scanpos;
-    if (jj_3R_116()) {
-    jj_scanpos = xsp;
-    if (jj_3R_117()) {
-    jj_scanpos = xsp;
-    if (jj_3R_118()) {
-    jj_scanpos = xsp;
-    if (jj_3R_119()) {
-    jj_scanpos = xsp;
-    if (jj_3R_120()) {
-    jj_scanpos = xsp;
-    if (jj_3R_121()) {
-    jj_scanpos = xsp;
-    if (jj_3R_122()) return true;
-    }
-    }
-    }
-    }
-    }
-    }
+  private boolean jj_3R_111() {
+    if (jj_scan_token(NOT)) return true;
+    if (jj_scan_token(EXISTS)) return true;
     return false;
   }
 

Modified: jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/sparql_11/SPARQLParser11.java
URL: http://svn.apache.org/viewvc/jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/sparql_11/SPARQLParser11.java?rev=1440789&r1=1440788&r2=1440789&view=diff
==============================================================================
--- jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/sparql_11/SPARQLParser11.java (original)
+++ jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/sparql_11/SPARQLParser11.java Thu Jan 31 02:01:05 2013
@@ -2509,9 +2509,10 @@ public class SPARQLParser11 extends SPAR
       break;
     case LPAREN:
     case LBRACKET:
-      // Any of the triple generating syntax elements
-        s = TriplesNode(acc);
-      PropertyList(s, acc);
+    ElementPathBlock tempAcc = new ElementPathBlock() ;
+      s = TriplesNode(tempAcc);
+      PropertyList(s, tempAcc);
+    insert(acc, tempAcc) ;
       break;
     default:
       jj_la1[89] = jj_gen;
@@ -2611,8 +2612,9 @@ public class SPARQLParser11 extends SPAR
 
   final public void Object(Node s, Node p, Path path, TripleCollector acc) throws ParseException {
                                                                Node o ;
-    o = GraphNode(acc);
-    insert(acc, s, p, path, o) ;
+    ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ;
+    o = GraphNode(tempAcc);
+    insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ;
   }
 
 // -------- BGPs with paths.
@@ -2648,9 +2650,10 @@ public class SPARQLParser11 extends SPAR
       break;
     case LPAREN:
     case LBRACKET:
-      // Any of the triple generating syntax elements
-        s = TriplesNodePath(acc);
-      PropertyListPath(s, acc);
+    ElementPathBlock tempAcc = new ElementPathBlock() ;
+      s = TriplesNodePath(tempAcc);
+      PropertyListPath(s, tempAcc);
+    insert(acc, tempAcc) ;
       break;
     default:
       jj_la1[95] = jj_gen;
@@ -2786,8 +2789,9 @@ public class SPARQLParser11 extends SPAR
 
   final public void ObjectPath(Node s, Node p, Path path, TripleCollector acc) throws ParseException {
                                                                    Node o ;
-    o = GraphNodePath(acc);
-    insert(acc, s, p, path, o) ;
+    ElementPathBlock tempAcc = new ElementPathBlock() ; int mark = tempAcc.mark() ;
+    o = GraphNodePath(tempAcc);
+    insert(tempAcc, mark, s, p, path, o) ; insert(acc, tempAcc) ;
   }
 
 // End paths stuff.
@@ -3042,8 +3046,8 @@ public class SPARQLParser11 extends SPAR
 // -------- Triple expansions
 // Anything that can stand in a node slot and which is
 // a number of triples
-  final public Node TriplesNode(TripleCollector acc) throws ParseException {
-                                          Node n ;
+  final public Node TriplesNode(TripleCollectorMark acc) throws ParseException {
+                                              Node n ;
     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
     case LPAREN:
       n = Collection(acc);
@@ -3071,8 +3075,8 @@ public class SPARQLParser11 extends SPAR
     throw new Error("Missing return statement in function");
   }
 
-  final public Node TriplesNodePath(TripleCollector acc) throws ParseException {
-                                              Node n ;
+  final public Node TriplesNodePath(TripleCollectorMark acc) throws ParseException {
+                                                  Node n ;
     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
     case LPAREN:
       n = CollectionPath(acc);
@@ -3101,8 +3105,8 @@ public class SPARQLParser11 extends SPAR
   }
 
 // ------- RDF collections
-  final public Node Collection(TripleCollector acc) throws ParseException {
-      Node listHead = nRDFnil ; Node lastCell = null ; Node n ; Token t ;
+  final public Node Collection(TripleCollectorMark acc) throws ParseException {
+      Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ;
     t = jj_consume_token(LPAREN);
     int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null;
     label_29:
@@ -3112,8 +3116,9 @@ public class SPARQLParser11 extends SPAR
          listHead = cell ;
       if ( lastCell != null )
         insert(acc, lastCell, nRDFrest, cell) ;
+      mark = acc.mark() ;
       n = GraphNode(acc);
-      insert(acc, cell, nRDFfirst, n) ;
+      insert(acc, mark, cell, nRDFfirst, n) ;
       lastCell = cell ;
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case IRIref:
@@ -3155,8 +3160,8 @@ public class SPARQLParser11 extends SPAR
     throw new Error("Missing return statement in function");
   }
 
-  final public Node CollectionPath(TripleCollector acc) throws ParseException {
-      Node listHead = nRDFnil ; Node lastCell = null ; Node n ; Token t ;
+  final public Node CollectionPath(TripleCollectorMark acc) throws ParseException {
+      Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ;
     t = jj_consume_token(LPAREN);
     int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null;
     label_30:
@@ -3166,8 +3171,9 @@ public class SPARQLParser11 extends SPAR
          listHead = cell ;
       if ( lastCell != null )
         insert(acc, lastCell, nRDFrest, cell) ;
+      mark = acc.mark() ;
       n = GraphNodePath(acc);
-      insert(acc, cell, nRDFfirst, n) ;
+      insert(acc, mark, cell, nRDFfirst, n) ;
       lastCell = cell ;
       switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
       case IRIref:
@@ -3210,8 +3216,8 @@ public class SPARQLParser11 extends SPAR
   }
 
 // -------- Nodes in a graph pattern or template
-  final public Node GraphNode(TripleCollector acc) throws ParseException {
-                                        Node n ;
+  final public Node GraphNode(TripleCollectorMark acc) throws ParseException {
+                                            Node n ;
     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
     case IRIref:
     case PNAME_NS:
@@ -3252,8 +3258,8 @@ public class SPARQLParser11 extends SPAR
     throw new Error("Missing return statement in function");
   }
 
-  final public Node GraphNodePath(TripleCollector acc) throws ParseException {
-                                            Node n ;
+  final public Node GraphNodePath(TripleCollectorMark acc) throws ParseException {
+                                                Node n ;
     switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
     case IRIref:
     case PNAME_NS:

Modified: jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/request/QuadDataAcc.java
URL: http://svn.apache.org/viewvc/jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/request/QuadDataAcc.java?rev=1440789&r1=1440788&r2=1440789&view=diff
==============================================================================
--- jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/request/QuadDataAcc.java (original)
+++ jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/request/QuadDataAcc.java Thu Jan 31 02:01:05 2013
@@ -24,10 +24,13 @@ import java.util.List ;
 
 import org.apache.jena.atlas.lib.SinkToCollection ;
 
+import com.hp.hpl.jena.graph.Triple ;
 import com.hp.hpl.jena.sparql.core.Quad ;
+import com.hp.hpl.jena.sparql.core.TriplePath ;
+import com.hp.hpl.jena.sparql.syntax.TripleCollectorMark ;
 
 /** Accumulate quads (excluding allowing variables) during parsing. */
-public class QuadDataAcc extends QuadDataAccSink
+public class QuadDataAcc extends QuadDataAccSink implements TripleCollectorMark
 {
     private final List<Quad> quads ;
     private final List<Quad> quadsView ;
@@ -59,4 +62,23 @@ public class QuadDataAcc extends QuadDat
         QuadDataAcc acc = (QuadDataAcc)other ;
         return quads.equals(acc.quads) ; 
     }
+
+    @Override
+    public int mark()
+    {
+        return quads.size() ;
+    }
+
+    @Override
+    public void addTriple(int index, Triple triple)
+    {
+        check(triple) ;
+        quads.add(index, new Quad(graphNode, triple)) ;
+    }
+
+    @Override
+    public void addTriplePath(int index, TriplePath tPath)
+    {
+        throw new UnsupportedOperationException("Can't add paths to quads") ;
+    }
 }

Modified: jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/syntax/ElementPathBlock.java
URL: http://svn.apache.org/viewvc/jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/syntax/ElementPathBlock.java?rev=1440789&r1=1440788&r2=1440789&view=diff
==============================================================================
--- jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/syntax/ElementPathBlock.java (original)
+++ jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/syntax/ElementPathBlock.java Thu Jan 31 02:01:05 2013
@@ -28,7 +28,7 @@ import com.hp.hpl.jena.sparql.util.NodeI
 
 /** A SPARQL BasicGraphPattern */
 
-public class ElementPathBlock extends Element implements TripleCollector
+public class ElementPathBlock extends Element implements TripleCollectorMark
 {
     private PathBlock pattern = new PathBlock() ; 
 
@@ -47,12 +47,23 @@ public class ElementPathBlock extends El
     { pattern.add(tp) ; }
     
     @Override
+    public int mark() { return pattern.size() ; }
+    
+    @Override
     public void addTriple(Triple t)
     { addTriplePath(new TriplePath(t)) ; }
 
     @Override
+    public void addTriple(int index, Triple t)
+    { addTriplePath(index, new TriplePath(t)) ; }
+
+    @Override
     public void addTriplePath(TriplePath tPath)
     { pattern.add(tPath) ; }
+
+    @Override
+    public void addTriplePath(int index, TriplePath tPath)
+    { pattern.add(index, tPath) ; }
     
     public PathBlock getPattern() { return pattern ; }
     public Iterator<TriplePath> patternElts() { return pattern.iterator(); }

Added: jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/syntax/TripleCollectorMark.java
URL: http://svn.apache.org/viewvc/jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/syntax/TripleCollectorMark.java?rev=1440789&view=auto
==============================================================================
--- jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/syntax/TripleCollectorMark.java (added)
+++ jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/syntax/TripleCollectorMark.java Thu Jan 31 02:01:05 2013
@@ -0,0 +1,34 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.hp.hpl.jena.sparql.syntax;
+
+import com.hp.hpl.jena.graph.Triple ;
+import com.hp.hpl.jena.sparql.core.TriplePath ;
+
+
+public interface TripleCollectorMark extends TripleCollector
+{
+    // The contract with the mark is that there should be no disturbing
+    // triples 0..(mark-1) before using a mark. That is, use marks in
+    // LIFO (stack) order.
+    public int mark() ;
+    public void addTriple(int index, Triple t) ;
+    
+    public void addTriplePath(int index, TriplePath tPath) ;
+}