jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1602695 - /jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/serializer/Serializer.java
Date Sun, 15 Jun 2014 13:50:48 GMT
Author: andy
Date: Sun Jun 15 13:50:47 2014
New Revision: 1602695

URL: http://svn.apache.org/r1602695
Log:
No need to copy the prologue -- shouldn't mofdiy the query at all (and it may be null).

Modified:
    jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/serializer/Serializer.java

Modified: jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/serializer/Serializer.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/serializer/Serializer.java?rev=1602695&r1=1602694&r2=1602695&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/serializer/Serializer.java (original)
+++ jena/trunk/jena-arq/src/main/java/com/hp/hpl/jena/sparql/serializer/Serializer.java Sun
Jun 15 13:50:47 2014
@@ -24,9 +24,9 @@ import org.apache.jena.atlas.io.Indented
 import org.apache.jena.atlas.io.IndentedWriter ;
 import org.apache.jena.atlas.logging.Log ;
 
+import com.hp.hpl.jena.n3.IRIResolver ;
 import com.hp.hpl.jena.query.Query ;
 import com.hp.hpl.jena.query.Syntax ;
-
 import com.hp.hpl.jena.sparql.core.Prologue;
 import com.hp.hpl.jena.sparql.util.NodeToLabelMapBNode ;
 
@@ -144,6 +144,16 @@ public class Serializer
         Log.warn(Serializer.class, "Unknown syntax: "+outSyntax) ;
     }
     
+    static public void serializeARQ(Query query, IndentedWriter writer)
+    {
+        Prologue prologue = query ;
+        
+        if ( ! query.explicitlySetBaseURI() ) {
+            prologue = new Prologue(query.getPrefixMapping(), (IRIResolver)null) ;
+        }
+        serializeARQ(query, prologue, writer);
+    }
+    
     static public void serializeARQ(Query query, Prologue p, IndentedWriter writer)
     {
         // For the query pattern
@@ -151,25 +161,12 @@ public class Serializer
         // For the construct pattern
         SerializationContext cxt2 = new SerializationContext(p, new NodeToLabelMapBNode("c",
false)  ) ;
         
-        Prologue orig = null;
-        if ( query != p) {
-        	orig = query.copy();
-        	query.usePrologueFrom(p);
-        }
-        
         serializeARQ(query, writer, 
                      new FormatterElement(writer, cxt1),
                      new FmtExprSPARQL(writer, cxt1),
                      new FmtTemplate(writer, cxt2)) ;
-        
-        if (orig != null) query.usePrologueFrom(orig);
     }
      
-    static public void serializeARQ(Query query, IndentedWriter writer)
-    {
-    	serializeARQ(query, query, writer);
-    }
-    
     static void serializeARQ(Query query, 
                              IndentedWriter writer, 
                              FormatterElement eltFmt,



Mime
View raw message