You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2012/01/20 14:23:51 UTC

svn commit: r1233902 - in /incubator/jena/Jena2/TDB/trunk: src-dev/dev/ src/main/java/com/hp/hpl/jena/tdb/ src/main/java/com/hp/hpl/jena/tdb/index/factories/ src/main/java/com/hp/hpl/jena/tdb/mgt/ src/main/java/com/hp/hpl/jena/tdb/nodetable/ src/main/j...

Author: andy
Date: Fri Jan 20 13:23:50 2012
New Revision: 1233902

URL: http://svn.apache.org/viewvc?rev=1233902&view=rev
Log:
Fully enable transactions.  Tests of SPARQL (query, update) and transactions.

Added:
    incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/setup/SystemParams.java
    incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/SetupTDB_X.java
      - copied, changed from r1231578, incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/SetupTDB.java
    incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/SetupTDB_Y.java
Removed:
    incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/SetupTDB.java
Modified:
    incubator/jena/Jena2/TDB/trunk/src-dev/dev/TestTxn.java
    incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/TDB.java
    incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/factories/IndexFactoryBPlusTree.java
    incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/factories/IndexFactoryExtHash.java
    incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/mgt/TDBSystemInfoMBean.java
    incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableFactory.java
    incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/setup/DatasetBuilder.java
    incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/setup/DatasetBuilderStd.java
    incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/DatasetGraphTDB.java
    incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/StoreConfig.java
    incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader2/CmdNodeTableBuilder.java
    incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader2/IndexFactory.java
    incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/DatasetGraphMakerTDB.java
    incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/DatasetGraphSetup.java
    incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/DatasetBuilderTxn.java
    incubator/jena/Jena2/TDB/trunk/src/main/java/tdb/CmdRewriteIndex.java
    incubator/jena/Jena2/TDB/trunk/src/main/java/tdb/cmdline/CmdTDB.java
    incubator/jena/Jena2/TDB/trunk/src/main/java/tdb/tdbconfig.java
    incubator/jena/Jena2/TDB/trunk/src/main/java/tdb/tools/dumpnodetable.java
    incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/index/bplustree/TestBPlusTreeRewriter.java
    incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/nodetable/TestNodeTable.java
    incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/nodetable/TestNodeTableStored.java
    incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/store/TestTripleTable.java
    incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/store/Test_SPARQL_TDB.java
    incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/transaction/AbstractTestNodeTableTrans.java
    incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/transaction/TestNodeTableTransDisk.java

Modified: incubator/jena/Jena2/TDB/trunk/src-dev/dev/TestTxn.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src-dev/dev/TestTxn.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src-dev/dev/TestTxn.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src-dev/dev/TestTxn.java Fri Jan 20 13:23:50 2012
@@ -30,33 +30,33 @@ import com.hp.hpl.jena.query.DatasetFact
 import com.hp.hpl.jena.query.ReadWrite ;
 import com.hp.hpl.jena.sparql.core.DatasetGraph ;
 import com.hp.hpl.jena.sparql.sse.SSE ;
-import com.hp.hpl.jena.tdb.* ;
-import com.hp.hpl.jena.tdb.base.file.Location ;
-import com.hp.hpl.jena.tdb.store.DatasetGraphTDB ;
-import com.hp.hpl.jena.tdb.transaction.DatasetGraphTransaction ;
+import com.hp.hpl.jena.tdb.ConfigTest ;
+import com.hp.hpl.jena.tdb.StoreConnection ;
+import com.hp.hpl.jena.tdb.TDBFactory ;
 
 public class TestTxn extends BaseTest
 {
     static final String DIR = ConfigTest.getTestingDirDB() ; 
     
-//    @Before public void before()
-//    {
-//        FileOps.clearDirectory(DIR) ; 
-//    }
-//    
-//    @After public void after()
-//    {
-//        StoreConnection.reset() ;
-//        FileOps.clearDirectory(DIR) ; 
-//    }
+    @Before public void before()
+    {
+        FileOps.clearDirectory(DIR) ; 
+    }
+    
+    @After public void after()
+    {
+        StoreConnection.reset() ;
+        FileOps.clearDirectory(DIR) ; 
+    }
     
     protected Dataset create()
     { 
-        DatasetGraph dsg = TDBFactory.createDatasetGraph() ;
+        //TDBFactory.MAKE_TRANSACTIONAL_DATASETS = false ;
+        DatasetGraph dsg = TDBFactory.createDatasetGraph(DIR) ;
         //DatasetGraph dsg = TDBFactoryTxn.XcreateDatasetGraph(Location.mem(DIR)) ;
         
-        if ( dsg instanceof DatasetGraphTDB )
-            dsg = new DatasetGraphTransaction((DatasetGraphTDB)dsg) ;    
+//        if ( dsg instanceof DatasetGraphTDB )
+//            dsg = new DatasetGraphTransaction((DatasetGraphTDB)dsg) ;    
         return DatasetFactory.create(dsg) ;
     }
 

Modified: incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/TDB.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/TDB.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/TDB.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/TDB.java Fri Jan 20 13:23:50 2012
@@ -45,12 +45,12 @@ import com.hp.hpl.jena.sparql.util.Mappi
 import com.hp.hpl.jena.sparql.util.Symbol ;
 import com.hp.hpl.jena.tdb.assembler.AssemblerTDB ;
 import com.hp.hpl.jena.tdb.modify.UpdateEngineTDB ;
+import com.hp.hpl.jena.tdb.setup.DatasetBuilderStd ;
 import com.hp.hpl.jena.tdb.solver.OpExecutorTDB ;
 import com.hp.hpl.jena.tdb.solver.QueryEngineTDB ;
 import com.hp.hpl.jena.tdb.solver.StageGeneratorDirectTDB ;
 import com.hp.hpl.jena.tdb.store.DatasetGraphTDB ;
 import com.hp.hpl.jena.tdb.sys.EnvTDB ;
-import com.hp.hpl.jena.tdb.sys.SetupTDB ;
 import com.hp.hpl.jena.tdb.sys.SystemTDB ;
 import com.hp.hpl.jena.tdb.sys.TDBMaker ;
 import com.hp.hpl.jena.tdb.transaction.DatasetGraphTransaction ;
@@ -117,7 +117,7 @@ public class TDB
      * Set to false to silence the warning
      */
     public static void setOptimizerWarningFlag(boolean b)
-    { SetupTDB.setOptimizerWarningFlag(b) ; }
+    { DatasetBuilderStd.setOptimizerWarningFlag(b) ; }
     
     // ** Call SystemARQ.sync 
     

Modified: incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/factories/IndexFactoryBPlusTree.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/factories/IndexFactoryBPlusTree.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/factories/IndexFactoryBPlusTree.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/factories/IndexFactoryBPlusTree.java Fri Jan 20 13:23:50 2012
@@ -33,7 +33,7 @@ import com.hp.hpl.jena.tdb.index.RangeIn
 import com.hp.hpl.jena.tdb.index.bplustree.BPlusTree;
 import com.hp.hpl.jena.tdb.index.bplustree.BPlusTreeParams;
 import com.hp.hpl.jena.tdb.sys.Names;
-import com.hp.hpl.jena.tdb.sys.SetupTDB;
+import com.hp.hpl.jena.tdb.sys.SetupTDB_X ;
 import com.hp.hpl.jena.tdb.sys.SystemTDB;
 
 public class IndexFactoryBPlusTree implements IndexFactory, IndexRangeFactory
@@ -76,7 +76,7 @@ public class IndexFactoryBPlusTree imple
         
         String fnNodes = fileset.filename(filename) ;
         return BlockMgrFactory.createFile(fnNodes, blockSize, 
-                                          SetupTDB.systemInfo.getBlockReadCacheSize(), //SystemTDB.BlockReadCacheSize,
-                                          SetupTDB.systemInfo.getBlockWriteCacheSize()) ; //SystemTDB.BlockWriteCacheSize) ;
+                                          SetupTDB_X.systemInfo.getBlockReadCacheSize(), //SystemTDB.BlockReadCacheSize,
+                                          SetupTDB_X.systemInfo.getBlockWriteCacheSize()) ; //SystemTDB.BlockWriteCacheSize) ;
     }
 }

Modified: incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/factories/IndexFactoryExtHash.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/factories/IndexFactoryExtHash.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/factories/IndexFactoryExtHash.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/index/factories/IndexFactoryExtHash.java Fri Jan 20 13:23:50 2012
@@ -28,7 +28,7 @@ import com.hp.hpl.jena.tdb.index.Index;
 import com.hp.hpl.jena.tdb.index.IndexFactory;
 import com.hp.hpl.jena.tdb.index.ext.ExtHash;
 import com.hp.hpl.jena.tdb.sys.Names;
-import com.hp.hpl.jena.tdb.sys.SetupTDB;
+import com.hp.hpl.jena.tdb.sys.SetupTDB_X;
 import com.hp.hpl.jena.tdb.sys.SystemTDB;
 
 /** Index factory for extendible hash tables.
@@ -62,7 +62,7 @@ public class IndexFactoryExtHash impleme
     protected BlockMgr createBlockMgr(String filename, int blockSize)
     {
         return BlockMgrFactory.createFile(filename, blockSize, 
-                                          SetupTDB.systemInfo.getBlockReadCacheSize(), //SystemTDB.BlockReadCacheSize,
-                                          SetupTDB.systemInfo.getBlockWriteCacheSize()) ; //SystemTDB.BlockWriteCacheSize) ;
+                                          SetupTDB_X.systemInfo.getBlockReadCacheSize(), //SystemTDB.BlockReadCacheSize,
+                                          SetupTDB_X.systemInfo.getBlockWriteCacheSize()) ; //SystemTDB.BlockWriteCacheSize) ;
     }
 }

Modified: incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/mgt/TDBSystemInfoMBean.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/mgt/TDBSystemInfoMBean.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/mgt/TDBSystemInfoMBean.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/mgt/TDBSystemInfoMBean.java Fri Jan 20 13:23:50 2012
@@ -45,8 +45,6 @@ public interface TDBSystemInfoMBean
    /** Size of NodeTable lookup miss cache
     */
    public int getNodeMissCacheSize() ;
-   
-   
     
    /** Size of the delayed-write block cache (32 bit systems only) (per file) */
    public int getBlockWriteCacheSize() ;

Modified: incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableFactory.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableFactory.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableFactory.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/nodetable/NodeTableFactory.java Fri Jan 20 13:23:50 2012
@@ -18,15 +18,15 @@
 
 package com.hp.hpl.jena.tdb.nodetable;
 
-import com.hp.hpl.jena.tdb.base.file.FileFactory;
-import com.hp.hpl.jena.tdb.base.file.FileSet;
-import com.hp.hpl.jena.tdb.base.file.Location;
-import com.hp.hpl.jena.tdb.base.objectfile.ObjectFile;
-import com.hp.hpl.jena.tdb.index.Index;
-import com.hp.hpl.jena.tdb.index.IndexBuilder;
-import com.hp.hpl.jena.tdb.sys.Names;
-import com.hp.hpl.jena.tdb.sys.SetupTDB;
-import com.hp.hpl.jena.tdb.sys.SystemTDB;
+import com.hp.hpl.jena.tdb.base.file.FileFactory ;
+import com.hp.hpl.jena.tdb.base.file.FileSet ;
+import com.hp.hpl.jena.tdb.base.file.Location ;
+import com.hp.hpl.jena.tdb.base.objectfile.ObjectFile ;
+import com.hp.hpl.jena.tdb.index.Index ;
+import com.hp.hpl.jena.tdb.index.IndexBuilder ;
+import com.hp.hpl.jena.tdb.sys.Names ;
+import com.hp.hpl.jena.tdb.sys.SetupTDB_Y ;
+import com.hp.hpl.jena.tdb.sys.SystemTDB ;
 
 public class NodeTableFactory
 {
@@ -60,9 +60,9 @@ public class NodeTableFactory
             filesetIdx = new FileSet(location, Names.indexNode2Id) ;
         
         return  create(indexBuilder, filesetNodeTable, filesetIdx,
-                       SetupTDB.systemInfo.getNode2NodeIdCacheSize(),
-                       SetupTDB.systemInfo.getNodeId2NodeCacheSize(),
-                       SetupTDB.systemInfo.getNodeMissCacheSize()) ;
+                       SetupTDB_Y.systemInfo.getNode2NodeIdCacheSize(),
+                       SetupTDB_Y.systemInfo.getNodeId2NodeCacheSize(),
+                       SetupTDB_Y.systemInfo.getNodeMissCacheSize()) ;
     }
 
     /** Custom node table */

Modified: incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/setup/DatasetBuilder.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/setup/DatasetBuilder.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/setup/DatasetBuilder.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/setup/DatasetBuilder.java Fri Jan 20 13:23:50 2012
@@ -18,8 +18,6 @@
 
 package com.hp.hpl.jena.tdb.setup;
 
-import java.util.Properties ;
-
 import com.hp.hpl.jena.tdb.base.file.Location ;
 import com.hp.hpl.jena.tdb.store.DatasetGraphTDB ;
 
@@ -31,5 +29,5 @@ public interface DatasetBuilder
      * Build a new Java object for a dataset.
      * Location may already contains files for the state, or may need initializing.  
      */
-    public DatasetGraphTDB build(Location location, Properties config) ;
+    public DatasetGraphTDB build(Location location, SystemParams config) ;
 }

Modified: incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/setup/DatasetBuilderStd.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/setup/DatasetBuilderStd.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/setup/DatasetBuilderStd.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/setup/DatasetBuilderStd.java Fri Jan 20 13:23:50 2012
@@ -20,13 +20,15 @@ package com.hp.hpl.jena.tdb.setup;
 
 import java.util.HashMap ;
 import java.util.Map ;
-import java.util.Properties ;
 
 import org.openjena.atlas.lib.ColumnMap ;
 import org.openjena.atlas.lib.StrUtils ;
 import org.slf4j.Logger ;
 
+import com.hp.hpl.jena.query.ARQ ;
+import com.hp.hpl.jena.sparql.engine.optimizer.reorder.ReorderLib ;
 import com.hp.hpl.jena.sparql.engine.optimizer.reorder.ReorderTransformation ;
+import com.hp.hpl.jena.sparql.sse.SSEParseException ;
 import com.hp.hpl.jena.tdb.TDB ;
 import com.hp.hpl.jena.tdb.TDBException ;
 import com.hp.hpl.jena.tdb.base.block.BlockMgr ;
@@ -47,7 +49,6 @@ import com.hp.hpl.jena.tdb.sys.DatasetCo
 import com.hp.hpl.jena.tdb.sys.DatasetControlMRSW ;
 import com.hp.hpl.jena.tdb.sys.FileRef ;
 import com.hp.hpl.jena.tdb.sys.Names ;
-import com.hp.hpl.jena.tdb.sys.SetupTDB ;
 import com.hp.hpl.jena.tdb.sys.SystemTDB ;
 
 /** This class is the process of building a dataset. */ 
@@ -66,7 +67,8 @@ public class DatasetBuilderStd implement
     
     private TupleIndexBuilder tupleIndexBuilder ;
     
-    private Properties config ;
+    private SystemParams params ;
+
     
     private Map<FileRef, BlockMgr> blockMgrs = new HashMap<FileRef, BlockMgr>() ;
     private Map<FileRef, BufferChannel> bufferChannels = new HashMap<FileRef, BufferChannel>() ;
@@ -86,23 +88,28 @@ public class DatasetBuilderStd implement
         return x.build(Location.mem(), null) ;
     }
     
-    
-    protected DatasetBuilderStd()
+    public static DatasetBuilderStd stdBuilder()
     {
+        DatasetBuilderStd x = new DatasetBuilderStd() ;
+        x.setStd() ;
+        return x ; 
     }
     
+    protected DatasetBuilderStd() {}
+    
     public DatasetBuilderStd(BlockMgrBuilder blockMgrBuilder,
                              NodeTableBuilder nodeTableBuilder)
     {
         set(blockMgrBuilder, nodeTableBuilder) ;
     }
     
+    // Dalayed initialization
     protected void setAll(NodeTableBuilder nodeTableBuilder,
-                       TupleIndexBuilder tupleIndexBuilder,
-                       IndexBuilder indexBuilder,
-                       RangeIndexBuilder rangeIndexBuilder,
-                       BlockMgrBuilder blockMgrBuilder,
-                       ObjectFileBuilder objectFileBuilder)
+                          TupleIndexBuilder tupleIndexBuilder,
+                          IndexBuilder indexBuilder,
+                          RangeIndexBuilder rangeIndexBuilder,
+                          BlockMgrBuilder blockMgrBuilder,
+                          ObjectFileBuilder objectFileBuilder)
     {
         this.nodeTableBuilder = nodeTableBuilder ;
         this.tupleIndexBuilder = tupleIndexBuilder ;
@@ -164,21 +171,22 @@ public class DatasetBuilderStd implement
     }
 
     @Override
-    synchronized final
-    public DatasetGraphTDB build(Location location, Properties config)
+    public DatasetGraphTDB build(Location location, SystemParams params)
     {
+        if ( params == null )
+            params = SystemParams.getStdSystemParams() ;
+        
         // Ensure that there is global synchronization
         synchronized(DatasetBuilderStd.class)
         {
-            return _build(location, config) ;
+            return _build(location, params) ;
         }
     }
     
-    protected DatasetGraphTDB _build(Location location, Properties config)
+    protected DatasetGraphTDB _build(Location location, SystemParams _params)
     {
-        this.config = config ;
+        params = _params ;
         init(location) ;
-        
         DatasetControl policy = createConcurrencyPolicy() ;
         
         NodeTable nodeTable = makeNodeTable(location, 
@@ -190,7 +198,7 @@ public class DatasetBuilderStd implement
         DatasetPrefixesTDB prefixes = makePrefixTable(location, policy) ;
         ReorderTransformation transform  = chooseReorderTransformation(location) ;
         
-        StoreConfig storeConfig = new StoreConfig(location, config, blockMgrs, bufferChannels, nodeTables) ;
+        StoreConfig storeConfig = new StoreConfig(location, params, blockMgrs, bufferChannels, nodeTables) ;
         DatasetGraphTDB dsg = new DatasetGraphTDB(tripleTable, quadTable, prefixes, transform, storeConfig) ;
         return dsg ;
     }
@@ -309,7 +317,7 @@ public class DatasetBuilderStd implement
     
     protected ReorderTransformation chooseReorderTransformation(Location location)
     {    
-        return SetupTDB.chooseOptimizer(location) ;
+        return chooseOptimizer(location) ;
     }
 
     // ======== Components level
@@ -333,7 +341,7 @@ public class DatasetBuilderStd implement
     private TupleIndex[] makeTupleIndexes(Location location, String primary, String[] indexNames, String[] filenames)
     {
         if ( primary.length() != 3 && primary.length() != 4 )
-            SetupTDB.error(log, "Bad primary key length: "+primary.length()) ;
+            error(log, "Bad primary key length: "+primary.length()) ;
     
         int indexRecordLen = primary.length()*NodeId.SIZE ;
         TupleIndex indexes[] = new TupleIndex[indexNames.length] ;
@@ -394,33 +402,53 @@ public class DatasetBuilderStd implement
         catch (NumberFormatException ex) { error(log, messageBase+": "+str) ; return -1 ; }
     }
     
-    private static Params params = new Params() ;
-    
-    // The standard setting
-    private static class Params
+
+    /** Set the global flag that control the "No BGP optimizer" warning.
+     * Set to false to silence the warning
+     */
+    public static void setOptimizerWarningFlag(boolean b) { warnAboutOptimizer = b ; }
+    private static boolean warnAboutOptimizer = true ;
+
+    public static ReorderTransformation chooseOptimizer(Location location)
     {
-        final int      blockSize            = SystemTDB.BlockSize ;
-        final int      memBlockSize         = SystemTDB.BlockSizeTestMem ;
-        final int      readCacheSize        = SystemTDB.BlockReadCacheSize ;
-        final int      writeCacheSize       = SystemTDB.BlockWriteCacheSize ;
-        final int      Node2NodeIdCacheSize = SystemTDB.Node2NodeIdCacheSize ;
-        final int      NodeId2NodeCacheSize = SystemTDB.NodeId2NodeCacheSize ;
-        final int      NodeMissCacheSize    = SystemTDB.NodeMissCacheSize ;
-
-        final String   indexNode2Id         = Names.indexNode2Id ;
-        final String   indexId2Node         = Names.indexId2Node ;
-        final String   primaryIndexTriples  = Names.primaryIndexTriples ;
-        final String[] tripleIndexes        = Names.tripleIndexes ;
-        final String   primaryIndexQuads    = Names.primaryIndexQuads ;
-        final String[] quadIndexes          = Names.quadIndexes ;
-        final String   primaryIndexPrefix   = Names.primaryIndexPrefix ;
-        final String[] prefixIndexes        = Names.prefixIndexes ;
-        final String   indexPrefix          = Names.indexPrefix ;
+        if ( location == null )
+            return ReorderLib.identity() ;
 
-        final String   prefixNode2Id        = Names.prefixNode2Id ;
-        final String   prefixId2Node        = Names.prefixId2Node ;
+        ReorderTransformation reorder = null ;
+        if ( location.exists(Names.optStats) )
+        {
+            try {
+                reorder = ReorderLib.weighted(location.getPath(Names.optStats)) ;
+                log.debug("Statistics-based BGP optimizer") ;  
+            } catch (SSEParseException ex) { 
+                log.warn("Error in stats file: "+ex.getMessage()) ;
+                reorder = null ;
+            }
+        }
+
+        if ( reorder == null && location.exists(Names.optFixed) )
+        {
+            // Not as good but better than nothing.
+            reorder = ReorderLib.fixed() ;
+            log.debug("Fixed pattern BGP optimizer") ;  
+        }
+
+        if ( location.exists(Names.optNone) )
+        {
+            reorder = ReorderLib.identity() ;
+            log.debug("Optimizer explicitly turned off") ;
+        }
+
+        if ( reorder == null )
+            reorder = SystemTDB.defaultOptimizer ;
+
+        if ( reorder == null && warnAboutOptimizer )
+            ARQ.getExecLogger().warn("No BGP optimizer") ;
+
+        return reorder ; 
     }
-    
+
+
     interface RecordBlockMgr 
     {
         void record(FileRef fileRef, BlockMgr blockMgr) ;

Added: incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/setup/SystemParams.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/setup/SystemParams.java?rev=1233902&view=auto
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/setup/SystemParams.java (added)
+++ incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/setup/SystemParams.java Fri Jan 20 13:23:50 2012
@@ -0,0 +1,57 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.hp.hpl.jena.tdb.setup;
+
+import com.hp.hpl.jena.tdb.sys.Names ;
+import com.hp.hpl.jena.tdb.sys.SystemTDB ;
+
+/** System parameters for a TDB database instance.  Currently, fixed.  
+ */
+public class SystemParams
+{
+    public final int      blockSize            = SystemTDB.BlockSize ;
+    public final int      memBlockSize         = SystemTDB.BlockSizeTestMem ;
+    public final int      readCacheSize        = SystemTDB.BlockReadCacheSize ;
+    public final int      writeCacheSize       = SystemTDB.BlockWriteCacheSize ;
+    public final int      Node2NodeIdCacheSize = SystemTDB.Node2NodeIdCacheSize ;
+    public final int      NodeId2NodeCacheSize = SystemTDB.NodeId2NodeCacheSize ;
+    public final int      NodeMissCacheSize    = SystemTDB.NodeMissCacheSize ;
+
+    public final String   indexNode2Id         = Names.indexNode2Id ;
+    public final String   indexId2Node         = Names.indexId2Node ;
+    public final String   primaryIndexTriples  = Names.primaryIndexTriples ;
+    public final String[] tripleIndexes        = Names.tripleIndexes ;
+    public final String   primaryIndexQuads    = Names.primaryIndexQuads ;
+    public final String[] quadIndexes          = Names.quadIndexes ;
+    public final String   primaryIndexPrefix   = Names.primaryIndexPrefix ;
+    public final String[] prefixIndexes        = Names.prefixIndexes ;
+    public final String   indexPrefix          = Names.indexPrefix ;
+
+    public final String   prefixNode2Id        = Names.prefixNode2Id ;
+    public final String   prefixId2Node        = Names.prefixId2Node ;
+    
+    private SystemParams() {}
+    
+    private static SystemParams standard = new SystemParams() ;
+    
+    public static SystemParams getStdSystemParams()
+    {
+        return standard ;
+    }
+}

Modified: incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/DatasetGraphTDB.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/DatasetGraphTDB.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/DatasetGraphTDB.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/DatasetGraphTDB.java Fri Jan 20 13:23:50 2012
@@ -24,7 +24,6 @@ import java.util.Iterator ;
 import org.openjena.atlas.iterator.Iter ;
 import org.openjena.atlas.iterator.Transform ;
 import org.openjena.atlas.lib.Closeable ;
-import org.openjena.atlas.lib.PropertyUtils ;
 import org.openjena.atlas.lib.Sync ;
 import org.openjena.atlas.lib.Tuple ;
 
@@ -41,9 +40,19 @@ import com.hp.hpl.jena.tdb.base.file.Loc
 import com.hp.hpl.jena.tdb.lib.NodeLib ;
 import com.hp.hpl.jena.tdb.sys.Session ;
 import com.hp.hpl.jena.tdb.sys.TDBMaker ;
+import com.hp.hpl.jena.tdb.transaction.DatasetGraphTransaction ;
+import com.hp.hpl.jena.tdb.transaction.DatasetGraphTxn ;
 import com.hp.hpl.jena.update.GraphStore ;
 
-/** TDB Dataset - directly over the basic storage. */
+/** TDB Dataset - this is the class that creates a dataset over the storage via
+ *  TripleTable, QuadTable and prefixes.  Any transactions
+ *  
+ *  See also:
+ *  <ul>
+ *  <li>{@link DatasetGraphTxn} &ndash; the sublcass that provides a single tranasaction</li>
+ *  <li>{@link DatasetGraphTransaction} &ndash; class that provides the application with the right DatasetGraphTDB (base or transaction).</li>
+ *  </ul>
+ */
 public class DatasetGraphTDB extends DatasetGraphCaching
                              implements DatasetGraph, Sync, Closeable, GraphStore, Session
 {
@@ -213,20 +222,20 @@ public class DatasetGraphTDB extends Dat
 
     public StoreConfig getConfig()                       { return config ; }
     
-    public String getConfigValue(String key)
-    {
-        if ( config == null )
-            return null ;
-        return config.properties.getProperty(key) ;
-    }
-    
-    public int getConfigValueAsInt(String key, int dftValue)
-    {
-        if ( config == null )
-            return dftValue ;
-        return PropertyUtils.getPropertyAsInteger(config.properties, key, dftValue) ;
-    }
-
+//    public String getConfigValue(String key)
+//    {
+//        if ( config == null )
+//            return null ;
+//        return config.properties.getProperty(key) ;
+//    }
+//    
+//    public int getConfigValueAsInt(String key, int dftValue)
+//    {
+//        if ( config == null )
+//            return dftValue ;
+//        return PropertyUtils.getPropertyAsInteger(config.properties, key, dftValue) ;
+//    }
+//
     public ReorderTransformation getTransform()     { return transform ; }
     
     public DatasetPrefixesTDB getPrefixes()       { return prefixes ; }

Modified: incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/StoreConfig.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/StoreConfig.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/StoreConfig.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/StoreConfig.java Fri Jan 20 13:23:50 2012
@@ -19,29 +19,29 @@
 package com.hp.hpl.jena.tdb.store;
 
 import java.util.Map ;
-import java.util.Properties ;
 
 import com.hp.hpl.jena.tdb.base.block.BlockMgr ;
 import com.hp.hpl.jena.tdb.base.file.BufferChannel ;
 import com.hp.hpl.jena.tdb.base.file.Location ;
 import com.hp.hpl.jena.tdb.nodetable.NodeTable ;
+import com.hp.hpl.jena.tdb.setup.SystemParams ;
 import com.hp.hpl.jena.tdb.sys.FileRef ;
 
 public class StoreConfig
 {
-    public Properties properties ;
+    public SystemParams params ;
     public Map<FileRef, BlockMgr> blockMgrs ;
     public Map<FileRef, BufferChannel> bufferChannels ;
     public Map<FileRef, NodeTable> nodeTables ;
     public Location location ; 
 
-    public StoreConfig(Location location, Properties properties, 
+    public StoreConfig(Location location, SystemParams params, 
                        Map<FileRef, BlockMgr> blockMgrs, 
                        Map<FileRef, BufferChannel> bufferChannels,
                        Map<FileRef, NodeTable> nodeTables)
     {
         this.location = location ;
-        this.properties = properties ;
+        this.params = params ;
         this.blockMgrs = blockMgrs ;
         this.bufferChannels = bufferChannels ;
         this.nodeTables = nodeTables ;

Modified: incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader2/CmdNodeTableBuilder.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader2/CmdNodeTableBuilder.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader2/CmdNodeTableBuilder.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader2/CmdNodeTableBuilder.java Fri Jan 20 13:23:50 2012
@@ -50,12 +50,12 @@ import com.hp.hpl.jena.tdb.TDB ;
 import com.hp.hpl.jena.tdb.base.file.Location ;
 import com.hp.hpl.jena.tdb.nodetable.NodeTable ;
 import com.hp.hpl.jena.tdb.nodetable.NodeTupleTable ;
+import com.hp.hpl.jena.tdb.setup.DatasetBuilderStd ;
 import com.hp.hpl.jena.tdb.solver.stats.Stats ;
 import com.hp.hpl.jena.tdb.solver.stats.StatsCollectorNodeId ;
 import com.hp.hpl.jena.tdb.store.DatasetGraphTDB ;
 import com.hp.hpl.jena.tdb.store.NodeId ;
 import com.hp.hpl.jena.tdb.store.bulkloader.BulkLoader ;
-import com.hp.hpl.jena.tdb.sys.SetupTDB ;
 
 /** Build node table - write triples/quads as text file */
 public class CmdNodeTableBuilder extends CmdGeneral
@@ -75,7 +75,7 @@ public class CmdNodeTableBuilder extends
     public static void main(String...argv)
     {
         CmdTDB.setLogging() ;
-        SetupTDB.setOptimizerWarningFlag(false) ;
+        DatasetBuilderStd.setOptimizerWarningFlag(false) ;
         new CmdNodeTableBuilder(argv).mainRun() ;
     }
     
@@ -133,7 +133,7 @@ public class CmdNodeTableBuilder extends
     {
         // This formats the location correctly.
         // But we're not really interested in it all.
-        DatasetGraphTDB dsg = SetupTDB.buildDataset(location) ;
+        DatasetGraphTDB dsg = DatasetBuilderStd.build(location) ;
         
         // so close indexes and the prefix table.
         dsg.getTripleTable().getNodeTupleTable().getTupleTable().close();

Modified: incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader2/IndexFactory.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader2/IndexFactory.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader2/IndexFactory.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/store/bulkloader2/IndexFactory.java Fri Jan 20 13:23:50 2012
@@ -25,7 +25,7 @@ import com.hp.hpl.jena.tdb.base.file.Loc
 import com.hp.hpl.jena.tdb.index.RangeIndex ;
 import com.hp.hpl.jena.tdb.index.TupleIndex ;
 import com.hp.hpl.jena.tdb.index.TupleIndexRecord ;
-import com.hp.hpl.jena.tdb.sys.SetupTDB ;
+import com.hp.hpl.jena.tdb.sys.SetupTDB_Y ;
 
 public class IndexFactory
 {
@@ -44,7 +44,7 @@ public class IndexFactory
     public static RangeIndex openBPT(Location location, String indexName, int readCacheSize, int writeCacheSize, int dftKeyLength, int dftValueLength)
     {
         FileSet fileset = new FileSet(location, indexName) ;
-        return SetupTDB.makeBPlusTree(fileset, readCacheSize, writeCacheSize, dftKeyLength, dftValueLength) ;
+        return SetupTDB_Y.makeBPlusTree(fileset, readCacheSize, writeCacheSize, dftKeyLength, dftValueLength) ;
     }
 
 }

Modified: incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/DatasetGraphMakerTDB.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/DatasetGraphMakerTDB.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/DatasetGraphMakerTDB.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/DatasetGraphMakerTDB.java Fri Jan 20 13:23:50 2012
@@ -24,6 +24,8 @@ import com.hp.hpl.jena.tdb.store.Dataset
 /** Interface to maker of the actual implementations of TDB graphs and datasets */ 
 public interface DatasetGraphMakerTDB 
 {
+    // Needed?
+    
     /** Create an in-memory dataset */
     public DatasetGraphTDB createDatasetGraph() ;
     /** Create a TDB-backed dataset at a given location */

Modified: incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/DatasetGraphSetup.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/DatasetGraphSetup.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/DatasetGraphSetup.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/DatasetGraphSetup.java Fri Jan 20 13:23:50 2012
@@ -19,6 +19,7 @@
 package com.hp.hpl.jena.tdb.sys;
 
 import com.hp.hpl.jena.tdb.base.file.Location ;
+import com.hp.hpl.jena.tdb.setup.DatasetBuilderStd ;
 import com.hp.hpl.jena.tdb.store.DatasetGraphTDB ;
 
 public class DatasetGraphSetup implements DatasetGraphMakerTDB
@@ -26,13 +27,13 @@ public class DatasetGraphSetup implement
     @Override
     public DatasetGraphTDB createDatasetGraph()
     {
-        return SetupTDB.buildDataset(Location.mem()) ;
+        return DatasetBuilderStd.build(Location.mem()) ;
     }
 
     @Override
     public DatasetGraphTDB createDatasetGraph(Location location)
     {
-        return SetupTDB.buildDataset(location) ;
+        return DatasetBuilderStd.build(location) ;
     }
 
     @Override

Copied: incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/SetupTDB_X.java (from r1231578, incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/SetupTDB.java)
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/SetupTDB_X.java?p2=incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/SetupTDB_X.java&p1=incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/SetupTDB.java&r1=1231578&r2=1233902&rev=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/SetupTDB.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/SetupTDB_X.java Fri Jan 20 13:23:50 2012
@@ -58,13 +58,14 @@ import com.hp.hpl.jena.tdb.index.bplustr
 import com.hp.hpl.jena.tdb.index.bplustree.BPlusTreeParams ;
 import com.hp.hpl.jena.tdb.mgt.TDBSystemInfoMBean ;
 import com.hp.hpl.jena.tdb.nodetable.* ;
+import com.hp.hpl.jena.tdb.setup.DatasetBuilderStd ;
 import com.hp.hpl.jena.tdb.store.* ;
 
 /** Makes things: datasets from locations, indexes */
 
-// Future - this become a colection of statics making things in standard ways. Does not build a dataset. 
+// Future - this become a collection of statics making things in standard ways. Does not build a dataset. 
 
-public class SetupTDB
+public class SetupTDB_X
 {
     //private static final Logger log = LoggerFactory.getLogger(NewSetup.class) ;
     static final Logger log = TDB.logInfo ;
@@ -129,6 +130,12 @@ public class SetupTDB
     // And here we make datasets ... 
     public static DatasetGraphTDB buildDataset(Location location)
     {
+        if ( true )
+            return DatasetBuilderStd.build(location) ;
+        
+        
+        
+        
         /* ---- this.meta - the logical structure of the dataset.
          * 
          * # Dataset design
@@ -216,10 +223,10 @@ public class SetupTDB
         
         // Only support this so far.
         if ( ! metafile.propertyEquals("tdb.layout", "v1") )
-            SetupTDB.error(log, "Excepted 'v1': Wrong layout: "+metafile.getProperty("tdb.layout")) ;
+            SetupTDB_X.error(log, "Excepted 'v1': Wrong layout: "+metafile.getProperty("tdb.layout")) ;
             
         if ( ! metafile.propertyEquals("tdb.type", "standalone") )
-            SetupTDB.error(log, "Not marked as a standalone type: "+metafile.getProperty("tdb.type")) ;
+            SetupTDB_X.error(log, "Not marked as a standalone type: "+metafile.getProperty("tdb.type")) ;
 
         // Check expectations.
         
@@ -262,7 +269,7 @@ public class SetupTDB
         DatasetPrefixesTDB prefixes = makePrefixes(location, config, policy) ;
 
         // ---- Create the DatasetGraph object
-        StoreConfig storeConfig = new StoreConfig(location, config, null, null, null) ;
+        StoreConfig storeConfig = new StoreConfig(location, null, null, null, null) ;
         DatasetGraphTDB dsg = new DatasetGraphTDB(tripleTable, quadTable, prefixes, chooseOptimizer(location), storeConfig) ;
 
         // Finalize
@@ -301,12 +308,12 @@ public class SetupTDB
         String indexes[] = x.split(",") ;
         
         if ( indexes.length != 3 )
-            SetupTDB.error(log, "Wrong number of triple table indexes: "+StrUtils.strjoin(",", indexes)) ;
+            SetupTDB_X.error(log, "Wrong number of triple table indexes: "+StrUtils.strjoin(",", indexes)) ;
         log.debug("Triple table: "+primary+" :: "+StrUtils.strjoin(",", indexes)) ;
         
         TupleIndex tripleIndexes[] = makeTupleIndexes(location, config, primary, indexes, indexes) ;
         if ( tripleIndexes.length != indexes.length )
-            SetupTDB.error(log, "Wrong number of triple table tuples indexes: "+tripleIndexes.length) ;
+            SetupTDB_X.error(log, "Wrong number of triple table tuples indexes: "+tripleIndexes.length) ;
         TripleTable tripleTable = new TripleTable(tripleIndexes, nodeTable, policy) ;
         metafile.flush() ;
         return tripleTable ;
@@ -320,12 +327,12 @@ public class SetupTDB
         String indexes[] = x.split(",") ;
 
         if ( indexes.length != 6 )
-            SetupTDB.error(log, "Wrong number of quad table indexes: "+StrUtils.strjoin(",", indexes)) ;
+            SetupTDB_X.error(log, "Wrong number of quad table indexes: "+StrUtils.strjoin(",", indexes)) ;
         log.debug("Quad table: "+primary+" :: "+StrUtils.strjoin(",", indexes)) ;
         
         TupleIndex quadIndexes[] = makeTupleIndexes(location, config, primary, indexes, indexes) ;
         if ( quadIndexes.length != indexes.length )
-            SetupTDB.error(log, "Wrong number of quad table tuples indexes: "+quadIndexes.length) ;
+            SetupTDB_X.error(log, "Wrong number of quad table tuples indexes: "+quadIndexes.length) ;
         QuadTable quadTable = new QuadTable(quadIndexes, nodeTable, policy) ;
         metafile.flush() ;
         return quadTable ;
@@ -369,7 +376,7 @@ public class SetupTDB
         
         TupleIndex prefixIndexes[] = makeTupleIndexes(location, config, primary, indexes, new String[]{indexPrefixes}) ;
         if ( prefixIndexes.length != indexes.length )
-            SetupTDB.error(log, "Wrong number of triple table tuples indexes: "+prefixIndexes.length) ;
+            SetupTDB_X.error(log, "Wrong number of triple table tuples indexes: "+prefixIndexes.length) ;
         
         // The nodetable.
         String pnNode2Id = metafile.getOrSetDefault("tdb.prefixes.nodetable.mapping.node2id", Names.prefixNode2Id) ;
@@ -388,7 +395,7 @@ public class SetupTDB
     public static TupleIndex[] makeTupleIndexes(Location location, Properties config, String primary, String[] descs, String[] filenames)
     {
         if ( primary.length() != 3 && primary.length() != 4 )
-            SetupTDB.error(log, "Bad primary key length: "+primary.length()) ;
+            SetupTDB_X.error(log, "Bad primary key length: "+primary.length()) ;
 
         int indexRecordLen = primary.length()*NodeId.SIZE ;
         TupleIndex indexes[] = new TupleIndex[descs.length] ;
@@ -474,16 +481,16 @@ public class SetupTDB
         RecordFactory recordFactory = makeRecordFactory(metafile, "tdb.bplustree.record", dftKeyLength, dftValueLength) ;
         
         String blkSizeStr = metafile.getOrSetDefault("tdb.bplustree.blksize", Integer.toString(SystemTDB.BlockSize)) ; 
-        int blkSize = SetupTDB.parseInt(blkSizeStr, "Bad block size") ;
+        int blkSize = SetupTDB_X.parseInt(blkSizeStr, "Bad block size") ;
         
         // IndexBuilder.getBPlusTree().newRangeIndex(fs, recordFactory) ;
         // Does not set order.
         
         int calcOrder = BPlusTreeParams.calcOrder(blkSize, recordFactory.recordLength()) ;
         String orderStr = metafile.getOrSetDefault("tdb.bplustree.order", Integer.toString(calcOrder)) ;
-        int order = SetupTDB.parseInt(orderStr, "Bad order for B+Tree") ;
+        int order = SetupTDB_X.parseInt(orderStr, "Bad order for B+Tree") ;
         if ( order != calcOrder )
-            SetupTDB.error(log, "Wrong order (" + order + "), calculated = "+calcOrder) ;
+            SetupTDB_X.error(log, "Wrong order (" + order + "), calculated = "+calcOrder) ;
 
         RangeIndex rIndex = createBPTree(fs, order, blkSize, readCacheSize, writeCacheSize, recordFactory) ;
         metafile.flush() ;
@@ -503,15 +510,15 @@ public class SetupTDB
             recSizeStr = metafile.getProperty(keyName) ;
         
         if ( recSizeStr == null )
-            SetupTDB.error(log, "Failed to get a record factory description from "+keyName) ;
+            SetupTDB_X.error(log, "Failed to get a record factory description from "+keyName) ;
         
         
         String[] recordLengths = recSizeStr.split(",") ;
         if ( recordLengths.length != 2 )
-            SetupTDB.error(log, "Bad record length: "+recSizeStr) ;
+            SetupTDB_X.error(log, "Bad record length: "+recSizeStr) ;
 
-        int keyLen = SetupTDB.parseInt(recordLengths[0], "Bad key length ("+recSizeStr+")") ;
-        int valLen = SetupTDB.parseInt(recordLengths[1], "Bad value length ("+recSizeStr+")") ;
+        int keyLen = SetupTDB_X.parseInt(recordLengths[0], "Bad key length ("+recSizeStr+")") ;
+        int valLen = SetupTDB_X.parseInt(recordLengths[1], "Bad value length ("+recSizeStr+")") ;
         
         return new RecordFactory(keyLen, valLen) ;
     }
@@ -686,7 +693,7 @@ public class SetupTDB
             
         }
         else
-            SetupTDB.error(log, "tdb.layout: expected v1") ;
+            SetupTDB_X.error(log, "tdb.layout: expected v1") ;
             
         
         metafile.flush() ;

Added: incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/SetupTDB_Y.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/SetupTDB_Y.java?rev=1233902&view=auto
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/SetupTDB_Y.java (added)
+++ incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/sys/SetupTDB_Y.java Fri Jan 20 13:23:50 2012
@@ -0,0 +1,488 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.hp.hpl.jena.tdb.sys ;
+
+import static com.hp.hpl.jena.tdb.sys.SystemTDB.LenNodeHash ;
+import static com.hp.hpl.jena.tdb.sys.SystemTDB.SizeOfNodeId ;
+
+import org.openjena.atlas.lib.ColumnMap ;
+import org.openjena.atlas.lib.StrUtils ;
+import org.slf4j.Logger ;
+
+import com.hp.hpl.jena.tdb.TDB ;
+import com.hp.hpl.jena.tdb.TDBException ;
+import com.hp.hpl.jena.tdb.base.block.BlockMgr ;
+import com.hp.hpl.jena.tdb.base.block.BlockMgrFactory ;
+import com.hp.hpl.jena.tdb.base.file.FileFactory ;
+import com.hp.hpl.jena.tdb.base.file.FileSet ;
+import com.hp.hpl.jena.tdb.base.file.Location ;
+import com.hp.hpl.jena.tdb.base.objectfile.ObjectFile ;
+import com.hp.hpl.jena.tdb.base.record.RecordFactory ;
+import com.hp.hpl.jena.tdb.index.* ;
+import com.hp.hpl.jena.tdb.index.bplustree.BPlusTree ;
+import com.hp.hpl.jena.tdb.index.bplustree.BPlusTreeParams ;
+import com.hp.hpl.jena.tdb.mgt.TDBSystemInfoMBean ;
+import com.hp.hpl.jena.tdb.nodetable.* ;
+import com.hp.hpl.jena.tdb.setup.DatasetBuilderStd ;
+import com.hp.hpl.jena.tdb.setup.SystemParams ;
+import com.hp.hpl.jena.tdb.store.* ;
+
+/** Makes things: datasets from locations, indexes */
+
+// Future - this become a collection of statics making things in standard ways. Does not build a dataset. 
+
+public class SetupTDB_Y
+{
+    //private static final Logger log = LoggerFactory.getLogger(NewSetup.class) ;
+    static final Logger log = TDB.logInfo ;
+    
+    /* Logical information goes in the location metafile. This includes
+     * dataset type, NodeTable type and indexes expected.  But it does
+     * not include how the particular files are realised.
+     * 
+     * A NodeTable is a pair of id->Node and Node->id mappings. 
+     * 
+     * An index file has it's own .meta file saying that it is a B+tree and
+     * the record size - everything needed to access it to build a RangeIndex.
+     * The individual node table files are the same.  This means we can
+     * open a single index or object file (e.g to dump) and it allows
+     * for changes both in implementation technology and in overall design. 
+     */
+    
+    // Naming of statics: Maker at a place: X makeX(FileSet, MetaFile?, defaultBlockSize, defaultRecordFactory,
+    
+    // IndexBuilder for metadata files. 
+    
+    // Old code:
+    // IndexBuilders.  Or add a new IndexBuilder that can make from meta files.
+    
+    static public final String NodeTableType   = "dat" ; 
+    static public final String NodeTableLayout = "1" ;
+    
+    
+    /**  The JVM-wide parameters (these can change without a change to on-disk structure) */ 
+//    public final static Properties globalConfig = new Properties() ;
+//
+//    static {
+//        globalConfig.setProperty(Names.pNode2NodeIdCacheSize,  Integer.toString(Node2NodeIdCacheSize)) ;
+//        globalConfig.setProperty(Names.pNodeId2NodeCacheSize,  Integer.toString(NodeId2NodeCacheSize)) ;
+//        globalConfig.setProperty(Names.pNodeMissesCacheSize,   Integer.toString(NodeMissCacheSize)) ;
+//        globalConfig.setProperty(Names.pBlockWriteCacheSize,   Integer.toString(BlockWriteCacheSize)) ;
+//        globalConfig.setProperty(Names.pBlockReadCacheSize,    Integer.toString(BlockReadCacheSize)) ;
+////        globalConfig.setProperty(Names.pSyncTick,              Integer.toString(SyncTick)) ;
+//    }
+    
+    public static void error(Logger log, String msg)
+    {
+        if ( log != null )
+            log.error(msg) ;
+        throw new TDBException(msg) ;
+    }
+
+    public static int parseInt(String str, String messageBase)
+    {
+        try { return Integer.parseInt(str) ; }
+        catch (NumberFormatException ex) { error(log, messageBase+": "+str) ; return -1 ; }
+    }
+    
+    
+    private static SystemParams params = SystemParams.getStdSystemParams() ;
+
+    
+    public final static TDBSystemInfoMBean systemInfo = new TDBSystemInfoMBean() {
+		@Override
+        public int getSegmentSize()             { return SystemTDB.SegmentSize; }
+		@Override
+        public int getNodeId2NodeCacheSize()    { return params.NodeId2NodeCacheSize ; }
+		@Override
+        public int getNode2NodeIdCacheSize()    { return params.Node2NodeIdCacheSize ; }
+        @Override
+        public int getNodeMissCacheSize()       { return params.NodeMissCacheSize ; }
+		@Override
+        public int getBlockSize()               { return params.blockSize ; }
+		@Override
+        public int getBlockReadCacheSize()      { return params.readCacheSize ; }
+        @Override
+        public int getBlockWriteCacheSize()     { return params.writeCacheSize ; }
+	};
+	
+    // And here we make datasets ... 
+    public static DatasetGraphTDB buildDataset(Location location)
+    {
+        return DatasetBuilderStd.build(location) ;
+    }
+
+    //protected static DatasetControl createConcurrencyPolicy() { return new DatasetControlMRSW() ; }
+    
+    public static TripleTable makeTripleTable(Location location, NodeTable nodeTable, String dftPrimary, String[] dftIndexes, DatasetControl policy)
+    {
+        String primary = Names.primaryIndexTriples ;
+        String indexes[] = Names.tripleIndexes ;
+        
+        if ( indexes.length != 3 )
+            error(log, "Wrong number of triple table indexes: "+StrUtils.strjoin(",", indexes)) ;
+        log.debug("Triple table: "+primary+" :: "+StrUtils.strjoin(",", indexes)) ;
+        
+        TupleIndex tripleIndexes[] = makeTupleIndexes(location, primary, indexes, indexes) ;
+        if ( tripleIndexes.length != indexes.length )
+            error(log, "Wrong number of triple table tuples indexes: "+tripleIndexes.length) ;
+        TripleTable tripleTable = new TripleTable(tripleIndexes, nodeTable, policy) ;
+        return tripleTable ;
+    }
+    
+    public static QuadTable makeQuadTable(Location location, NodeTable nodeTable, String dftPrimary, String[] dftIndexes, DatasetControl policy)
+    {
+        String primary = Names.primaryIndexQuads ;
+        String indexes[] = Names.quadIndexes ;
+
+        if ( indexes.length != 6 )
+            error(log, "Wrong number of quad table indexes: "+StrUtils.strjoin(",", indexes)) ;
+        log.debug("Quad table: "+primary+" :: "+StrUtils.strjoin(",", indexes)) ;
+        
+        TupleIndex quadIndexes[] = makeTupleIndexes(location, primary, indexes, indexes) ;
+        if ( quadIndexes.length != indexes.length )
+            error(log, "Wrong number of quad table tuples indexes: "+quadIndexes.length) ;
+        QuadTable quadTable = new QuadTable(quadIndexes, nodeTable, policy) ;
+        return quadTable ;
+    }
+
+
+    public static DatasetPrefixesTDB makePrefixes(Location location, DatasetControl policy)
+    {
+        // The index using for Graph+Prefix => URI
+        String indexPrefixes = params.indexPrefix ;
+        String primary = params.primaryIndexPrefix ;
+        String indexes[] = params.prefixIndexes ;
+        
+        TupleIndex prefixIndexes[] = makeTupleIndexes(location, primary, indexes, new String[]{indexPrefixes}) ;
+        if ( prefixIndexes.length != indexes.length )
+            error(log, "Wrong number of triple table tuples indexes: "+prefixIndexes.length) ;
+        
+        // The nodetable.
+        String pnNode2Id = params.prefixNode2Id ;
+        String pnId2Node = params.prefixId2Node ;
+        
+        // No cache - the prefix mapping is a cache
+        NodeTable prefixNodes = makeNodeTable(location, pnNode2Id, -1, pnId2Node, -1, -1)  ;
+        
+        DatasetPrefixesTDB prefixes = new DatasetPrefixesTDB(prefixIndexes, prefixNodes, policy) ; 
+        
+        log.debug("Prefixes: "+StrUtils.strjoin(", ", indexes)) ;
+        
+        return prefixes ;
+    }
+
+    public static TupleIndex[] makeTupleIndexes(Location location, String primary, String[] descs, String[] filenames)
+    {
+        if ( primary.length() != 3 && primary.length() != 4 )
+            error(log, "Bad primary key length: "+primary.length()) ;
+
+        int indexRecordLen = primary.length()*NodeId.SIZE ;
+        TupleIndex indexes[] = new TupleIndex[descs.length] ;
+        for (int i = 0 ; i < indexes.length ; i++)
+            indexes[i] = makeTupleIndex(location, primary, descs[i], filenames[i], indexRecordLen) ;
+        return indexes ;
+    }
+    
+    public static TupleIndex makeTupleIndex(Location location,
+                                            String primary, String indexOrder, String indexName,
+                                            int keyLength)
+    {
+        FileSet fs = new FileSet(location, indexName) ;
+        int readCacheSize = params.readCacheSize ;
+        int writeCacheSize = params.writeCacheSize ;
+        
+        // Value part is null (zero length)
+        RangeIndex rIndex = makeRangeIndex(location, indexName, keyLength, 0, readCacheSize, writeCacheSize) ;
+        TupleIndex tupleIndex = new TupleIndexRecord(primary.length(), new ColumnMap(primary, indexOrder), rIndex.getRecordFactory(), rIndex) ;
+        return tupleIndex ;
+    }
+    
+    public static Index makeIndex(Location location, String indexName, 
+                                  int dftKeyLength, int dftValueLength, 
+                                  int readCacheSize,int writeCacheSize)
+    {
+        return makeRangeIndex(location, indexName, dftKeyLength, dftValueLength, readCacheSize, writeCacheSize) ;
+    }
+    
+    public static RangeIndex makeRangeIndex(Location location, String indexName, 
+                                             int dftKeyLength, int dftValueLength,
+                                             int readCacheSize,int writeCacheSize)
+    {
+         FileSet fs = new FileSet(location, indexName) ;
+         RangeIndex rIndex =  makeBPlusTree(fs, readCacheSize, writeCacheSize, dftKeyLength, dftValueLength) ;
+         return rIndex ;
+    }
+    
+    public static RangeIndex makeBPlusTree(FileSet fs, 
+                                           int readCacheSize, int writeCacheSize,
+                                           int dftKeyLength, int dftValueLength)
+    {
+        RecordFactory recordFactory = makeRecordFactory(dftKeyLength, dftValueLength) ;
+        int blkSize = params.blockSize ;
+        
+        // IndexBuilder.getBPlusTree().newRangeIndex(fs, recordFactory) ;
+        // Does not set order.
+        
+        int order = BPlusTreeParams.calcOrder(blkSize, recordFactory.recordLength()) ;
+        RangeIndex rIndex = createBPTree(fs, order, blkSize, readCacheSize, writeCacheSize, recordFactory) ;
+        return rIndex ;
+    }
+
+    public static RecordFactory makeRecordFactory(int keyLen, int valueLen)
+    {
+        return new RecordFactory(keyLen, valueLen) ;
+    }
+    
+    /** Make a NodeTable without cache and inline wrappers */ 
+    public static NodeTable makeNodeTableBase(Location location, String indexNode2Id, String indexId2Node)
+    {
+        if (location.isMem()) 
+            return NodeTableFactory.createMem(IndexBuilder.mem()) ;
+
+        /* Logical:
+         * # Node table.
+         * tdb.nodetable.mapping.node2id=node2id
+         * tdb.nodetable.mapping.id2node=id2node
+         * 
+         * Physical:
+         * 1- Index file for node2id
+         * 2- Cached direct lookup object file for id2node
+         *    Encoding. 
+         */   
+        
+        String nodeTableType = location.getMetaFile().getProperty(Names.kNodeTableType) ;
+
+        if (nodeTableType != null)
+        {
+            if ( ! nodeTableType.equals(NodeTableType))
+                log.debug("Explicit node table type: " + nodeTableType + " (ignored)") ;
+        }
+        else
+        {
+            location.getMetaFile().setProperty(Names.kNodeTableType, NodeTableType) ;
+            location.getMetaFile().setProperty(Names.kNodeTableLayout, NodeTableLayout) ;
+        }
+        
+        // -- make id to node mapping -- Names.indexId2Node
+        FileSet fsIdToNode = new FileSet(location, indexId2Node) ;
+        //checkMetadata(fsIdToNode.getMetaFile(), /*Names.kNodeTableType,*/ NodeTable.type) ; 
+        
+        ObjectFile stringFile = makeObjectFile(fsIdToNode) ;
+        
+        // -- make node to id mapping -- Names.indexNode2Id
+        // Make index of id to node (data table)
+        
+        // No caching at the index level - we use the internal caches of the node table.
+        Index nodeToId = makeIndex(location, indexNode2Id, LenNodeHash, SizeOfNodeId, -1 ,-1) ;
+        
+        // -- Make the node table using the components established above.
+        NodeTable nodeTable = new NodeTableNative(nodeToId, stringFile) ;
+        return nodeTable ;
+    }
+
+    /** Make a NodeTable with cache and inline wrappers */ 
+    public static NodeTable makeNodeTable(Location location)
+    {
+        return makeNodeTable(location,
+                             Names.indexNode2Id, SystemTDB.Node2NodeIdCacheSize,
+                             Names.indexId2Node, SystemTDB.NodeId2NodeCacheSize,
+                             SystemTDB.NodeMissCacheSize) ;
+    }
+
+    /** Make a NodeTable with cache and inline wrappers */ 
+    public static NodeTable makeNodeTable(Location location,
+                                          String indexNode2Id, int nodeToIdCacheSize,
+                                          String indexId2Node, int idToNodeCacheSize,
+                                          int nodeMissCacheSize)
+    {
+        NodeTable nodeTable = makeNodeTableBase(location, indexNode2Id, indexId2Node) ;
+        nodeTable = NodeTableCache.create(nodeTable, nodeToIdCacheSize, idToNodeCacheSize, nodeMissCacheSize) ; 
+        nodeTable = NodeTableInline.create(nodeTable) ;
+        return nodeTable ;
+    }
+
+    public static ObjectFile makeObjectFile(FileSet fsIdToNode)
+    {
+        String filename = fsIdToNode.filename(Names.extNodeData) ;
+        ObjectFile objFile = FileFactory.createObjectFileDisk(filename);
+        return objFile ;
+    }
+
+    //    /** Check and set default for the dataset design */
+//    public static MetaFile locationMetadata(Location location)
+//    {
+//        boolean newDataset = location.isMem() || ! FileOps.existsAnyFiles(location.getDirectoryPath()) ; 
+//
+//        MetaFile metafile = location.getMetaFile() ;
+//        boolean isPreMetadata = false ;
+//        
+//        if (!newDataset && metafile.existsMetaData())
+//        {
+//            // Existing metadata
+//            String verString = metafile.getProperty("tdb.create.version", "unknown") ;
+//            TDB.logInfo.debug("Location: " + location.toString()) ;
+//            TDB.logInfo.debug("Version:  " + verString) ;
+//        }
+//        else
+//        {
+//            // Not new ?, no metadata
+//            // Either it's brand new (so set the defaults)
+//            // or it's a pre-0.9 dataset (files exists)
+//
+//            if ( ! newDataset )
+//            {
+//                // Well-known name of the primary triples index.
+//                isPreMetadata = FileOps.exists(location.getPath("SPO.idn")) ;
+//                // PROBLEM.
+////                boolean b = FileOps.exists(location.getPath("SPO.idn")) ;
+////                if ( !b )
+////                {
+////                    log.error("Existing files but no metadata and not old-style fixed layout: "+location.getDirectoryPath()) ;
+////                    File d = new File(location.getDirectoryPath()) ;
+////                    File[] entries = d.listFiles() ;
+////                    for ( File f : d.listFiles()  )
+////                        log.error("File: "+f.getName()) ;
+////                    throw new TDBException("Can't build dataset: "+location) ;
+////                }
+////                isPreMetadata = true ;
+//            }
+//        }
+//            
+//        // Ensure defaults.
+//        
+//        if ( newDataset )
+//        {
+//            metafile.ensurePropertySet("tdb.create.version", TDB.VERSION) ;
+//            metafile.ensurePropertySet("tdb.created", Utils.nowAsXSDDateTimeString()) ;
+//        }
+//        
+//        if ( isPreMetadata )
+//        {
+//            // Existing location (has some files in it) but no metadata.
+//            // Fake it as TDB 0.8.1 (which did not have metafiles)
+//            // If it's the wrong file format, things do badly wrong later.
+//            metafile.ensurePropertySet("tdb.create.version", "0.8") ;
+//            metafile.setProperty(Names.kCreatedDate, Utils.nowAsXSDDateTimeString()) ;
+//        }
+//            
+//        metafile.ensurePropertySet("tdb.layout", "v1") ;
+//        metafile.ensurePropertySet("tdb.type", "standalone") ;
+//        
+//        String layout = metafile.getProperty("tdb.layout") ;
+//        
+//        if ( layout.equals("v1") )
+//        {
+//            metafile.ensurePropertySet("tdb.indexes.triples.primary", Names.primaryIndexTriples) ;
+//            metafile.ensurePropertySet("tdb.indexes.triples", StrUtils.strjoin(",", Names.tripleIndexes)) ;
+//
+//            metafile.ensurePropertySet("tdb.indexes.quads.primary", Names.primaryIndexQuads) ;
+//            metafile.ensurePropertySet("tdb.indexes.quads", StrUtils.strjoin(",", Names.quadIndexes)) ;
+//            
+//            metafile.ensurePropertySet("tdb.nodetable.mapping.node2id", Names.indexNode2Id) ;
+//            metafile.ensurePropertySet("tdb.nodetable.mapping.id2node", Names.indexId2Node) ;
+//            
+//            metafile.ensurePropertySet("tdb.prefixes.index.file", Names.indexPrefix) ;
+//            metafile.ensurePropertySet("tdb.prefixes.nodetable.mapping.node2id", Names.prefixNode2Id) ;
+//            metafile.ensurePropertySet("tdb.prefixes.nodetable.mapping.id2node", Names.prefixId2Node) ;
+//            
+//        }
+//        else
+//            SetupTDB_Y.error(log, "tdb.layout: expected v1") ;
+//            
+//        
+//        metafile.flush() ;
+//        return metafile ; 
+//    }
+//
+////    public static Index createIndex(FileSet fileset, RecordFactory recordFactory)
+////    {
+////        return chooseIndexBuilder(fileset).newIndex(fileset, recordFactory) ;
+////    }
+////    
+////    public static RangeIndex createRangeIndex(FileSet fileset, RecordFactory recordFactory)
+////    {
+////        // Block size control?
+////        return chooseIndexBuilder(fileset).newRangeIndex(fileset, recordFactory) ;
+////    }
+//    
+    /** Create a B+Tree using defaults */
+    public static RangeIndex createBPTree(FileSet fileset,
+                                          RecordFactory factory)
+    {
+        int readCacheSize = SystemTDB.BlockReadCacheSize ;
+        int writeCacheSize = SystemTDB.BlockWriteCacheSize ;
+        int blockSize = SystemTDB.BlockSize ;
+        if ( fileset.isMem() )
+        {
+            readCacheSize = 0 ;
+            writeCacheSize = 0 ;
+            blockSize = SystemTDB.BlockSizeTest ;
+        }
+        
+        return createBPTreeByBlockSize(fileset, blockSize, readCacheSize, writeCacheSize, factory) ; 
+    }
+    
+    /** Create a B+Tree by BlockSize */
+    public static RangeIndex createBPTreeByBlockSize(FileSet fileset,
+                                                     int blockSize,
+                                                     int readCacheSize, int writeCacheSize,
+                                                     RecordFactory factory)
+    {
+        return createBPTree(fileset, -1, blockSize, readCacheSize, writeCacheSize, factory) ; 
+    }
+    
+    /** Create a B+Tree by Order */
+    public static RangeIndex createBPTreeByOrder(FileSet fileset,
+                                                 int order,
+                                                 int readCacheSize, int writeCacheSize,
+                                                 RecordFactory factory)
+    {
+        return createBPTree(fileset, order, -1, readCacheSize, writeCacheSize, factory) ; 
+    }
+    
+
+    /** Knowing all the parameters, create a B+Tree */
+    public static BPlusTree createBPTree(FileSet fileset, int order, int blockSize,
+                                          int readCacheSize, int writeCacheSize,
+                                          RecordFactory factory)
+    {
+        // ---- Checking
+        if (blockSize < 0 && order < 0) throw new IllegalArgumentException("Neither blocksize nor order specified") ;
+        if (blockSize >= 0 && order < 0) order = BPlusTreeParams.calcOrder(blockSize, factory.recordLength()) ;
+        if (blockSize >= 0 && order >= 0)
+        {
+            int order2 = BPlusTreeParams.calcOrder(blockSize, factory.recordLength()) ;
+            if (order != order2) throw new IllegalArgumentException("Wrong order (" + order + "), calculated = "
+                                                                    + order2) ;
+        }
+    
+        // Iffy - does not allow for slop.
+        if (blockSize < 0 && order >= 0)
+        {
+            // Only in-memory.
+            blockSize = BPlusTreeParams.calcBlockSize(order, factory) ;
+        }
+    
+        BPlusTreeParams params = new BPlusTreeParams(order, factory) ;
+        BlockMgr blkMgrNodes = BlockMgrFactory.create(fileset, Names.bptExtTree, blockSize, readCacheSize, writeCacheSize) ;
+        BlockMgr blkMgrRecords = BlockMgrFactory.create(fileset, Names.bptExtRecords, blockSize, readCacheSize, writeCacheSize) ;
+        return BPlusTree.create(params, blkMgrNodes, blkMgrRecords) ;
+    }
+}

Modified: incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/DatasetBuilderTxn.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/DatasetBuilderTxn.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/DatasetBuilderTxn.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/main/java/com/hp/hpl/jena/tdb/transaction/DatasetBuilderTxn.java Fri Jan 20 13:23:50 2012
@@ -73,7 +73,7 @@ public class DatasetBuilderTxn
         BlockMgrBuilder blockMgrBuilder = new BlockMgrBuilderReadonly() ;
         NodeTableBuilder nodeTableBuilder = new NodeTableBuilderReadonly() ;
         DatasetBuilderStd x = new DatasetBuilderStd(blockMgrBuilder, nodeTableBuilder) ;
-        DatasetGraphTDB dsg2 = x.build(dsg.getLocation(), dsg.getConfig().properties) ;
+        DatasetGraphTDB dsg2 = x.build(dsg.getLocation(), dsg.getConfig().params) ;
         return new DatasetGraphTxn(dsg2, txn) ;
     }
 
@@ -82,7 +82,7 @@ public class DatasetBuilderTxn
         BlockMgrBuilder blockMgrBuilder = new BlockMgrBuilderTx() ;
         NodeTableBuilder nodeTableBuilder = new NodeTableBuilderTx() ;
         DatasetBuilderStd x = new DatasetBuilderStd(blockMgrBuilder, nodeTableBuilder) ;
-        DatasetGraphTDB dsg2 = x.build(dsg.getLocation(), dsg.getConfig().properties) ;
+        DatasetGraphTDB dsg2 = x.build(dsg.getLocation(), dsg.getConfig().params) ;
         return new DatasetGraphTxn(dsg2, txn) ;
     }
 

Modified: incubator/jena/Jena2/TDB/trunk/src/main/java/tdb/CmdRewriteIndex.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/main/java/tdb/CmdRewriteIndex.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/main/java/tdb/CmdRewriteIndex.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/main/java/tdb/CmdRewriteIndex.java Fri Jan 20 13:23:50 2012
@@ -34,7 +34,7 @@ import com.hp.hpl.jena.tdb.index.bplustr
 import com.hp.hpl.jena.tdb.index.bplustree.BPlusTreeParams ;
 import com.hp.hpl.jena.tdb.index.bplustree.BPlusTreeRewriter ;
 import com.hp.hpl.jena.tdb.sys.Names ;
-import com.hp.hpl.jena.tdb.sys.SetupTDB ;
+import com.hp.hpl.jena.tdb.sys.SetupTDB_Y ;
 import com.hp.hpl.jena.tdb.sys.SystemTDB ;
 
 /** Rewrite one index */
@@ -108,7 +108,7 @@ public class CmdRewriteIndex
         int blockSize = SystemTDB.BlockSize ;
         Iterator<Record> iterator ;
         
-        RangeIndex rangeIndex = SetupTDB.makeRangeIndex(srcLoc, indexName, dftKeyLength, dftValueLength, readCacheSize, writeCacheSize) ;
+        RangeIndex rangeIndex = SetupTDB_Y.makeRangeIndex(srcLoc, indexName, dftKeyLength, dftValueLength, readCacheSize, writeCacheSize) ;
         BPlusTree bpt = (BPlusTree)rangeIndex ;
         bptParams = bpt.getParams() ;
         recordFactory = bpt.getRecordFactory() ;

Modified: incubator/jena/Jena2/TDB/trunk/src/main/java/tdb/cmdline/CmdTDB.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/main/java/tdb/cmdline/CmdTDB.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/main/java/tdb/cmdline/CmdTDB.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/main/java/tdb/cmdline/CmdTDB.java Fri Jan 20 13:23:50 2012
@@ -34,8 +34,8 @@ import com.hp.hpl.jena.query.Dataset ;
 import com.hp.hpl.jena.sparql.util.Utils ;
 import com.hp.hpl.jena.tdb.TDB ;
 import com.hp.hpl.jena.tdb.base.file.Location ;
+import com.hp.hpl.jena.tdb.setup.DatasetBuilderStd ;
 import com.hp.hpl.jena.tdb.store.DatasetGraphTDB ;
-import com.hp.hpl.jena.tdb.sys.SetupTDB ;
 
 public abstract class CmdTDB extends CmdARQ
 {
@@ -103,7 +103,7 @@ public abstract class CmdTDB extends Cmd
         InputStream in = new ByteArrayInputStream(StrUtils.asUTF8bytes(log4Jsetup)) ;
         try { p.load(in) ; } catch (IOException ex) {}
         PropertyConfigurator.configure(p) ;
-        SetupTDB.setOptimizerWarningFlag(false) ;
+        DatasetBuilderStd.setOptimizerWarningFlag(false) ;
         System.setProperty("log4j.configuration", "set") ;
     }
 

Modified: incubator/jena/Jena2/TDB/trunk/src/main/java/tdb/tdbconfig.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/main/java/tdb/tdbconfig.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/main/java/tdb/tdbconfig.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/main/java/tdb/tdbconfig.java Fri Jan 20 13:23:50 2012
@@ -40,7 +40,7 @@ import com.hp.hpl.jena.tdb.solver.stats.
 import com.hp.hpl.jena.tdb.solver.stats.StatsCollector ;
 import com.hp.hpl.jena.tdb.store.GraphTDB ;
 import com.hp.hpl.jena.tdb.sys.DatasetControlNone ;
-import com.hp.hpl.jena.tdb.sys.SetupTDB ;
+import com.hp.hpl.jena.tdb.sys.SetupTDB_Y ;
 
 /** Tools to manage a TDB store.  Subcommand based. */
 public class tdbconfig extends CmdSub
@@ -104,7 +104,7 @@ public class tdbconfig extends CmdSub
         protected void exec()
         {
             Location location = getLocation() ;
-            DatasetPrefixStorage prefixes = SetupTDB.makePrefixes(location, SetupTDB.globalConfig, new DatasetControlNone()) ;
+            DatasetPrefixStorage prefixes = SetupTDB_Y.makePrefixes(location, new DatasetControlNone()) ;
             for ( String gn : prefixes.graphNames() )
             {
                 System.out.println("Graph: "+gn) ;

Modified: incubator/jena/Jena2/TDB/trunk/src/main/java/tdb/tools/dumpnodetable.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/main/java/tdb/tools/dumpnodetable.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/main/java/tdb/tools/dumpnodetable.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/main/java/tdb/tools/dumpnodetable.java Fri Jan 20 13:23:50 2012
@@ -38,7 +38,7 @@ import com.hp.hpl.jena.tdb.nodetable.Nod
 import com.hp.hpl.jena.tdb.store.DatasetGraphTDB ;
 import com.hp.hpl.jena.tdb.store.NodeId ;
 import com.hp.hpl.jena.tdb.sys.Names ;
-import com.hp.hpl.jena.tdb.sys.SetupTDB ;
+import com.hp.hpl.jena.tdb.sys.SetupTDB_Y ;
 import com.hp.hpl.jena.tdb.sys.SystemTDB ;
 import com.hp.hpl.jena.tdb.sys.TDBMaker ;
 
@@ -83,10 +83,11 @@ public class dumpnodetable extends CmdGe
     
     public static void dump(OutputStream w, String location, 
                             String indexNode2Id, int node2NodeIdCacheSize, 
-                            String indexId2Node, int nodeId2NodeCacheSize, 
+                            String indexId2Node, int nodeId2NodeCacheSize, //
+
                             int sizeNodeMissCacheSize)
     {
-        NodeTable nodeTable = SetupTDB.makeNodeTable(new Location(location), 
+        NodeTable nodeTable = SetupTDB_Y.makeNodeTable(new Location(location), 
                                                      indexNode2Id, node2NodeIdCacheSize,
                                                      indexId2Node, nodeId2NodeCacheSize,
                                                      sizeNodeMissCacheSize) ;

Modified: incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/index/bplustree/TestBPlusTreeRewriter.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/index/bplustree/TestBPlusTreeRewriter.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/index/bplustree/TestBPlusTreeRewriter.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/index/bplustree/TestBPlusTreeRewriter.java Fri Jan 20 13:23:50 2012
@@ -35,7 +35,7 @@ import com.hp.hpl.jena.tdb.base.file.Fil
 import com.hp.hpl.jena.tdb.base.record.Record ;
 import com.hp.hpl.jena.tdb.base.record.RecordFactory ;
 import com.hp.hpl.jena.tdb.sys.Names ;
-import com.hp.hpl.jena.tdb.sys.SetupTDB ;
+import com.hp.hpl.jena.tdb.sys.SetupTDB_Y ;
 
 public class TestBPlusTreeRewriter extends BaseTest
 {
@@ -169,8 +169,7 @@ public class TestBPlusTreeRewriter exten
     static List<Record> createData2(int ORDER, int N, RecordFactory recordFactory)
     {
         // Use a B+Tree - so original data can be unsorted.
-        BPlusTree bpt = (BPlusTree)SetupTDB.createBPTree(FileSet.mem(), ORDER, -1, -1, -1, recordFactory) ;
-        //BPlusTree bpt = BPlusTree.makeMem(ORDER, bptParams.getMinRec() , 4, 0) ;
+        BPlusTree bpt = SetupTDB_Y.createBPTree(FileSet.mem(), ORDER, -1, -1, -1, recordFactory) ;
 
         //BPlusTreeParams.checkAll() ;
         // 200 -> runt leaf problem.

Modified: incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/nodetable/TestNodeTable.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/nodetable/TestNodeTable.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/nodetable/TestNodeTable.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/nodetable/TestNodeTable.java Fri Jan 20 13:23:50 2012
@@ -19,15 +19,14 @@
 package com.hp.hpl.jena.tdb.nodetable;
 
 import com.hp.hpl.jena.tdb.base.file.Location ;
-import com.hp.hpl.jena.tdb.nodetable.NodeTable ;
 import com.hp.hpl.jena.tdb.sys.Names ;
-import com.hp.hpl.jena.tdb.sys.SetupTDB ;
+import com.hp.hpl.jena.tdb.sys.SetupTDB_Y ;
 
 public class TestNodeTable extends TestNodeTableBase
 {
     @Override
     protected NodeTable createEmptyNodeTable()
     {
-        return SetupTDB.makeNodeTable(Location.mem(), Names.indexNode2Id, 10, Names.indexId2Node, 10, 10) ;
+        return SetupTDB_Y.makeNodeTable(Location.mem(), Names.indexNode2Id, 10, Names.indexId2Node, 10, 10) ;
     }
 }

Modified: incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/nodetable/TestNodeTableStored.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/nodetable/TestNodeTableStored.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/nodetable/TestNodeTableStored.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/nodetable/TestNodeTableStored.java Fri Jan 20 13:23:50 2012
@@ -19,15 +19,14 @@
 package com.hp.hpl.jena.tdb.nodetable;
 
 import com.hp.hpl.jena.tdb.base.file.Location ;
-import com.hp.hpl.jena.tdb.nodetable.NodeTable ;
 import com.hp.hpl.jena.tdb.sys.Names ;
-import com.hp.hpl.jena.tdb.sys.SetupTDB ;
+import com.hp.hpl.jena.tdb.sys.SetupTDB_Y ;
 
 public class TestNodeTableStored extends TestNodeTableBase
 {
     @Override
     protected NodeTable createEmptyNodeTable()
     {
-        return SetupTDB.makeNodeTableBase(Location.mem(), Names.indexNode2Id, Names.indexId2Node) ;
+        return SetupTDB_Y.makeNodeTableBase(Location.mem(), Names.indexNode2Id, Names.indexId2Node) ;
     }
 }

Modified: incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/store/TestTripleTable.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/store/TestTripleTable.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/store/TestTripleTable.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/store/TestTripleTable.java Fri Jan 20 13:23:50 2012
@@ -29,7 +29,7 @@ import com.hp.hpl.jena.graph.Node ;
 import com.hp.hpl.jena.graph.Triple ;
 import com.hp.hpl.jena.sparql.util.NodeFactory ;
 import com.hp.hpl.jena.tdb.base.file.Location ;
-import com.hp.hpl.jena.tdb.sys.SetupTDB ;
+import com.hp.hpl.jena.tdb.setup.DatasetBuilderStd ;
 
 public class TestTripleTable extends BaseTest
 {
@@ -127,7 +127,7 @@ public class TestTripleTable extends Bas
     
     private TripleTable createTripleTableMem()
     {
-        DatasetGraphTDB ds = SetupTDB.buildDataset(Location.mem()) ; 
+        DatasetGraphTDB ds = DatasetBuilderStd.build(Location.mem()) ; 
         return ds.getTripleTable() ;
     }
 }

Modified: incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/store/Test_SPARQL_TDB.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/store/Test_SPARQL_TDB.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/store/Test_SPARQL_TDB.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/store/Test_SPARQL_TDB.java Fri Jan 20 13:23:50 2012
@@ -29,15 +29,23 @@ import com.hp.hpl.jena.query.Query ;
 import com.hp.hpl.jena.query.QueryExecution ;
 import com.hp.hpl.jena.query.QueryExecutionFactory ;
 import com.hp.hpl.jena.query.QueryFactory ;
+import com.hp.hpl.jena.query.ReadWrite ;
 import com.hp.hpl.jena.query.ResultSet ;
 import com.hp.hpl.jena.query.ResultSetFormatter ;
 import com.hp.hpl.jena.rdf.model.Model ;
 import com.hp.hpl.jena.rdf.model.ModelFactory ;
 import com.hp.hpl.jena.sparql.sse.SSE ;
 import com.hp.hpl.jena.tdb.TDBFactory ;
+import com.hp.hpl.jena.tdb.base.file.Location ;
+import com.hp.hpl.jena.update.GraphStore ;
+import com.hp.hpl.jena.update.GraphStoreFactory ;
+import com.hp.hpl.jena.update.UpdateExecutionFactory ;
+import com.hp.hpl.jena.update.UpdateFactory ;
+import com.hp.hpl.jena.update.UpdateProcessor ;
+import com.hp.hpl.jena.update.UpdateRequest ;
 
 /**
- * Test SPARQL on the raw storage dataset.
+ * Test SPARQL
  */
 public class Test_SPARQL_TDB extends BaseTest
 {
@@ -46,6 +54,11 @@ public class Test_SPARQL_TDB extends Bas
         return TDBFactory.createDataset() ;
     }
     
+    private static Dataset create(Location location) 
+    {
+        return TDBFactory.createDataset(location) ;
+    }
+
     
     @Test public void sparql1()
     {
@@ -111,4 +124,72 @@ public class Test_SPARQL_TDB extends Bas
         int n = ResultSetFormatter.consume(rs) ;
         assertEquals(1, n) ;
     }
+    
+    // Test transactions effective.
+    
+    @Test public void sparql_txn_1()
+    {
+        Dataset dataset = create() ;
+        update(dataset, "INSERT DATA { <x:s> <x:p> <x:o> }") ;
+
+        dataset.begin(ReadWrite.READ) ;
+        try {
+            int n = count(dataset) ;
+            assertEquals(1, n) ;
+            n = count(dataset, "SELECT * { <x:s> <x:p> <x:o>}") ;
+            assertEquals(1, n) ;
+        } finally { dataset.end() ; }
+    }
+
+    @Test public void sparql_txn_2()
+    {
+        Dataset dataset1 = create(Location.mem("foo")) ;
+        Dataset dataset2 = create(Location.mem("foo")) ;
+        
+        // Test the test setup.
+        update(dataset1, "INSERT DATA { <x:s> <x:p> <x:o> }") ;
+        //TDB.sync(dataset1) ;
+        assertEquals(1, count(dataset2)) ;
+        
+        dataset1.begin(ReadWrite.READ) ;
+        
+        dataset2.begin(ReadWrite.WRITE) ;
+        update(dataset2, "INSERT DATA { <x:s> <x:p> <x:o2> }") ;
+        
+        assertEquals(1, count(dataset1)) ;
+        assertEquals(2, count(dataset2)) ;
+        dataset2.commit();
+        dataset2.end() ;
+        
+        // This is 2 if dataset1 is not in a transaction
+        // but that replies on dataset2 commit doing the write back.
+        assertEquals(1, count(dataset1)) ;  
+        
+        dataset1.end() ;
+        
+        dataset1.begin(ReadWrite.READ) ;
+        assertEquals(2, count(dataset1)) ;
+        dataset1.end() ;
+    }
+
+    private int count(Dataset dataset)
+    { return count(dataset, "SELECT * { ?s ?p ?o }") ; }
+    
+    private int count(Dataset dataset, String queryString)
+    
+    {
+        Query query = QueryFactory.create(queryString) ;
+        QueryExecution qExec = QueryExecutionFactory.create(query, dataset) ;
+        ResultSet rs = qExec.execSelect() ;
+        return ResultSetFormatter.consume(rs) ;
+    }
+
+
+    private void update(Dataset dataset, String string)
+    {
+        UpdateRequest req = UpdateFactory.create(string) ;
+        GraphStore gs = GraphStoreFactory.create(dataset) ;
+        UpdateProcessor proc = UpdateExecutionFactory.create(req, gs) ;
+        proc.execute() ;
+    }
 }

Modified: incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/transaction/AbstractTestNodeTableTrans.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/transaction/AbstractTestNodeTableTrans.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/transaction/AbstractTestNodeTableTrans.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/transaction/AbstractTestNodeTableTrans.java Fri Jan 20 13:23:50 2012
@@ -31,7 +31,7 @@ import com.hp.hpl.jena.tdb.index.Index ;
 import com.hp.hpl.jena.tdb.index.IndexMap ;
 import com.hp.hpl.jena.tdb.nodetable.NodeTable ;
 import com.hp.hpl.jena.tdb.store.NodeId ;
-import com.hp.hpl.jena.tdb.sys.SetupTDB ;
+import com.hp.hpl.jena.tdb.sys.SetupTDB_Y ;
 import com.hp.hpl.jena.tdb.sys.SystemTDB ;
 
 public abstract class AbstractTestNodeTableTrans extends BaseTest
@@ -41,7 +41,7 @@ public abstract class AbstractTestNodeTa
     
     private NodeTableTrans create(Transaction txn, Node...nodes)
     {
-        NodeTable base = SetupTDB.makeNodeTable(getLocation()) ;
+        NodeTable base = SetupTDB_Y.makeNodeTable(getLocation()) ;
         for ( Node n : nodes )
             base.getAllocateNodeId(n) ;
         return create(txn, base) ;

Modified: incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/transaction/TestNodeTableTransDisk.java
URL: http://svn.apache.org/viewvc/incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/transaction/TestNodeTableTransDisk.java?rev=1233902&r1=1233901&r2=1233902&view=diff
==============================================================================
--- incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/transaction/TestNodeTableTransDisk.java (original)
+++ incubator/jena/Jena2/TDB/trunk/src/test/java/com/hp/hpl/jena/tdb/transaction/TestNodeTableTransDisk.java Fri Jan 20 13:23:50 2012
@@ -18,15 +18,15 @@
 
 package com.hp.hpl.jena.tdb.transaction;
 
-import org.junit.Before;
+import org.junit.Before ;
 import org.openjena.atlas.lib.FileOps ;
 
 import com.hp.hpl.jena.tdb.ConfigTest ;
 import com.hp.hpl.jena.tdb.base.file.FileSet ;
 import com.hp.hpl.jena.tdb.base.file.Location ;
 import com.hp.hpl.jena.tdb.base.objectfile.ObjectFile ;
-import com.hp.hpl.jena.tdb.sys.SetupTDB ;
-import com.hp.hpl.jena.tdb.sys.SystemTDB;
+import com.hp.hpl.jena.tdb.sys.SetupTDB_Y ;
+import com.hp.hpl.jena.tdb.sys.SystemTDB ;
 
 public class TestNodeTableTransDisk extends AbstractTestNodeTableTrans
 {
@@ -45,7 +45,7 @@ public class TestNodeTableTransDisk exte
     protected ObjectFile createObjectFile()
     {
         FileSet fs = new FileSet(loc, "data") ;
-        return SetupTDB.makeObjectFile(fs) ;
+        return SetupTDB_Y.makeObjectFile(fs) ;
     }
 
     @Override