jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sal...@apache.org
Subject svn commit: r1440841 [1/3] - in /jena/trunk: ./ jena-arq/ jena-arq/Grammar/ jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/ jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/arq/ jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/sparql_10/ jena-a...
Date Thu, 31 Jan 2013 04:14:49 GMT
Author: sallen
Date: Thu Jan 31 04:14:48 2013
New Revision: 1440841

URL: http://svn.apache.org/viewvc?rev=1440841&view=rev
Log:
JENA-330 : Streaming support for SPARQL Update queries and streaming support for quads in INSERT DATA / DELETE DATA queries; and 
JENA-309 : If supported by the underlying storage engine, Fuseki can exploit transactions in order to stream SPARQL Update requests

Added:
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/AbstractUpdateSink.java
      - copied unchanged from r1440838, jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/AbstractUpdateSink.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineStreaming.java
      - copied unchanged from r1440838, jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineStreaming.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateProcessorStreamingBase.java
      - copied unchanged from r1440838, jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateProcessorStreamingBase.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateRequestSink.java
      - copied unchanged from r1440838, jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateRequestSink.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateSink.java
      - copied unchanged from r1440838, jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateSink.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateVisitorSink.java
      - copied unchanged from r1440838, jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateVisitorSink.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UsingList.java
      - copied unchanged from r1440838, jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UsingList.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/request/QuadAccSink.java
      - copied unchanged from r1440838, jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/request/QuadAccSink.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/request/QuadDataAccSink.java
      - copied unchanged from r1440838, jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/request/QuadDataAccSink.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/syntax/TripleCollectorMark.java
      - copied unchanged from r1440838, jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/sparql/syntax/TripleCollectorMark.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/update/UpdateProcessorStreaming.java
      - copied unchanged from r1440838, jena/branches/streaming-update/jena-arq/src/main/java/com/hp/hpl/jena/update/UpdateProcessorStreaming.java
Modified:
    jena/trunk/   (props changed)
    jena/trunk/jena-arq/Grammar/arq.jj
    jena/trunk/jena-arq/Grammar/master.jj
    jena/trunk/jena-arq/Grammar/sparql_11.jj
    jena/trunk/jena-arq/ReleaseNotes.txt
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/ParserARQUpdate.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/ParserBase.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/ParserSPARQL11Update.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/SPARQLParserBase.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/UpdateParser.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/arq/ARQParser.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/sparql_10/SPARQLParser10.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/sparql_11/SPARQLParser11.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineBase.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineFactory.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineMain.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineRegistry.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/UpdateEngineWorker.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/request/QuadAcc.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/request/QuadDataAcc.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/request/UpdateVisitor.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/request/UpdateWriter.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/syntax/ElementPathBlock.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/syntax/ElementTriplesBlock.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/syntax/TripleCollector.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/syntax/TripleCollectorBGP.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/update/UpdateAction.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/update/UpdateExecutionFactory.java
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/update/UpdateFactory.java
    jena/trunk/jena-core/   (props changed)
    jena/trunk/jena-fuseki/ReleaseNotes.txt
    jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/HttpAction.java
    jena/trunk/jena-fuseki/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Update.java
    jena/trunk/jena-tdb/src/main/java/com/hp/hpl/jena/tdb/modify/UpdateEngineTDB.java

Propchange: jena/trunk/
------------------------------------------------------------------------------
    svn:mergeinfo = /jena/branches/streaming-update:1415418-1440838

Modified: jena/trunk/jena-arq/Grammar/arq.jj
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/Grammar/arq.jj?rev=1440841&r1=1440840&r2=1440841&view=diff
==============================================================================
--- jena/trunk/jena-arq/Grammar/arq.jj (original)
+++ jena/trunk/jena-arq/Grammar/arq.jj Thu Jan 31 04:14:48 2013
@@ -357,13 +357,28 @@ void ValuesClause() : { Token t ; }
 }
 // SPARQL Update + transitional extensions for SPARQL/Update (the W3C submission)
 // Update only entry point
-// Optional SEMICOLON
 void Update() : { }
 {
-   Prologue()
-   ( Update1() (<SEMICOLON>)* Update())?
+  // Rewrite for no recursion - grammar is not LL(1)
+  Prologue()
+  (
+    Update1()
+    (
+      // This syntactic lookahead is necessitated by the optional trailing semicolon and prologue
+      LOOKAHEAD( <SEMICOLON> Prologue() ( <LOAD> | <CLEAR> | <DROP> | <ADD> |
+                   <MOVE> | <COPY> | <CREATE> | <WITH> | <DELETE> | <INSERT> |
+                   <USING> | <INSERT_DATA> | <DELETE_DATA> | <DELETE_WHERE> ) )
+      <SEMICOLON>
+      Prologue()
+      Update1()
+    )*
+    (
+      <SEMICOLON>
+      Prologue()
+    )?
+  )?
 }
-void Update1() : { Update up ; }
+void Update1() : { Update up = null ; }
 {
   { startUpdateOperation() ; }
   ( up = Load()
@@ -373,13 +388,13 @@ void Update1() : { Update up ; }
   | up = Move()
   | up = Copy()
   | up = Create()
-  | up = InsertData()
-  | up = DeleteData()
   | up = DeleteWhere()
   | up = Modify()
+  | InsertData()
+  | DeleteData()
   )
   {
-    emitUpdate(up) ;
+    if (null != up) emitUpdate(up) ;
     finishUpdateOperation() ;
   }
 }
@@ -421,38 +436,41 @@ Update Copy() : { Target src ; Target de
   { return new UpdateCopy(src, dest, silent) ; }
 }
 // #ifdef ARQ
-// void Meta() : { QuadDataAcc qd = new QuadDataAcc() ; }
+// void Meta() : { QuadDataAccSink qd = new QuadDataAccSink() ; }
 // {
 //    <META> 
 //    QuadData(qd)
 // }
 // #endif
-Update InsertData() : { QuadDataAcc qd = new QuadDataAcc() ; Token t ; }
+void InsertData() : { QuadDataAccSink qd = getInsertDataSink() ; Token t ; }
 {
   t = <INSERT_DATA>
-  { startDataInsert(qd, t.beginLine, t.beginColumn) ; }
+  { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
+  { startDataInsert(qd, beginLine, beginColumn) ; }
    QuadData(qd)
   {
-    finishDataInsert(qd, t.beginLine, t.beginColumn) ;
-    return new UpdateDataInsert(qd) ;
+    finishDataInsert(qd, beginLine, beginColumn) ;
+    qd.close() ;
   }
 }
-Update DeleteData() : { QuadDataAcc qd = new QuadDataAcc() ; Token t ; }
+void DeleteData() : { QuadDataAccSink qd = getDeleteDataSink() ; Token t ; }
 {
   t = <DELETE_DATA>
-  { startDataDelete(qd, t.beginLine, t.beginColumn) ; }
+  { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
+  { startDataDelete(qd, beginLine, beginColumn) ; }
   QuadData(qd)
   {
-    finishDataDelete(qd, t.beginLine, t.beginColumn) ;
-    return new UpdateDataDelete(qd) ;
+    finishDataDelete(qd, beginLine, beginColumn) ;
+    qd.close() ;
   }
 }
 Update DeleteWhere() : { QuadAcc qp = new QuadAcc() ; Token t ; }
 {
   t = <DELETE_WHERE>
-  { startDeleteTemplate(qp, t.beginLine, t.beginColumn) ; }
+  { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
+  { startDeleteTemplate(qp, beginLine, beginColumn) ; }
   QuadPattern(qp)
-  { finishDeleteTemplate(qp, t.beginLine, t.beginColumn) ; }
+  { finishDeleteTemplate(qp, beginLine, beginColumn) ; }
   { return new UpdateDeleteWhere(qp) ; }
 }
 Update Modify() : { Element el ; String iri = null ;
@@ -475,17 +493,19 @@ Update Modify() : { Element el ; String 
 void DeleteClause(UpdateModify up) : { QuadAcc qp = up.getDeleteAcc() ; Token t ;}
 {
    t = <DELETE>
-   { startDeleteTemplate(qp, t.beginLine, t.beginColumn) ; }
+   { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
+   { startDeleteTemplate(qp, beginLine, beginColumn) ; }
    QuadPattern(qp)
-   { finishDeleteTemplate(qp, t.beginLine, t.beginColumn) ; }
+   { finishDeleteTemplate(qp, beginLine, beginColumn) ; }
    { up.setHasDeleteClause(true) ; }
 }
 void InsertClause(UpdateModify up) : { QuadAcc qp = up.getInsertAcc() ; Token t ; }
 {
    t = <INSERT>
-   { startInsertTemplate(qp, t.beginLine, t.beginColumn) ; }
+   { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
+   { startInsertTemplate(qp, beginLine, beginColumn) ; }
    QuadPattern(qp)
-   { finishInsertTemplate(qp, t.beginLine, t.beginColumn) ; }
+   { finishInsertTemplate(qp, beginLine, beginColumn) ; }
    { up.setHasInsertClause(true) ; }
 }
 void UsingClause(UpdateWithUsing update) : { String iri ; Node n ; }
@@ -526,13 +546,13 @@ void QuadPattern(QuadAcc acc) : { }
     <RBRACE>
 }
 //Ground data : As QuadPattern but don't allow variables.
-void QuadData(QuadDataAcc acc) : { }
+void QuadData(QuadDataAccSink acc) : { }
 {
     <LBRACE>
     Quads(acc)
     <RBRACE>
 }
-void Quads(QuadAcc acc) : { }
+void Quads(QuadAccSink acc) : { }
 {
    (TriplesTemplate(acc))?
    (
@@ -541,7 +561,7 @@ void Quads(QuadAcc acc) : { }
      (TriplesTemplate(acc))?
    )*
 }
-void QuadsNotTriples(QuadAcc acc) : {Node gn ; Node prev = acc.getGraph() ; }
+void QuadsNotTriples(QuadAccSink acc) : {Node gn ; Node prev = acc.getGraph() ; }
 {
     <GRAPH> gn = VarOrIri()
     { setAccGraph(acc, gn) ; }
@@ -561,11 +581,12 @@ void TriplesTemplate(TripleCollector acc
 Element GroupGraphPattern() : { Element el = null ; Token t ; }
 {
   t = <LBRACE>
+  { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
   (
-    { startSubSelect(t.beginLine, t.beginColumn) ; }
+    { startSubSelect(beginLine, beginColumn) ; }
     SubSelect()
     {
-      Query q = endSubSelect(t.beginLine, t.beginColumn) ;
+      Query q = endSubSelect(beginLine, beginColumn) ;
       el = new ElementSubQuery(q) ;
     }
   | el = GroupGraphPatternSub()
@@ -674,10 +695,11 @@ Element Bind() : { Var v ; Expr expr ; }
 Element InlineData() : { ElementData el ; Token t ; }
 {
   t = <VALUES>
+  { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
   { el = new ElementData() ;
-    startInlineData(el.getVars(), el.getRows(), t.beginLine, t.beginColumn) ; }
+    startInlineData(el.getVars(), el.getRows(), beginLine, beginColumn) ; }
   DataBlock()
-  { finishInlineData(t.beginLine, t.beginColumn) ;
+  { finishInlineData(beginLine, beginColumn) ;
     return el ; }
 }
 void DataBlock() : { }
@@ -698,30 +720,33 @@ void InlineDataOneVar() : { Var v ; Node
   )*
   t = <RBRACE>
 }
-void InlineDataFull() : { Var v ; Node n ; Token t ; }
+void InlineDataFull() : { Var v ; Node n ; Token t ; int beginLine; int beginColumn; }
 {
   (
      <NIL>
   |
-    t = <LPAREN>
+    <LPAREN>
     (v = Var() { emitDataBlockVariable(v) ; })*
-    t = <RPAREN>
+    <RPAREN>
   )
-  t = <LBRACE>
+  <LBRACE>
   (
     t = <LPAREN>
-    { startDataBlockValueRow(t.beginLine, t.beginColumn) ; }
+    { beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; }
+    { startDataBlockValueRow(beginLine, beginColumn) ; }
     (n = DataBlockValue()
-        { emitDataBlockValue(n, t.beginLine, t.beginColumn) ; }
+        { emitDataBlockValue(n, beginLine, beginColumn) ; }
     ) *
     t = <RPAREN>
-      { finishDataBlockValueRow(t.beginLine, t.beginColumn) ; }
+    { beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; }
+      { finishDataBlockValueRow(beginLine, beginColumn) ; }
   |
     t = <NIL>
-      { startDataBlockValueRow(t.beginLine, t.beginColumn) ; }
-      { finishDataBlockValueRow(t.beginLine, t.beginColumn) ; }
+    { beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; }
+      { startDataBlockValueRow(beginLine, beginColumn) ; }
+      { finishDataBlockValueRow(beginLine, beginColumn) ; }
    )*
-  t = <RBRACE>
+  <RBRACE>
 }
 Node DataBlockValue() : { Node n ; String iri ; }
 {
@@ -812,10 +837,11 @@ ExprList ArgList() : { Expr expr ; boole
   |
     <LPAREN>
       (t = <DISTINCT> { distinct = true ; }
+      { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
         {
           if ( ! allowAggregatesInExpressions )
               throwParseException("Aggregate expression not legal at this point",
-                                 t.beginLine, t.beginColumn) ;
+                                 beginLine, beginColumn) ;
         }
       )?
       expr = Expression() { args.add(expr) ; }
@@ -862,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) : { }
 {
@@ -895,9 +923,9 @@ void ObjectList(Node s, Node p, Path pat
 }
 void Object(Node s, Node p, Path path, TripleCollector acc): { Node o ; }
 {
-    { int mark = acc.mark() ; }
-  o = GraphNode(acc)
-  { insert(acc, mark, 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
@@ -907,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) : { }
 {
@@ -949,9 +979,9 @@ void ObjectListPath(Node s, Node p, Path
 }
 void ObjectPath(Node s, Node p, Path path, TripleCollector acc): { Node o ; }
 {
-    { int mark = acc.mark() ; }
-  o = GraphNodePath(acc)
-  { insert(acc, mark, 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
@@ -1094,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 ; }
  |
@@ -1108,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 ; }
  |
@@ -1123,12 +1153,13 @@ Node BlankNodePropertyListPath(TripleCol
     { return n ; }
 }
 // ------- RDF collections
-Node Collection(TripleCollector acc) :
+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; }
   (
-    { Node cell = createListNode( t.beginLine, t.beginColumn) ;
+    { Node cell = createListNode( beginLine, beginColumn) ;
       if ( listHead == nRDFnil )
          listHead = cell ;
       if ( lastCell != null )
@@ -1147,12 +1178,13 @@ Node Collection(TripleCollector acc) :
        insert(acc, lastCell, nRDFrest, nRDFnil) ;
      return listHead ; }
 }
-Node CollectionPath(TripleCollector acc) :
+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; }
   (
-    { Node cell = createListNode( t.beginLine, t.beginColumn) ;
+    { Node cell = createListNode( beginLine, beginColumn) ;
       if ( listHead == nRDFnil )
          listHead = cell ;
       if ( lastCell != null )
@@ -1172,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 ; }
  |
@@ -1343,7 +1375,7 @@ Expr BrackettedExpression() : { Expr exp
     <LPAREN> expr = Expression() <RPAREN> { return expr ; }
 }
 Expr BuiltInCall() : { Expr expr ; Expr expr1 = null ; Expr expr2 = null ;
-                       Node gn ; Token t ; ExprList a ; }
+                       Node gn ; ExprList a ; }
 {
     expr = Aggregate() { return expr ; }
   |
@@ -1430,9 +1462,9 @@ Expr BuiltInCall() : { Expr expr ; Expr 
     { return new E_StrDatatype(expr1, expr2) ; }
   | <SAME_TERM> <LPAREN> expr1 = Expression() <COMMA> expr2 = Expression() <RPAREN>
     { return new E_SameTerm(expr1, expr2) ; }
-  | t = <IS_IRI> <LPAREN> expr = Expression() <RPAREN>
+  | <IS_IRI> <LPAREN> expr = Expression() <RPAREN>
     { return new E_IsIRI(expr) ; }
-  | t = <IS_URI> <LPAREN> expr = Expression() <RPAREN>
+  | <IS_URI> <LPAREN> expr = Expression() <RPAREN>
     { return new E_IsURI(expr) ; }
   | <IS_BLANK> <LPAREN> expr = Expression() <RPAREN>
     { return new E_IsBlank(expr) ; }

Modified: jena/trunk/jena-arq/Grammar/master.jj
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/Grammar/master.jj?rev=1440841&r1=1440840&r2=1440841&view=diff
==============================================================================
--- jena/trunk/jena-arq/Grammar/master.jj (original)
+++ jena/trunk/jena-arq/Grammar/master.jj Thu Jan 31 04:14:48 2013
@@ -444,22 +444,38 @@ void ValuesClause() : { Token t ; }
 // Update only entry point
 
 #ifdef ARQ
-// Optional SEMICOLON
 void Update() : { }
 {
-   Prologue()
-   ( Update1() (<SEMICOLON>)*  Update())?
+  // Rewrite for no recursion - grammar is not LL(1)
+  Prologue()
+  (
+    Update1()
+    (
+      // This syntactic lookahead is necessitated by the optional trailing semicolon and prologue
+      LOOKAHEAD( <SEMICOLON> Prologue() ( <LOAD> | <CLEAR> | <DROP> | <ADD> |
+                   <MOVE> | <COPY> | <CREATE> | <WITH> | <DELETE> | <INSERT> |
+                   <USING> | <INSERT_DATA> | <DELETE_DATA> | <DELETE_WHERE> ) )
+      <SEMICOLON>
+      Prologue()
+      Update1()
+    )*
+    (
+      <SEMICOLON>
+      Prologue()
+    )?
+  )?
 }
 #else
 // Strict SPARQL 1.1 : mandatory separator, optional terminator.
 void Update() : { }
-{  
+{
+   // SPARQL - recursion - does not scale for large number of updates in a single request
    Prologue()
    (Update1() ( <SEMICOLON> Update() )? )?
 }
 #endif
 
-void Update1() : { Update up ; }
+void Update1() : { Update up = null ; }
 {
   { startUpdateOperation() ; }
   ( up = Load()
@@ -469,13 +485,13 @@ void Update1() : { Update up ; }
   | up = Move()
   | up = Copy()
   | up = Create()
-  | up = InsertData()
-  | up = DeleteData()
   | up = DeleteWhere()
   | up = Modify()
+  | InsertData()
+  | DeleteData()
   )
   {
-    emitUpdate(up) ;
+    if (null != up) emitUpdate(up) ;
     finishUpdateOperation() ;
   }
 }
@@ -525,41 +541,44 @@ Update Copy() : { Target src ; Target de
 }
 
 // #ifdef ARQ
-// void Meta() : { QuadDataAcc qd = new QuadDataAcc() ; }
+// void Meta() : { QuadDataAccSink qd = new QuadDataAccSink() ; }
 // {
 //    <META> 
 //    QuadData(qd)
 // }
 // #endif
 
-Update InsertData() : { QuadDataAcc qd = new QuadDataAcc() ; Token t ; }
+void InsertData() : { QuadDataAccSink qd = getInsertDataSink() ; Token t ; }
 {
   t =  <INSERT_DATA>
-  { startDataInsert(qd, t.beginLine, t.beginColumn) ; }
+  { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
+  { startDataInsert(qd, beginLine, beginColumn) ; }
    QuadData(qd)
   {
-    finishDataInsert(qd, t.beginLine, t.beginColumn) ;
-    return new UpdateDataInsert(qd) ; 
+    finishDataInsert(qd, beginLine, beginColumn) ;
+    qd.close() ;
   }
 }
 
-Update DeleteData() : { QuadDataAcc qd = new QuadDataAcc() ; Token t ; }
+void DeleteData() : { QuadDataAccSink qd = getDeleteDataSink() ; Token t ; }
 {
   t = <DELETE_DATA>
-  { startDataDelete(qd, t.beginLine, t.beginColumn) ; }
+  { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
+  { startDataDelete(qd, beginLine, beginColumn) ; }
   QuadData(qd)
   { 
-    finishDataDelete(qd, t.beginLine, t.beginColumn) ;
-    return new UpdateDataDelete(qd) ;
+    finishDataDelete(qd, beginLine, beginColumn) ;
+    qd.close() ;
   }
 }
 
 Update DeleteWhere() : { QuadAcc qp = new QuadAcc() ;  Token t ; }
 {
-  t = <DELETE_WHERE> 
-  { startDeleteTemplate(qp, t.beginLine, t.beginColumn) ; }
+  t = <DELETE_WHERE>
+  { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
+  { startDeleteTemplate(qp, beginLine, beginColumn) ; }
   QuadPattern(qp)
-  { finishDeleteTemplate(qp, t.beginLine, t.beginColumn) ; }
+  { finishDeleteTemplate(qp, beginLine, beginColumn) ; }
   { return new UpdateDeleteWhere(qp) ; }
 }
 
@@ -584,18 +603,20 @@ Update Modify() : { Element el ; String 
 void DeleteClause(UpdateModify up) : { QuadAcc qp = up.getDeleteAcc() ;  Token t ;}
 {
    t = <DELETE>
-   { startDeleteTemplate(qp, t.beginLine, t.beginColumn) ; }
+   { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
+   { startDeleteTemplate(qp, beginLine, beginColumn) ; }
    QuadPattern(qp)
-   { finishDeleteTemplate(qp, t.beginLine, t.beginColumn) ; }
+   { finishDeleteTemplate(qp, beginLine, beginColumn) ; }
    { up.setHasDeleteClause(true) ; }
 }
 
 void InsertClause(UpdateModify up) : { QuadAcc qp = up.getInsertAcc() ; Token t ; }
 {
    t = <INSERT>
-   { startInsertTemplate(qp, t.beginLine, t.beginColumn) ; }
+   { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
+   { startInsertTemplate(qp, beginLine, beginColumn) ; }
    QuadPattern(qp)
-   { finishInsertTemplate(qp, t.beginLine, t.beginColumn) ; }
+   { finishInsertTemplate(qp, beginLine, beginColumn) ; }
    { up.setHasInsertClause(true) ; }
 }
 
@@ -642,14 +663,14 @@ void QuadPattern(QuadAcc acc) : { }
 }
 
 //Ground data : As QuadPattern but don't allow variables.
-void QuadData(QuadDataAcc acc) : { }
+void QuadData(QuadDataAccSink acc) : { }
 {
     <LBRACE>
     Quads(acc)
     <RBRACE>
 }
 
-void Quads(QuadAcc acc) : { }
+void Quads(QuadAccSink acc) : { }
 {
    (TriplesTemplate(acc))?
    (
@@ -659,7 +680,7 @@ void Quads(QuadAcc acc) : { }
    )*
 }
 
-void QuadsNotTriples(QuadAcc acc) : {Node gn ; Node prev = acc.getGraph() ; }
+void QuadsNotTriples(QuadAccSink acc) : {Node gn ; Node prev = acc.getGraph() ; }
 {
     <GRAPH> gn = VarOrIri()
     { setAccGraph(acc, gn) ; }
@@ -692,11 +713,12 @@ void TriplesTemplate(TripleCollector acc
 Element GroupGraphPattern() : { Element el = null ; Token t ; }
 {
   t = <LBRACE>
+  { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
   ( 
-    { startSubSelect(t.beginLine, t.beginColumn) ; }
+    { startSubSelect(beginLine, beginColumn) ; }
     SubSelect()
     { 
-      Query q = endSubSelect(t.beginLine, t.beginColumn) ;
+      Query q = endSubSelect(beginLine, beginColumn) ;
       el = new ElementSubQuery(q) ;
     }
   | el = GroupGraphPatternSub()
@@ -824,10 +846,11 @@ Element Bind() : {  Var v ; Expr expr ; 
 Element InlineData() : { ElementData el ; Token t ; }
 {
   t = <VALUES>
+  { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
   { el = new ElementData() ;
-    startInlineData(el.getVars(), el.getRows(), t.beginLine, t.beginColumn) ; }
+    startInlineData(el.getVars(), el.getRows(), beginLine, beginColumn) ; }
   DataBlock()
-  { finishInlineData(t.beginLine, t.beginColumn) ;
+  { finishInlineData(beginLine, beginColumn) ;
     return el ; }
 }
 
@@ -851,30 +874,33 @@ void InlineDataOneVar() : { Var v ; Node
   t = <RBRACE>
 }  
   
-void InlineDataFull() : { Var v ; Node n ; Token t ; }
+void InlineDataFull() : { Var v ; Node n ; Token t ; int beginLine; int beginColumn; }
 {
   (
      <NIL>
   |
-    t = <LPAREN>
+    <LPAREN>
     (v = Var() { emitDataBlockVariable(v) ; })*
-    t = <RPAREN>
+    <RPAREN>
   )
-  t = <LBRACE>
+  <LBRACE>
   (
-    t = <LPAREN> 
-    { startDataBlockValueRow(t.beginLine, t.beginColumn) ; }
+    t = <LPAREN>
+    { beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; }
+    { startDataBlockValueRow(beginLine, beginColumn) ; }
     (n = DataBlockValue() 
-        { emitDataBlockValue(n, t.beginLine, t.beginColumn) ; }
+        { emitDataBlockValue(n, beginLine, beginColumn) ; }
     ) *
-    t = <RPAREN> 
-      { finishDataBlockValueRow(t.beginLine, t.beginColumn) ; }
+    t = <RPAREN>
+    { beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; }
+      { finishDataBlockValueRow(beginLine, beginColumn) ; }
   |
     t = <NIL>
-      { startDataBlockValueRow(t.beginLine, t.beginColumn) ; }
-      { finishDataBlockValueRow(t.beginLine, t.beginColumn) ; }
+    { beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; }
+      { startDataBlockValueRow(beginLine, beginColumn) ; }
+      { finishDataBlockValueRow(beginLine, beginColumn) ; }
    )*
-  t = <RBRACE>
+  <RBRACE>
 }  
 
 Node DataBlockValue() : { Node n ; String iri ; }
@@ -992,10 +1018,11 @@ ExprList ArgList() : { Expr expr ; boole
   |
     <LPAREN>
       (t = <DISTINCT> { distinct = true ; }
+      { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
         {
           if ( ! allowAggregatesInExpressions )
               throwParseException("Aggregate expression not legal at this point",
-                                 t.beginLine, t.beginColumn) ;
+                                 beginLine, beginColumn) ;
         }
       )?
       expr = Expression() { args.add(expr) ; } 
@@ -1057,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) : { }
@@ -1095,9 +1124,9 @@ void ObjectList(Node s,  Node p, Path pa
 
 void Object(Node s, Node p, Path path, TripleCollector acc): { Node o ; }
 {
-    { int mark = acc.mark() ; }
-  o = GraphNode(acc) 
-  { insert(acc, mark, 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.
@@ -1109,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) ; }
 }
 
 
@@ -1163,9 +1194,9 @@ void ObjectListPath(Node s,  Node p, Pat
 
 void ObjectPath(Node s, Node p, Path path, TripleCollector acc): { Node o ; }
 {
-    { int mark = acc.mark() ; }
-  o = GraphNodePath(acc) 
-  { insert(acc, mark, 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) ; }
 }
 
 
@@ -1334,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 ; }
  |
@@ -1354,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 ; }
  |
@@ -1375,14 +1406,15 @@ Node BlankNodePropertyListPath(TripleCol
 }
 
 #if 0
-Node Reification(Node id, TripleCollector acc) : 
+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)
-  t = "<<" 
+  t = "<<"
+    { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
     { if ( id == null )
-        id = createBNode(t.beginLine, t.beginColumn() ;
+        id = createBNode(beginLine, beginColumn() ;
       mark = acc.mark() ; }
   s = GraphNode(acc)
     { insert(acc, mark, id, nRDFsubject, s) ;
@@ -1401,12 +1433,13 @@ Node Reification(Node id, TripleCollecto
 
 // ------- RDF collections
 
-Node Collection(TripleCollector acc) : 
+Node Collection(TripleCollectorMark acc) : 
     { Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; }
 {
-  t = <LPAREN> 
+  t = <LPAREN>
+  { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
   (
-    { Node cell = createListNode( t.beginLine, t.beginColumn) ;
+    { Node cell = createListNode( beginLine, beginColumn) ;
       if ( listHead == nRDFnil )
          listHead = cell ;
       if ( lastCell != null )
@@ -1426,12 +1459,13 @@ Node Collection(TripleCollector acc) : 
      return listHead ; }
 }
 
-Node CollectionPath(TripleCollector acc) : 
+Node CollectionPath(TripleCollectorMark acc) : 
     { Node listHead = nRDFnil ; Node lastCell = null ; int mark ; Node n ; Token t ; }
 {
-  t = <LPAREN> 
+  t = <LPAREN>
+  { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
   (
-    { Node cell = createListNode( t.beginLine, t.beginColumn) ;
+    { Node cell = createListNode( beginLine, beginColumn) ;
       if ( listHead == nRDFnil )
          listHead = cell ;
       if ( lastCell != null )
@@ -1453,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 ; }
  |
@@ -1647,7 +1681,7 @@ Expr BrackettedExpression() : { Expr exp
 }
 
 Expr BuiltInCall() : { Expr expr ; Expr expr1 = null ; Expr expr2 = null ;
-                       Node gn ; Token t ; ExprList a ; }
+                       Node gn ; ExprList a ; }
 {
     expr = Aggregate() { return expr ; }
   |
@@ -1785,10 +1819,10 @@ Expr BuiltInCall() : { Expr expr ; Expr 
   | <SAME_TERM> <LPAREN> expr1 = Expression() <COMMA> expr2 = Expression() <RPAREN>
     { return new E_SameTerm(expr1, expr2) ; }
 
-  | t = <IS_IRI> <LPAREN> expr = Expression() <RPAREN>
+  | <IS_IRI> <LPAREN> expr = Expression() <RPAREN>
     { return new E_IsIRI(expr) ; }
 
-  | t = <IS_URI> <LPAREN> expr = Expression() <RPAREN>
+  | <IS_URI> <LPAREN> expr = Expression() <RPAREN>
     { return new E_IsURI(expr) ; }
 
   | <IS_BLANK> <LPAREN> expr = Expression() <RPAREN>

Modified: jena/trunk/jena-arq/Grammar/sparql_11.jj
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/Grammar/sparql_11.jj?rev=1440841&r1=1440840&r2=1440841&view=diff
==============================================================================
--- jena/trunk/jena-arq/Grammar/sparql_11.jj (original)
+++ jena/trunk/jena-arq/Grammar/sparql_11.jj Thu Jan 31 04:14:48 2013
@@ -347,10 +347,11 @@ void ValuesClause() : { Token t ; }
 // Strict SPARQL 1.1 : mandatory separator, optional terminator.
 void Update() : { }
 {
+   // SPARQL - recursion - does not scale for large number of updates in a single request
    Prologue()
    (Update1() ( <SEMICOLON> Update() )? )?
 }
-void Update1() : { Update up ; }
+void Update1() : { Update up = null ; }
 {
   { startUpdateOperation() ; }
   ( up = Load()
@@ -360,13 +361,13 @@ void Update1() : { Update up ; }
   | up = Move()
   | up = Copy()
   | up = Create()
-  | up = InsertData()
-  | up = DeleteData()
   | up = DeleteWhere()
   | up = Modify()
+  | InsertData()
+  | DeleteData()
   )
   {
-    emitUpdate(up) ;
+    if (null != up) emitUpdate(up) ;
     finishUpdateOperation() ;
   }
 }
@@ -408,38 +409,41 @@ Update Copy() : { Target src ; Target de
   { return new UpdateCopy(src, dest, silent) ; }
 }
 // #ifdef ARQ
-// void Meta() : { QuadDataAcc qd = new QuadDataAcc() ; }
+// void Meta() : { QuadDataAccSink qd = new QuadDataAccSink() ; }
 // {
 //    <META> 
 //    QuadData(qd)
 // }
 // #endif
-Update InsertData() : { QuadDataAcc qd = new QuadDataAcc() ; Token t ; }
+void InsertData() : { QuadDataAccSink qd = getInsertDataSink() ; Token t ; }
 {
   t = <INSERT_DATA>
-  { startDataInsert(qd, t.beginLine, t.beginColumn) ; }
+  { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
+  { startDataInsert(qd, beginLine, beginColumn) ; }
    QuadData(qd)
   {
-    finishDataInsert(qd, t.beginLine, t.beginColumn) ;
-    return new UpdateDataInsert(qd) ;
+    finishDataInsert(qd, beginLine, beginColumn) ;
+    qd.close() ;
   }
 }
-Update DeleteData() : { QuadDataAcc qd = new QuadDataAcc() ; Token t ; }
+void DeleteData() : { QuadDataAccSink qd = getDeleteDataSink() ; Token t ; }
 {
   t = <DELETE_DATA>
-  { startDataDelete(qd, t.beginLine, t.beginColumn) ; }
+  { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
+  { startDataDelete(qd, beginLine, beginColumn) ; }
   QuadData(qd)
   {
-    finishDataDelete(qd, t.beginLine, t.beginColumn) ;
-    return new UpdateDataDelete(qd) ;
+    finishDataDelete(qd, beginLine, beginColumn) ;
+    qd.close() ;
   }
 }
 Update DeleteWhere() : { QuadAcc qp = new QuadAcc() ; Token t ; }
 {
   t = <DELETE_WHERE>
-  { startDeleteTemplate(qp, t.beginLine, t.beginColumn) ; }
+  { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
+  { startDeleteTemplate(qp, beginLine, beginColumn) ; }
   QuadPattern(qp)
-  { finishDeleteTemplate(qp, t.beginLine, t.beginColumn) ; }
+  { finishDeleteTemplate(qp, beginLine, beginColumn) ; }
   { return new UpdateDeleteWhere(qp) ; }
 }
 Update Modify() : { Element el ; String iri = null ;
@@ -462,17 +466,19 @@ Update Modify() : { Element el ; String 
 void DeleteClause(UpdateModify up) : { QuadAcc qp = up.getDeleteAcc() ; Token t ;}
 {
    t = <DELETE>
-   { startDeleteTemplate(qp, t.beginLine, t.beginColumn) ; }
+   { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
+   { startDeleteTemplate(qp, beginLine, beginColumn) ; }
    QuadPattern(qp)
-   { finishDeleteTemplate(qp, t.beginLine, t.beginColumn) ; }
+   { finishDeleteTemplate(qp, beginLine, beginColumn) ; }
    { up.setHasDeleteClause(true) ; }
 }
 void InsertClause(UpdateModify up) : { QuadAcc qp = up.getInsertAcc() ; Token t ; }
 {
    t = <INSERT>
-   { startInsertTemplate(qp, t.beginLine, t.beginColumn) ; }
+   { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
+   { startInsertTemplate(qp, beginLine, beginColumn) ; }
    QuadPattern(qp)
-   { finishInsertTemplate(qp, t.beginLine, t.beginColumn) ; }
+   { finishInsertTemplate(qp, beginLine, beginColumn) ; }
    { up.setHasInsertClause(true) ; }
 }
 void UsingClause(UpdateWithUsing update) : { String iri ; Node n ; }
@@ -513,13 +519,13 @@ void QuadPattern(QuadAcc acc) : { }
     <RBRACE>
 }
 //Ground data : As QuadPattern but don't allow variables.
-void QuadData(QuadDataAcc acc) : { }
+void QuadData(QuadDataAccSink acc) : { }
 {
     <LBRACE>
     Quads(acc)
     <RBRACE>
 }
-void Quads(QuadAcc acc) : { }
+void Quads(QuadAccSink acc) : { }
 {
    (TriplesTemplate(acc))?
    (
@@ -528,7 +534,7 @@ void Quads(QuadAcc acc) : { }
      (TriplesTemplate(acc))?
    )*
 }
-void QuadsNotTriples(QuadAcc acc) : {Node gn ; Node prev = acc.getGraph() ; }
+void QuadsNotTriples(QuadAccSink acc) : {Node gn ; Node prev = acc.getGraph() ; }
 {
     <GRAPH> gn = VarOrIri()
     { setAccGraph(acc, gn) ; }
@@ -547,11 +553,12 @@ void TriplesTemplate(TripleCollector acc
 Element GroupGraphPattern() : { Element el = null ; Token t ; }
 {
   t = <LBRACE>
+  { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
   (
-    { startSubSelect(t.beginLine, t.beginColumn) ; }
+    { startSubSelect(beginLine, beginColumn) ; }
     SubSelect()
     {
-      Query q = endSubSelect(t.beginLine, t.beginColumn) ;
+      Query q = endSubSelect(beginLine, beginColumn) ;
       el = new ElementSubQuery(q) ;
     }
   | el = GroupGraphPatternSub()
@@ -654,10 +661,11 @@ Element Bind() : { Var v ; Expr expr ; }
 Element InlineData() : { ElementData el ; Token t ; }
 {
   t = <VALUES>
+  { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
   { el = new ElementData() ;
-    startInlineData(el.getVars(), el.getRows(), t.beginLine, t.beginColumn) ; }
+    startInlineData(el.getVars(), el.getRows(), beginLine, beginColumn) ; }
   DataBlock()
-  { finishInlineData(t.beginLine, t.beginColumn) ;
+  { finishInlineData(beginLine, beginColumn) ;
     return el ; }
 }
 void DataBlock() : { }
@@ -678,30 +686,33 @@ void InlineDataOneVar() : { Var v ; Node
   )*
   t = <RBRACE>
 }
-void InlineDataFull() : { Var v ; Node n ; Token t ; }
+void InlineDataFull() : { Var v ; Node n ; Token t ; int beginLine; int beginColumn; }
 {
   (
      <NIL>
   |
-    t = <LPAREN>
+    <LPAREN>
     (v = Var() { emitDataBlockVariable(v) ; })*
-    t = <RPAREN>
+    <RPAREN>
   )
-  t = <LBRACE>
+  <LBRACE>
   (
     t = <LPAREN>
-    { startDataBlockValueRow(t.beginLine, t.beginColumn) ; }
+    { beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; }
+    { startDataBlockValueRow(beginLine, beginColumn) ; }
     (n = DataBlockValue()
-        { emitDataBlockValue(n, t.beginLine, t.beginColumn) ; }
+        { emitDataBlockValue(n, beginLine, beginColumn) ; }
     ) *
     t = <RPAREN>
-      { finishDataBlockValueRow(t.beginLine, t.beginColumn) ; }
+    { beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; }
+      { finishDataBlockValueRow(beginLine, beginColumn) ; }
   |
     t = <NIL>
-      { startDataBlockValueRow(t.beginLine, t.beginColumn) ; }
-      { finishDataBlockValueRow(t.beginLine, t.beginColumn) ; }
+    { beginLine = t.beginLine; beginColumn = t.beginColumn; t = null; }
+      { startDataBlockValueRow(beginLine, beginColumn) ; }
+      { finishDataBlockValueRow(beginLine, beginColumn) ; }
    )*
-  t = <RBRACE>
+  <RBRACE>
 }
 Node DataBlockValue() : { Node n ; String iri ; }
 {
@@ -770,10 +781,11 @@ ExprList ArgList() : { Expr expr ; boole
   |
     <LPAREN>
       (t = <DISTINCT> { distinct = true ; }
+      { int beginLine = t.beginLine; int beginColumn = t.beginColumn; t = null; }
         {
           if ( ! allowAggregatesInExpressions )
               throwParseException("Aggregate expression not legal at this point",
-                                 t.beginLine, t.beginColumn) ;
+                                 beginLine, beginColumn) ;
         }
       )?
       expr = Expression() { args.add(expr) ; }
@@ -819,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) : { }
 {
@@ -852,9 +866,9 @@ void ObjectList(Node s, Node p, Path pat
 }
 void Object(Node s, Node p, Path path, TripleCollector acc): { Node o ; }
 {
-    { int mark = acc.mark() ; }
-  o = GraphNode(acc)
-  { insert(acc, mark, 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
@@ -864,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) : { }
 {
@@ -906,9 +922,9 @@ void ObjectListPath(Node s, Node p, Path
 }
 void ObjectPath(Node s, Node p, Path path, TripleCollector acc): { Node o ; }
 {
-    { int mark = acc.mark() ; }
-  o = GraphNodePath(acc)
-  { insert(acc, mark, 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
@@ -1002,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 ; }
  |
@@ -1016,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 ; }
  |
@@ -1031,12 +1047,13 @@ Node BlankNodePropertyListPath(TripleCol
     { return n ; }
 }
 // ------- RDF collections
-Node Collection(TripleCollector acc) :
+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; }
   (
-    { Node cell = createListNode( t.beginLine, t.beginColumn) ;
+    { Node cell = createListNode( beginLine, beginColumn) ;
       if ( listHead == nRDFnil )
          listHead = cell ;
       if ( lastCell != null )
@@ -1055,12 +1072,13 @@ Node Collection(TripleCollector acc) :
        insert(acc, lastCell, nRDFrest, nRDFnil) ;
      return listHead ; }
 }
-Node CollectionPath(TripleCollector acc) :
+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; }
   (
-    { Node cell = createListNode( t.beginLine, t.beginColumn) ;
+    { Node cell = createListNode( beginLine, beginColumn) ;
       if ( listHead == nRDFnil )
          listHead = cell ;
       if ( lastCell != null )
@@ -1080,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 ; }
  |
@@ -1247,7 +1265,7 @@ Expr BrackettedExpression() : { Expr exp
     <LPAREN> expr = Expression() <RPAREN> { return expr ; }
 }
 Expr BuiltInCall() : { Expr expr ; Expr expr1 = null ; Expr expr2 = null ;
-                       Node gn ; Token t ; ExprList a ; }
+                       Node gn ; ExprList a ; }
 {
     expr = Aggregate() { return expr ; }
   |
@@ -1322,9 +1340,9 @@ Expr BuiltInCall() : { Expr expr ; Expr 
     { return new E_StrDatatype(expr1, expr2) ; }
   | <SAME_TERM> <LPAREN> expr1 = Expression() <COMMA> expr2 = Expression() <RPAREN>
     { return new E_SameTerm(expr1, expr2) ; }
-  | t = <IS_IRI> <LPAREN> expr = Expression() <RPAREN>
+  | <IS_IRI> <LPAREN> expr = Expression() <RPAREN>
     { return new E_IsIRI(expr) ; }
-  | t = <IS_URI> <LPAREN> expr = Expression() <RPAREN>
+  | <IS_URI> <LPAREN> expr = Expression() <RPAREN>
     { return new E_IsURI(expr) ; }
   | <IS_BLANK> <LPAREN> expr = Expression() <RPAREN>
     { return new E_IsBlank(expr) ; }

Modified: jena/trunk/jena-arq/ReleaseNotes.txt
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/ReleaseNotes.txt?rev=1440841&r1=1440840&r2=1440841&view=diff
==============================================================================
--- jena/trunk/jena-arq/ReleaseNotes.txt (original)
+++ jena/trunk/jena-arq/ReleaseNotes.txt Thu Jan 31 04:14:48 2013
@@ -27,6 +27,7 @@ ChangeLog for ARQ
   Abbreviation performance for common namespace patterns (/ or # terminated) much improved
 + New FastAbbreviatingPrefixMap, can be much faster for abbreviation when namespaces
   do not follow common patterns
++ JENA-330 : Streaming support for SPARQL Update queries and streaming support for quads in INSERT DATA / DELETE DATA queries
 
 ==== ARQ 2.9.4
 

Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/ParserARQUpdate.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/ParserARQUpdate.java?rev=1440841&r1=1440840&r2=1440841&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/ParserARQUpdate.java (original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/ParserARQUpdate.java Thu Jan 31 04:14:48 2013
@@ -23,47 +23,44 @@ import java.io.Reader ;
 import java.io.StringReader ;
 
 import org.apache.jena.atlas.io.PeekReader ;
-import org.apache.jena.atlas.logging.Log ;
 import org.slf4j.LoggerFactory ;
 
 import com.hp.hpl.jena.query.QueryException ;
 import com.hp.hpl.jena.query.QueryParseException ;
 import com.hp.hpl.jena.shared.JenaException ;
 import com.hp.hpl.jena.sparql.lang.arq.ARQParser ;
-import com.hp.hpl.jena.update.UpdateRequest ;
+import com.hp.hpl.jena.sparql.modify.UpdateSink ;
 
 public class ParserARQUpdate extends UpdateParser
 {
     @Override
-    protected UpdateRequest parse$(UpdateRequest update, String queryString)
+    protected void parse$(UpdateSink sink, String queryString)
     {
         Reader r = new StringReader(queryString) ;
-        return _parse(update, r) ;
+        _parse(sink, r) ;
     }
     
     @Override
-    protected UpdateRequest parse$(UpdateRequest update, PeekReader pr)
+    protected void parse$(UpdateSink sink, PeekReader pr)
     {
-        return _parse(update, pr) ;
+        _parse(sink, pr) ;
     }
 
     /** Use with care - Reader must be UTF-8 */ 
-    public UpdateRequest parse(UpdateRequest update, Reader r)
+    public void parse(UpdateSink sink, Reader r)
     {
         if ( r instanceof FileReader )
             LoggerFactory.getLogger(this.getClass()).warn("FileReader passed to ParserSPARQLUpdate.parse - use a FileInputStream") ;
-        return _parse(update, r) ;
+        _parse(sink, r) ;
     }
     
-    private UpdateRequest _parse(UpdateRequest update, Reader r)
+    private void _parse(UpdateSink sink, Reader r)
     {
         ARQParser parser = null ;
         try {
             parser = new ARQParser(r) ;
-            parser.setUpdateRequest(update) ;
+            parser.setUpdateSink(sink) ;
             parser.UpdateUnit() ;
-            validateParsedUpdate(update) ;
-            return update ;
         }
         catch (com.hp.hpl.jena.sparql.lang.arq.ParseException ex)
         { 
@@ -80,16 +77,16 @@ public class ParserARQUpdate extends Upd
 
         catch (QueryException ex) { throw ex ; }
         catch (JenaException ex)  { throw new QueryException(ex.getMessage(), ex) ; }
-        catch (Error err)
-        {
-            // The token stream can throw errors.
-            throw new QueryParseException(err.getMessage(), err, -1, -1) ;
-        }
-        catch (Throwable th)
-        {
-            Log.fatal(this, "Unexpected throwable: ",th) ;
-            throw new QueryException(th.getMessage(), th) ;
-        }
+//        catch (Error err)
+//        {
+//            // The token stream can throw errors.
+//            throw new QueryParseException(err.getMessage(), err, -1, -1) ;
+//        }
+//        catch (Throwable th)
+//        {
+//            Log.fatal(this, "Unexpected throwable: ",th) ;
+//            throw new QueryException(th.getMessage(), th) ;
+//        }
     }
 
 

Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/ParserBase.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/ParserBase.java?rev=1440841&r1=1440840&r2=1440841&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/ParserBase.java (original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/ParserBase.java Thu Jan 31 04:14:48 2013
@@ -35,17 +35,20 @@ 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 ;
 import com.hp.hpl.jena.sparql.expr.E_NotExists ;
 import com.hp.hpl.jena.sparql.expr.Expr ;
 import com.hp.hpl.jena.sparql.graph.NodeConst ;
-import com.hp.hpl.jena.sparql.modify.request.QuadAcc ;
+import com.hp.hpl.jena.sparql.modify.request.QuadAccSink ;
 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 ;
@@ -367,7 +370,7 @@ public class ParserBase
         return prefix ; 
     }
     
-    protected void setAccGraph(QuadAcc acc, Node gn)
+    protected void setAccGraph(QuadAccSink acc, Node gn)
     {
         acc.setGraph(gn) ;
     }
@@ -377,7 +380,7 @@ public class ParserBase
         acc.addTriple(new Triple(s, p, o)) ;
     }
     
-    protected void insert(TripleCollector acc, int index, Node s, Node p, Node o)
+    protected void insert(TripleCollectorMark acc, int index, Node s, Node p, Node o)
     {
         acc.addTriple(index, new Triple(s, p, o)) ;
     }
@@ -390,13 +393,28 @@ public class ParserBase
             acc.addTriple(new Triple(s, p, o)) ;
     }
     
-    protected void insert(TripleCollector acc, int index, Node s, Node p, Path path, Node 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/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/ParserSPARQL11Update.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/ParserSPARQL11Update.java?rev=1440841&r1=1440840&r2=1440841&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/ParserSPARQL11Update.java (original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/ParserSPARQL11Update.java Thu Jan 31 04:14:48 2013
@@ -31,49 +31,47 @@ import com.hp.hpl.jena.query.QueryExcept
 import com.hp.hpl.jena.query.QueryParseException ;
 import com.hp.hpl.jena.shared.JenaException ;
 import com.hp.hpl.jena.sparql.lang.sparql_11.SPARQLParser11 ;
+import com.hp.hpl.jena.sparql.modify.UpdateSink ;
 import com.hp.hpl.jena.update.UpdateException ;
-import com.hp.hpl.jena.update.UpdateRequest ;
 import com.hp.hpl.jena.util.FileUtils ;
 
 
 public class ParserSPARQL11Update extends UpdateParser
 {
     @Override
-    protected UpdateRequest parse$(UpdateRequest update, String updateString)
+    protected void parse$(UpdateSink sink, String updateString)
     {
         Reader r = new StringReader(updateString) ;
-        return _parse(update, r) ;
+        _parse(sink, r) ;
     }
     
     @Override
-    protected UpdateRequest parse$(UpdateRequest update, PeekReader pr)
+    protected void parse$(UpdateSink sink, PeekReader pr)
     {
-        return _parse(update, pr) ;
+        _parse(sink, pr) ;
     }
     
     @Override
-    public UpdateRequest parse(UpdateRequest update, InputStream in)
+    public void parse(UpdateSink sink, InputStream in)
     {
         Reader r = FileUtils.asBufferedUTF8(in) ;
-        return _parse(update, r) ;
+        _parse(sink, r) ;
     }
 
-    public UpdateRequest parse(UpdateRequest update, Reader r)
+    public void parse(UpdateSink sink, Reader r)
     {
         if ( r instanceof FileReader )
             LoggerFactory.getLogger(this.getClass()).warn("FileReader passed to ParserSPARQL11Update.parse - use a FileInputStream") ;
-        return _parse(update, r) ;
+        _parse(sink, r) ;
     }
     
-    private UpdateRequest _parse(UpdateRequest update, Reader r)
+    private void _parse(UpdateSink sink, Reader r)
     {
         SPARQLParser11 parser = null ;
         try {
             parser = new SPARQLParser11(r) ;
-            parser.setUpdateRequest(update) ;
+            parser.setUpdateSink(sink) ;
             parser.UpdateUnit() ;
-            validateParsedUpdate(update) ;
-            return update ;
         }
         catch (com.hp.hpl.jena.sparql.lang.sparql_11.ParseException ex)
         { 

Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/SPARQLParserBase.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/SPARQLParserBase.java?rev=1440841&r1=1440840&r2=1440841&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/SPARQLParserBase.java (original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/SPARQLParserBase.java Thu Jan 31 04:14:48 2013
@@ -18,7 +18,12 @@
 
 package com.hp.hpl.jena.sparql.lang;
 
-import java.util.* ;
+import java.util.ArrayDeque ;
+import java.util.ArrayList ;
+import java.util.Deque ;
+import java.util.HashSet ;
+import java.util.List ;
+import java.util.Set ;
 
 import com.hp.hpl.jena.graph.Node ;
 import com.hp.hpl.jena.query.Query ;
@@ -28,11 +33,11 @@ import com.hp.hpl.jena.sparql.core.Var ;
 import com.hp.hpl.jena.sparql.engine.binding.Binding ;
 import com.hp.hpl.jena.sparql.engine.binding.BindingFactory ;
 import com.hp.hpl.jena.sparql.engine.binding.BindingMap ;
+import com.hp.hpl.jena.sparql.modify.UpdateSink ;
 import com.hp.hpl.jena.sparql.modify.request.QuadAcc ;
-import com.hp.hpl.jena.sparql.modify.request.QuadDataAcc ;
+import com.hp.hpl.jena.sparql.modify.request.QuadDataAccSink ;
 import com.hp.hpl.jena.sparql.util.LabelToNodeMap ;
 import com.hp.hpl.jena.update.Update ;
-import com.hp.hpl.jena.update.UpdateRequest ;
 
 /** Class that has all the parse event operations and other query/update specific things */  
 public class SPARQLParserBase extends ParserBase 
@@ -65,7 +70,7 @@ public class SPARQLParserBase extends Pa
 //    }
 
     // SPARQL Update (W3C RECommendation)
-    private UpdateRequest request = null ;
+    private UpdateSink sink = null ;
 
     // Places to push settings across points where we reset.
     private boolean oldBNodesAreVariables ;
@@ -78,12 +83,12 @@ public class SPARQLParserBase extends Pa
     private Deque<Set<String>>    stackPreviousLabels = new ArrayDeque<Set<String>>() ;
     private Deque<LabelToNodeMap> stackCurrentLabels = new ArrayDeque<LabelToNodeMap>() ;
 
-    protected UpdateRequest getUpdateRequest() { return request ; }
-    public void setUpdateRequest(UpdateRequest request)
+//    protected UpdateSink getUpdateSink() { return sink ; }
+    public void setUpdateSink(UpdateSink sink)
     { 
-        this.request = request ;
+        this.sink = sink ;
         this.query = new Query() ; 
-        setPrologue(request) ;
+        setPrologue(sink.getPrologue()) ;
     }
 
     // Signal start/finish of units
@@ -106,27 +111,27 @@ public class SPARQLParserBase extends Pa
     protected void startModifyUpdate()     { }
     protected void finishModifyUpdate()    { }
     
-    protected void startDataInsert(QuadDataAcc qd, int line, int col) 
+    protected void startDataInsert(QuadDataAccSink qd, int line, int col) 
     {
         oldBNodesAreVariables = getBNodesAreVariables() ;
         setBNodesAreVariables(false) ;
         activeLabelMap.clear() ;
     } 
     
-    protected void finishDataInsert(QuadDataAcc qd, int line, int col)
+    protected void finishDataInsert(QuadDataAccSink qd, int line, int col)
     {
         previousLabels.addAll(activeLabelMap.getLabels()) ;
         activeLabelMap.clear() ;
         setBNodesAreVariables(oldBNodesAreVariables) ;
     }
     
-    protected void startDataDelete(QuadDataAcc qd,int line, int col)
+    protected void startDataDelete(QuadDataAccSink qd,int line, int col)
     {
         oldBNodesAreAllowed = getBNodesAreAllowed() ;
         setBNodesAreAllowed(false) ;
     } 
     
-    protected void finishDataDelete(QuadDataAcc qd, int line, int col)
+    protected void finishDataDelete(QuadDataAccSink qd, int line, int col)
     {
         setBNodesAreAllowed(oldBNodesAreAllowed) ;
     }
@@ -182,7 +187,21 @@ public class SPARQLParserBase extends Pa
     
     protected void emitUpdate(Update update)
     {
-        request.add(update) ;
+        // The parser can send null if it already performed an INSERT_DATA or DELETE_DATA
+        if (null != update)
+        {
+            sink.send(update);
+        }
+    }
+    
+    protected QuadDataAccSink getInsertDataSink()
+    {
+        return sink.getInsertDataSink();
+    }
+    
+    protected QuadDataAccSink getDeleteDataSink()
+    {
+        return sink.getDeleteDataSink();
     }
     
     protected void startSubSelect(int line, int col)

Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/UpdateParser.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/UpdateParser.java?rev=1440841&r1=1440840&r2=1440841&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/UpdateParser.java (original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/lang/UpdateParser.java Thu Jan 31 04:14:48 2013
@@ -24,7 +24,7 @@ import org.apache.jena.atlas.io.PeekRead
 
 import com.hp.hpl.jena.query.QueryParseException ;
 import com.hp.hpl.jena.query.Syntax ;
-import com.hp.hpl.jena.update.UpdateRequest ;
+import com.hp.hpl.jena.sparql.modify.UpdateSink ;
 
 /** This class provides the root of lower level access to all the parsers.
  *  Each subclass hides the details of the per-language exception handlers and other
@@ -34,25 +34,25 @@ import com.hp.hpl.jena.update.UpdateRequ
 
 public abstract class UpdateParser
 {
-    public final UpdateRequest parse(UpdateRequest request, String updateString) throws QueryParseException
+    public final void parse(UpdateSink sink, String updateString) throws QueryParseException
     {
         // Sort out BOM
         if ( updateString.startsWith("\uFEFF") )
             updateString = updateString.substring(1) ;
-        return parse$(request, updateString) ;
+        parse$(sink, updateString) ;
     }
 
-    protected abstract UpdateRequest parse$(UpdateRequest request, String updateString) throws QueryParseException ;
+    protected abstract void parse$(UpdateSink sink, String updateString) throws QueryParseException ;
 
-    public UpdateRequest parse(UpdateRequest request, InputStream input) throws QueryParseException
+    public void parse(UpdateSink sink, InputStream input) throws QueryParseException
     {
         // :-( Wrap in something that we can use to look for a BOM.
         // TODO Move POM processing to grammar and reverse this.
         PeekReader pr = PeekReader.makeUTF8(input) ;
-        return parse$(request, pr) ;
+        parse$(sink, pr) ;
     }
     
-    protected abstract UpdateRequest parse$(UpdateRequest request, PeekReader pr) throws QueryParseException ;
+    protected abstract void parse$(UpdateSink sink, PeekReader pr) throws QueryParseException ;
 
     public static boolean canParse(Syntax syntaxURI)
     {
@@ -63,9 +63,4 @@ public abstract class UpdateParser
     {
         return UpdateParserRegistry.get().createParser(syntaxURI) ;
     }
-
-    // Do any testing of updates after the construction of the parse tree.
-    protected void validateParsedUpdate(UpdateRequest request)
-    {
-    }
 }



Mime
View raw message