jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject svn commit: r1197064 - in /incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena: query/QueryExecution.java sparql/engine/QueryExecutionBase.java sparql/engine/http/QueryEngineHTTP.java
Date Thu, 03 Nov 2011 11:14:50 GMT
Author: andy
Date: Thu Nov  3 11:14:50 2011
New Revision: 1197064

URL: http://svn.apache.org/viewvc?rev=1197064&view=rev
Log:
Add method getQuery to QueryExecution interface.

Modified:
    incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena/query/QueryExecution.java
    incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena/sparql/engine/QueryExecutionBase.java
    incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena/sparql/engine/http/QueryEngineHTTP.java

Modified: incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena/query/QueryExecution.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena/query/QueryExecution.java?rev=1197064&r1=1197063&r2=1197064&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena/query/QueryExecution.java
(original)
+++ incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena/query/QueryExecution.java
Thu Nov  3 11:14:50 2011
@@ -61,6 +61,11 @@ public interface QueryExecution
      */ 
     public Context getContext() ;
     
+    /** The query associated with a query execution.  
+     *  May be null (QueryExecution may have been created by other means)
+     */ 
+    public Query getQuery() ;
+
     /** Execute a SELECT query */
 	public ResultSet execSelect();
     

Modified: incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena/sparql/engine/QueryExecutionBase.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena/sparql/engine/QueryExecutionBase.java?rev=1197064&r1=1197063&r2=1197064&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena/sparql/engine/QueryExecutionBase.java
(original)
+++ incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena/sparql/engine/QueryExecutionBase.java
Thu Nov  3 11:14:50 2011
@@ -543,7 +543,10 @@ public class QueryExecutionBase implemen
     
     @Override
     public Dataset getDataset() { return dataset ; }
-    
+
+    @Override
+    public Query getQuery()     { return query ; }
+
     // Call after setFM called.
     private static DatasetGraph prepareDataset(Dataset dataset, Query query, FileManager
fileManager)
     {

Modified: incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena/sparql/engine/http/QueryEngineHTTP.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena/sparql/engine/http/QueryEngineHTTP.java?rev=1197064&r1=1197063&r2=1197064&view=diff
==============================================================================
--- incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena/sparql/engine/http/QueryEngineHTTP.java
(original)
+++ incubator/jena/Jena2/ARQ/trunk/src/main/java/com/hp/hpl/jena/sparql/engine/http/QueryEngineHTTP.java
Thu Nov  3 11:14:50 2011
@@ -27,6 +27,7 @@ import java.util.concurrent.TimeUnit ;
 
 import org.openjena.atlas.io.IO ;
 import org.openjena.atlas.lib.NotImplemented ;
+import org.openjena.riot.WebContent ;
 import org.slf4j.Logger ;
 import org.slf4j.LoggerFactory ;
 
@@ -49,10 +50,11 @@ public class QueryEngineHTTP implements 
 {
     private static Logger log = LoggerFactory.getLogger(QueryEngineHTTP.class) ;
     
-    public static final String QUERY_MIME_TYPE = "application/sparql-query" ;
-    String queryString ;
-    String service ;
-    Context context = null ;
+    public static final String QUERY_MIME_TYPE = WebContent.contentTypeSPARQLQuery ; // "application/sparql-query"
;
+    private final Query query ;
+    private final String queryString ;
+    private final String service ;
+    private final Context context ;
     
     //Params
     Params params = null ;
@@ -71,17 +73,23 @@ public class QueryEngineHTTP implements 
     
     public QueryEngineHTTP(String serviceURI, Query query)
     { 
-        this(serviceURI, query.toString()) ;
+        this(serviceURI, query, query.toString()) ;
     }
     
     public QueryEngineHTTP(String serviceURI, String queryString)
-    { 
-        this.queryString = queryString ;
-        service = serviceURI ;
-        // Copy the global context to freeze it.
-        context = new Context(ARQ.getContext()) ;
+    { 
+        this(serviceURI, null, queryString) ;
     }
-
+
+    private QueryEngineHTTP(String serviceURI, Query query, String queryString)
+    { 
+        this.query = query ;
+        this.queryString = queryString ;
+        this.service = serviceURI ;
+        // Copy the global context to freeze it.
+        this.context = new Context(ARQ.getContext()) ;
+    }
+    
 //    public void setParams(Params params)
 //    { this.params = params ; }
     
@@ -200,7 +208,14 @@ public class QueryEngineHTTP implements 
     }
 
     @Override
-    public Context getContext() { return context ; }
+    public Context getContext() { return context ; }
+    
+    @Override public Dataset getDataset()   { return null ; }
+
+    // This may be null - if we were created form a query string, 
+    // we don't guarantee to parse it so we let through non-SPARQL
+    // extensions to the far end. 
+    @Override public Query getQuery()       { return query ; }
     
     @Override
     public void setTimeout(long timeout)
@@ -279,10 +294,4 @@ public class QueryEngineHTTP implements 
         HttpQuery httpQuery = makeHttpQuery() ;
         return "GET "+httpQuery.toString() ;
     }
-
-    @Override
-    public Dataset getDataset()
-    {
-        return null ;
-    }
 }



Mime
View raw message