jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1431377 - /jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/request/UpdateWriter.java
Date Thu, 10 Jan 2013 14:17:58 GMT
Author: andy
Date: Thu Jan 10 14:17:58 2013
New Revision: 1431377

URL: http://svn.apache.org/viewvc?rev=1431377&view=rev
Log:
JENA-378
The UpdateWriter needs to use a bnode to output mapping that deal with "query bnodes" in the
WHERE clause.
i.e. Map ??N vars to bNode syntax on output.

Modified:
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/request/UpdateWriter.java

Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/request/UpdateWriter.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/request/UpdateWriter.java?rev=1431377&r1=1431376&r2=1431377&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/request/UpdateWriter.java
(original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/modify/request/UpdateWriter.java
Thu Jan 10 14:17:58 2013
@@ -29,6 +29,7 @@ import org.apache.jena.riot.out.SinkQuad
 import com.hp.hpl.jena.graph.Node;
 import com.hp.hpl.jena.graph.Triple;
 import com.hp.hpl.jena.sparql.ARQException;
+import com.hp.hpl.jena.sparql.core.Prologue ;
 import com.hp.hpl.jena.sparql.core.Quad;
 import com.hp.hpl.jena.sparql.modify.request.UpdateDataWriter.UpdateMode;
 import com.hp.hpl.jena.sparql.serializer.FormatterElement;
@@ -36,6 +37,7 @@ import com.hp.hpl.jena.sparql.serializer
 import com.hp.hpl.jena.sparql.serializer.SerializationContext;
 import com.hp.hpl.jena.sparql.syntax.Element;
 import com.hp.hpl.jena.sparql.util.FmtUtils;
+import com.hp.hpl.jena.sparql.util.NodeToLabelMapBNode ;
 import com.hp.hpl.jena.update.Update;
 import com.hp.hpl.jena.update.UpdateRequest;
 
@@ -51,14 +53,12 @@ public class UpdateWriter implements Clo
     public UpdateWriter(IndentedWriter out, SerializationContext sCxt)
     {
         if (out == null)
-        {
             throw new IllegalArgumentException("out may not be null") ;
-        }
         
+        // To get legal syntax out, the serialization context 
+        // has to be a bNode mapping that does ??N vars to bNodes
         if (sCxt == null)
-        {
-            sCxt = new SerializationContext();
-        }
+            sCxt = new SerializationContext((Prologue)null, new NodeToLabelMapBNode());
         
         this.out = out;
         this.sCxt = sCxt;
@@ -67,18 +67,14 @@ public class UpdateWriter implements Clo
     public void open()
     {
         if (null != sCxt)
-        {
             prologue();
-        }
         opened = true;
     }
     
     private void checkOpen()
     {
         if (!opened)
-        {
             throw new IllegalStateException("UpdateStreamWriter is not opened.  Call open()
first.");
-        }
     }
     
     private void prologue()
@@ -240,9 +236,6 @@ public class UpdateWriter implements Clo
     
     public static void output(UpdateRequest request, IndentedWriter out, SerializationContext
sCxt)
     {
-        if ( sCxt == null )
-            sCxt = new SerializationContext(request);
-        
         UpdateWriter uw = new UpdateWriter(out, sCxt);
         uw.open();
         uw.update(request);
@@ -251,15 +244,11 @@ public class UpdateWriter implements Clo
     
     public static void output(Update update, IndentedWriter out, SerializationContext sCxt)
     {
-        if ( sCxt == null )
-            sCxt = new SerializationContext();
-        
         UpdateWriter uw = new UpdateWriter(out, sCxt);
         uw.open();
         uw.update(update);
         uw.close();
     }
-    
 
     // newline policy - don't add until needed.
     private static class Writer implements UpdateVisitor



Mime
View raw message