jena-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [2/3] jena git commit: Choose transactional/non-transactional in-memory dataset based on usage
Date Sat, 12 Dec 2015 13:47:30 GMT
Choose transactional/non-transactional in-memory dataset based on usage

Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/96d2473e
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/96d2473e
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/96d2473e

Branch: refs/heads/master
Commit: 96d2473e1e92a0ccc40f486f7c182ddc077233f4
Parents: 22bd10d
Author: Andy Seaborne <andy@apache.org>
Authored: Sat Dec 12 12:44:23 2015 +0000
Committer: Andy Seaborne <andy@apache.org>
Committed: Sat Dec 12 12:44:23 2015 +0000

----------------------------------------------------------------------
 .../org/apache/jena/fuseki/cmd/FusekiCmd.java   | 22 +++++++++++++-------
 .../jena/fuseki/servlets/REST_Quads_RW.java     |  2 +-
 .../fuseki/servlets/SPARQL_QueryGeneral.java    |  2 +-
 .../jena/fuseki/servlets/SPARQL_Upload.java     |  2 +-
 .../java/org/apache/jena/fuseki/ServerTest.java |  2 +-
 .../org/apache/jena/fuseki/TestDatasetOps.java  |  4 ++--
 6 files changed, 21 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jena/blob/96d2473e/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cmd/FusekiCmd.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cmd/FusekiCmd.java
b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cmd/FusekiCmd.java
index c99cb5e..9a13b36 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cmd/FusekiCmd.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/cmd/FusekiCmd.java
@@ -20,6 +20,10 @@ package org.apache.jena.fuseki.cmd ;
 
 import java.util.List ;
 
+import arq.cmdline.CmdARQ ;
+import arq.cmdline.ModDatasetAssembler ;
+import jena.cmd.ArgDecl ;
+import jena.cmd.CmdException ;
 import org.apache.jena.atlas.lib.FileOps ;
 import org.apache.jena.fuseki.Fuseki ;
 import org.apache.jena.fuseki.FusekiLogging ;
@@ -31,19 +35,17 @@ import org.apache.jena.fuseki.server.FusekiServerListener ;
 import org.apache.jena.fuseki.server.ServerInitialConfig ;
 import org.apache.jena.query.ARQ ;
 import org.apache.jena.query.Dataset ;
+import org.apache.jena.query.ReadWrite ;
 import org.apache.jena.riot.Lang ;
 import org.apache.jena.riot.RDFDataMgr ;
 import org.apache.jena.riot.RDFLanguages ;
 import org.apache.jena.sparql.core.DatasetGraphFactory ;
+import org.apache.jena.sparql.core.Transactional ;
 import org.apache.jena.system.JenaSystem ;
 import org.apache.jena.tdb.TDB ;
 import org.apache.jena.tdb.sys.Names ;
 import org.apache.jena.tdb.transaction.TransactionManager ;
 import org.slf4j.Logger ;
-import jena.cmd.ArgDecl ;
-import jena.cmd.CmdException ;
-import arq.cmdline.CmdARQ ;
-import arq.cmdline.ModDatasetAssembler ;
 
 /**
  * Handles the fuseki command, used to start a Fuseki server.
@@ -235,13 +237,19 @@ public class FusekiCmd {
 
                 // Directly populate the dataset.
                 cmdLineConfig.reset();
-                cmdLineConfig.dsg = DatasetGraphFactory.createGeneral() ;
-
+                cmdLineConfig.dsg = DatasetGraphFactory.createTxnMem() ;
+                Transactional t = (Transactional)(cmdLineConfig.dsg) ;
+                
                 // INITIAL DATA.
                 Lang language = RDFLanguages.filenameToLang(filename) ;
                 if ( language == null )
                     throw new CmdException("Can't guess language for file: " + filename)
;
-                RDFDataMgr.read(cmdLineConfig.dsg, filename) ;
+                // XXX Replace by Txn.
+                t.begin(ReadWrite.WRITE) ;
+                try {
+                    RDFDataMgr.read(cmdLineConfig.dsg, filename) ;
+                    t.commit() ;
+                } finally { t.end() ; }
             }
 
             if ( contains(argMemTDB) ) {

http://git-wip-us.apache.org/repos/asf/jena/blob/96d2473e/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/REST_Quads_RW.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/REST_Quads_RW.java
b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/REST_Quads_RW.java
index 9090547..6bc4b49 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/REST_Quads_RW.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/REST_Quads_RW.java
@@ -112,7 +112,7 @@ public class REST_Quads_RW extends REST_Quads_R {
     }
     
     private void doPutPostNonTxn(HttpAction action, boolean clearFirst) {
-        DatasetGraph dsgTmp = DatasetGraphFactory.createMem() ;
+        DatasetGraph dsgTmp = DatasetGraphFactory.create() ;
         StreamRDF dest = StreamRDFLib.dataset(dsgTmp) ;
 
         UploadDetails details ;

http://git-wip-us.apache.org/repos/asf/jena/blob/96d2473e/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_QueryGeneral.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_QueryGeneral.java
b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_QueryGeneral.java
index 51f93a6..3bed1be 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_QueryGeneral.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_QueryGeneral.java
@@ -78,7 +78,7 @@ public class SPARQL_QueryGeneral extends SPARQL_Query {
             if ( graphURLs.size() == 0 && namedGraphs.size() == 0 )
                 return null ;
 
-            Dataset dataset = DatasetFactory.createGeneral() ;
+            Dataset dataset = DatasetFactory.create() ;
             // Look in cache for loaded graphs!!
 
             // ---- Default graph

http://git-wip-us.apache.org/repos/asf/jena/blob/96d2473e/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Upload.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Upload.java
b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Upload.java
index 65eef9e..38d380a 100644
--- a/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Upload.java
+++ b/jena-fuseki2/jena-fuseki-core/src/main/java/org/apache/jena/fuseki/servlets/SPARQL_Upload.java
@@ -184,7 +184,7 @@ public class SPARQL_Upload extends ActionSPARQL
     // ?? Combine with Upload.fileUploadWorker
     // Difference is the handling of names for graphs.  
     static private UploadDetails uploadWorker(HttpAction action, String base) {
-        DatasetGraph dsgTmp = DatasetGraphFactory.createGeneral() ;
+        DatasetGraph dsgTmp = DatasetGraphFactory.create() ;
         ServletFileUpload upload = new ServletFileUpload() ;
         String graphName = null ;
         boolean isQuads = false ;

http://git-wip-us.apache.org/repos/asf/jena/blob/96d2473e/jena-fuseki2/jena-fuseki-core/src/test/java/org/apache/jena/fuseki/ServerTest.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/test/java/org/apache/jena/fuseki/ServerTest.java
b/jena-fuseki2/jena-fuseki-core/src/test/java/org/apache/jena/fuseki/ServerTest.java
index bbe0db7..34ffb12 100644
--- a/jena-fuseki2/jena-fuseki-core/src/test/java/org/apache/jena/fuseki/ServerTest.java
+++ b/jena-fuseki2/jena-fuseki-core/src/test/java/org/apache/jena/fuseki/ServerTest.java
@@ -116,7 +116,7 @@ public class ServerTest {
         SystemState.init$() ;
         
         ServerInitialConfig params = new ServerInitialConfig() ;
-        DatasetGraph dsg = DatasetGraphFactory.createMem() ;
+        DatasetGraph dsg = DatasetGraphFactory.create() ;
         params.dsg = dsg ;
         params.datasetPath = datasetPath ;
         params.allowUpdate = updateable ;

http://git-wip-us.apache.org/repos/asf/jena/blob/96d2473e/jena-fuseki2/jena-fuseki-core/src/test/java/org/apache/jena/fuseki/TestDatasetOps.java
----------------------------------------------------------------------
diff --git a/jena-fuseki2/jena-fuseki-core/src/test/java/org/apache/jena/fuseki/TestDatasetOps.java
b/jena-fuseki2/jena-fuseki-core/src/test/java/org/apache/jena/fuseki/TestDatasetOps.java
index 179a020..fac056b 100644
--- a/jena-fuseki2/jena-fuseki-core/src/test/java/org/apache/jena/fuseki/TestDatasetOps.java
+++ b/jena-fuseki2/jena-fuseki-core/src/test/java/org/apache/jena/fuseki/TestDatasetOps.java
@@ -79,7 +79,7 @@ public class TestDatasetOps extends AbstractFusekiTest
     private void gsp_x(String outward, String inward) {
         HttpEntity e = datasetToHttpEntity(data) ;
         HttpOp.execHttpPut(outward, e);
-        DatasetGraph dsg = DatasetGraphFactory.createMem() ;
+        DatasetGraph dsg = DatasetGraphFactory.create() ;
         RDFDataMgr.read(dsg, inward) ;
 //        String x = HttpOp.execHttpGetString(inward, "application/n-quads") ;
 //        RDFDataMgr.read(dsg, new StringReader(x), null, Lang.NQUADS) ;
@@ -123,7 +123,7 @@ public class TestDatasetOps extends AbstractFusekiTest
         HttpOp.execHttpPut(urlDataset, e);
         TypedInputStream in = HttpOp.execHttpGet(urlDataset, acceptheader) ;
         assertEqualsIgnoreCase(contentTypeResponse, in.getContentType()) ;
-        DatasetGraph dsg = DatasetGraphFactory.createMem() ;
+        DatasetGraph dsg = DatasetGraphFactory.create() ;
         StreamRDF dest = StreamRDFLib.dataset(dsg) ;
         RDFDataMgr.parse(dest, in) ;
     }


Mime
View raw message