clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject svn commit: r1502677 - in /clerezza/trunk: rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/TcManager.java rdf.jena.tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/BaseTdbTcProvider.java
Date Fri, 12 Jul 2013 20:38:01 GMT
Author: misl
Date: Fri Jul 12 20:38:01 2013
New Revision: 1502677

URL: http://svn.apache.org/r1502677
Log:
CLEREZZA-802: Added the ability to force fastlane.

Modified:
    clerezza/trunk/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/TcManager.java
    clerezza/trunk/rdf.jena.tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/BaseTdbTcProvider.java

Modified: clerezza/trunk/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/TcManager.java
URL: http://svn.apache.org/viewvc/clerezza/trunk/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/TcManager.java?rev=1502677&r1=1502676&r2=1502677&view=diff
==============================================================================
--- clerezza/trunk/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/TcManager.java
(original)
+++ clerezza/trunk/rdf.core/src/main/java/org/apache/clerezza/rdf/core/access/TcManager.java
Fri Jul 12 20:38:01 2013
@@ -279,13 +279,33 @@ public class TcManager extends TcProvide
      * @return the resulting ResultSet, Graph or Boolean value
      */
     public Object executeSparqlQuery(String query, TripleCollection defaultGraph) throws
ParseException {
-        final UriRef defaultGraphName = new UriRef("urn:x-temp:/kjsfadfhfasdffds");
-        SparqlPreParser sparqlPreParser = new SparqlPreParser(this);
-        final Set<UriRef> referencedGraphs = sparqlPreParser.getReferredGraphs(query,
defaultGraphName);
+      return executeSparqlQuery(query, defaultGraph, false);
+    }
+
+    /**
+     * Executes any sparql query. The type of the result object will vary
+     * depending on the type of the query. If the defaultGraph is available
+     * in this TcManages executeSparqlQuery(String, UriRef) should be used instead.
+     *
+     * @param query the sparql query to execute
+     * @param defaultGraph the default graph against which to execute the query
+     * if no FROM clause is present
+     * @param forceFastlane indicate whether to force fastlane usage.
+     * @return the resulting ResultSet, Graph or Boolean value
+     */
+    public Object executeSparqlQuery(String query, TripleCollection defaultGraph, boolean
forceFastlane) throws ParseException {
         TcProvider singleTargetTcProvider = null;
-        if ((referencedGraphs != null) && (!referencedGraphs.contains(defaultGraphName)))
{
-            singleTargetTcProvider = getSingleTargetTcProvider(referencedGraphs);
-        }
+    	if (forceFastlane) {
+            singleTargetTcProvider = getSingleTargetTcProvider();
+    	} else {    	
+	        final UriRef defaultGraphName = new UriRef("urn:x-temp:/kjsfadfhfasdffds");
+	        SparqlPreParser sparqlPreParser = new SparqlPreParser(this);
+	        final Set<UriRef> referencedGraphs = sparqlPreParser.getReferredGraphs(query,
defaultGraphName);
+	        if ((referencedGraphs != null) && (!referencedGraphs.contains(defaultGraphName)))
{
+	            singleTargetTcProvider = getSingleTargetTcProvider(referencedGraphs);
+	        }
+    	}
+    	
         if ((singleTargetTcProvider != null) && (singleTargetTcProvider instanceof
QueryableTcProvider)) {
             return ((QueryableTcProvider)singleTargetTcProvider).executeSparqlQuery(query,
null);
         }
@@ -298,12 +318,20 @@ public class TcManager extends TcProvide
     }
     
     public Object executeSparqlQuery(String query, UriRef defaultGraphName) throws ParseException
{
-        SparqlPreParser sparqlPreParser = new SparqlPreParser(this);
-        final Set<UriRef> referencedGraphs = sparqlPreParser.getReferredGraphs(query,
defaultGraphName);
+      return executeSparqlQuery(query, defaultGraphName, false);
+    }
+
+    public Object executeSparqlQuery(String query, UriRef defaultGraphName, boolean forceFastlane)
throws ParseException {
         TcProvider singleTargetTcProvider = null;
-        if ((referencedGraphs != null)) {
-            singleTargetTcProvider = getSingleTargetTcProvider(referencedGraphs);
-        }
+    	if (forceFastlane) {
+            singleTargetTcProvider = getSingleTargetTcProvider();
+    	} else {    	
+	        SparqlPreParser sparqlPreParser = new SparqlPreParser(this);
+	        final Set<UriRef> referencedGraphs = sparqlPreParser.getReferredGraphs(query,
defaultGraphName);
+	        if ((referencedGraphs != null)) {
+	            singleTargetTcProvider = getSingleTargetTcProvider(referencedGraphs);
+	        }
+    	}
         if ((singleTargetTcProvider != null) && (singleTargetTcProvider instanceof
QueryableTcProvider)) {
             return ((QueryableTcProvider)singleTargetTcProvider).executeSparqlQuery(query,
defaultGraphName);
         }
@@ -491,4 +519,8 @@ public class TcManager extends TcProvide
         }
         return singleTargetTcProvider;
     }
+
+    private TcProvider getSingleTargetTcProvider() {
+        return providerList.first();
+    }
 }

Modified: clerezza/trunk/rdf.jena.tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/BaseTdbTcProvider.java
URL: http://svn.apache.org/viewvc/clerezza/trunk/rdf.jena.tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/BaseTdbTcProvider.java?rev=1502677&r1=1502676&r2=1502677&view=diff
==============================================================================
--- clerezza/trunk/rdf.jena.tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/BaseTdbTcProvider.java
(original)
+++ clerezza/trunk/rdf.jena.tdb.storage/src/main/java/org/apache/clerezza/rdf/jena/tdb/storage/BaseTdbTcProvider.java
Fri Jul 12 20:38:01 2013
@@ -36,7 +36,6 @@ abstract class BaseTdbTcProvider impleme
 		// QueryExecutionFactory.create requires
 		// (java.io.FilePermission [etc/]location-mapping.* read)
 		// Thus, they are placed within doPrivileged
-        getDataset().setDefaultModel(null);
 		QueryExecution qexec = AccessController
 				.doPrivileged(new PrivilegedAction<QueryExecution>() {
 



Mime
View raw message