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 2017/10/03 19:33:55 UTC

[09/65] [abbrv] jena git commit: JENA-1397: Rename java packages

http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/tupletable/TupleIndex.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/tupletable/TupleIndex.java b/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/tupletable/TupleIndex.java
deleted file mode 100644
index dbc11fe..0000000
--- a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/tupletable/TupleIndex.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * 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 org.seaborne.tdb2.store.tupletable;
-
-import java.util.Collection ;
-import java.util.Iterator ;
-
-import org.apache.jena.atlas.lib.Closeable ;
-import org.apache.jena.atlas.lib.Sync ;
-import org.apache.jena.atlas.lib.tuple.Tuple ;
-import org.apache.jena.atlas.lib.tuple.TupleMap ;
-import org.seaborne.tdb2.store.NodeId ;
-
-public interface TupleIndex extends Sync, Closeable
-{
-    /** Insert a tuple */
-    public void add(Tuple<NodeId> tuple) ;
-
-    /** Delete a tuple */
-    public void delete(Tuple<NodeId> tuple) ; 
-
-    /** Insert tuples */
-    public void addAll(Collection<Tuple<NodeId>> tuples) ;
-    
-    /** Delete tuples */
-    public void deleteAll(Collection<Tuple<NodeId>> tuples) ;
-    
-    /** Get a convenient display string for the index - do not rely on the format */ 
-    public String getName() ;
-    
-    /** Get a convenient display string based on the details of the column map - do not rely on the format */ 
-    public String getMappingStr() ;
-    
-    /** Get the mapping of tuples used by this index */  
-    public TupleMap getMapping() ;
-    
-    /** Find all matching tuples - a slot of NodeId.NodeIdAny (or null) means match any.
-     *  Input pattern in natural order, not index order.
-     */
-    public Iterator<Tuple<NodeId>> find(Tuple<NodeId> pattern) ;
-    
-    /** return an iterator of everything */
-    public Iterator<Tuple<NodeId>> all() ;
-    
-    /** Weight a pattern - specified in normal order (not index order).
-     * Large numbers means better match. */
-    public int weight(Tuple<NodeId> pattern) ;
-
-    /** Length of tuple supported */
-    public int getTupleLength() ;
-
-    /** Size of index (number of slots). May be an estimate and not exact. -1 for unknown.  */
-    public long size() ;
-
-    /** Answer whether empty or not */
-    public boolean isEmpty() ;
-    
-    /** Clear the index */
-    public void clear() ;
-    
-    /** Return a TupleIndex if this instance wraps another, else return null */  
-    public TupleIndex wrapped() ; 
-    
-    default public TupleIndex baseTupleIndex() {
-        TupleIndex index = this ;
-        TupleIndex index2 = null ;
-        while( (index2 = index.wrapped()) != null ) {
-            index = index2 ;
-        }
-        return index ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/tupletable/TupleIndexBase.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/tupletable/TupleIndexBase.java b/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/tupletable/TupleIndexBase.java
deleted file mode 100644
index 39da3c4..0000000
--- a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/tupletable/TupleIndexBase.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * 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 org.seaborne.tdb2.store.tupletable;
-
-import java.util.Iterator ;
-
-import org.apache.jena.atlas.lib.tuple.Tuple ;
-import org.apache.jena.atlas.lib.tuple.TupleMap ;
-import org.seaborne.tdb2.TDBException ;
-import org.seaborne.tdb2.store.NodeId ;
-
-public abstract class TupleIndexBase implements TupleIndex
-{
-    private static final boolean Check = false ;
-
-    protected final TupleMap tupleMap ;
-    protected final int tupleLength ;
-
-    private final String name ;
-    
-    protected TupleIndexBase(int N, TupleMap indexMapping, String name)
-    {
-        this.tupleLength = N ;
-        this.tupleMap = indexMapping ;
-        this.name = name ;
-    }
-    
-    @Override
-    public TupleIndex wrapped() {
-        return null ;
-    }
-    
-    /** Add tuple worker: Tuple passed in unmapped (untouched) order */
-    protected abstract void performAdd(Tuple<NodeId> tuple) ;
-    
-    /** Delete tuple worker: Tuple passed in unmapped (untouched) order */
-    protected abstract void performDelete(Tuple<NodeId> tuple) ;
-    
-    /** Find tuples worker: Tuple passed in unmaped (untouched) order */
-    protected abstract Iterator<Tuple<NodeId>> performFind(Tuple<NodeId> tuple) ;
-
-    /** Insert a tuple */
-    @Override
-    public final void add(Tuple<NodeId> tuple) 
-    { 
-        if ( Check ) {
-            if ( tupleLength != tuple.len() )
-                throw new TDBException(String.format("Mismatch: tuple length %d / index for length %d", tuple.len(), tupleLength));
-        }
-        performAdd(tuple) ;
-    }
-    /** Delete a tuple */
-    @Override
-    public final void delete(Tuple<NodeId> tuple) 
-    { 
-        if ( Check ) {
-            if ( tupleLength != tuple.len() )
-                throw new TDBException(String.format("Mismatch: tuple length %d / index for length %d", tuple.len(), tupleLength));
-        }
-
-        performDelete(tuple) ;
-    }
-
-    /** Find all matching tuples - a slot of NodeId.NodeIdAny (or null) means match any.
-     *  Input pattern in natural order, not index order.
-     */
-    @Override
-    public final Iterator<Tuple<NodeId>> find(Tuple<NodeId> pattern)
-    {
-        if ( Check ) {
-            if ( tupleLength != pattern.len() )
-                throw new TDBException(String.format("Mismatch: tuple length %d / index for length %d", pattern.len(), tupleLength));
-        }
-        // null to NodeId.NodIdAny ??
-        return performFind(pattern) ;
-    }
-    
-    @Override
-    public final int weight(Tuple<NodeId> pattern)
-    {
-        for ( int i = 0 ; i < tupleLength ; i++ )
-        {
-            NodeId X = tupleMap.mapSlot(i, pattern) ;
-            if ( undef(X) )
-                // End of fixed terms
-                return i ;
-        }
-        return tupleLength ;
-    }
-    
-    @Override
-    public final String getMappingStr()     { return tupleMap.getLabel() ; }
-
-    @Override
-    public final String getName()           { return name ; }
-
-    @Override
-    public final int getTupleLength()       { return tupleLength ; }
-
-    @Override
-    public final TupleMap getMapping()      { return tupleMap ;  }
-    
-    protected final boolean undef(NodeId x)
-    { return NodeId.isAny(x) ; }
-    
-    @Override
-    public String toString() { return "index:"+getName() ; }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/tupletable/TupleIndexRecord.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/tupletable/TupleIndexRecord.java b/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/tupletable/TupleIndexRecord.java
deleted file mode 100644
index 7a7d114..0000000
--- a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/tupletable/TupleIndexRecord.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*
- * 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 org.seaborne.tdb2.store.tupletable;
-
-import static java.lang.String.format ;
-import static org.seaborne.tdb2.sys.SystemTDB.SizeOfNodeId ;
-
-import java.util.Collection ;
-import java.util.Iterator ;
-import java.util.function.Predicate ;
-
-import org.apache.jena.atlas.iterator.Iter ;
-import org.apache.jena.atlas.iterator.NullIterator ;
-import org.apache.jena.atlas.iterator.SingletonIterator ;
-import org.apache.jena.atlas.lib.tuple.Tuple ;
-import org.apache.jena.atlas.lib.tuple.TupleMap ;
-import org.seaborne.dboe.base.record.Record ;
-import org.seaborne.dboe.base.record.RecordFactory ;
-import org.seaborne.dboe.index.RangeIndex ;
-import org.seaborne.tdb2.TDBException ;
-import org.seaborne.tdb2.lib.TupleLib ;
-import org.seaborne.tdb2.store.NodeId ;
-import org.seaborne.tdb2.store.NodeIdFactory;
-
-public class TupleIndexRecord extends TupleIndexBase
-{
-    private static final boolean Check = false ;
-    private RangeIndex index ; 
-    private RecordFactory factory ;
-    
-    public TupleIndexRecord(int N,  TupleMap tupleMapping, String name, RecordFactory factory, RangeIndex index)
-    {
-        super(N, tupleMapping, name) ;
-        this.factory = factory ;
-        this.index = index ;
-        
-        if ( factory.keyLength() != N*SizeOfNodeId)
-            throw new TDBException(format("Mismatch: TupleIndex of length %d is not comparative with a factory for key length %d", N, factory.keyLength())) ;
-    }
-    
-    /** Insert a tuple */
-    @Override
-    protected void performAdd(Tuple<NodeId> tuple) { 
-        Record r = TupleLib.record(factory, tuple, tupleMap) ;
-        index.insert(r) ;
-    }
-    
-    /** Delete a tuple */
-    @Override
-    protected void performDelete(Tuple<NodeId> tuple) { 
-        Record r = TupleLib.record(factory, tuple, tupleMap) ;
-        index.delete(r) ;
-    }
-    
-    /** Insert tuples */
-    @Override
-    public void addAll(Collection<Tuple<NodeId>> tuples) {
-        for ( Tuple<NodeId> t : tuples ) 
-            add(t) ;
-    }
-    
-    /** Delete tuples */
-    @Override
-    public void deleteAll(Collection<Tuple<NodeId>> tuples) {
-        for ( Tuple<NodeId> t : tuples ) 
-            delete(t) ;
-    }
-    
-    /** Find all matching tuples - a slot of NodeId.NodeIdAny (or null) means match any.
-     *  Input pattern in natural order, not index order.
-     */
-    
-    @Override
-    protected Iterator<Tuple<NodeId>> performFind(Tuple<NodeId> pattern) {
-        return findOrScan(pattern) ;
-    }
-
-    // Package visibility for testing.
-    final Iterator<Tuple<NodeId>> findOrScan(Tuple<NodeId> pattern) {
-        return findWorker(pattern, true, true) ;
-    }
-    
-    final Iterator<Tuple<NodeId>> findOrPartialScan(Tuple<NodeId> pattern) {
-        return findWorker(pattern, true, false) ;
-    }
-
-    final Iterator<Tuple<NodeId>> findByIndex(Tuple<NodeId> pattern) {
-        return findWorker(pattern, false, false) ;
-    }
-    
-    private Iterator<Tuple<NodeId>> findWorker(Tuple<NodeId> patternNaturalOrder, boolean partialScanAllowed, boolean fullScanAllowed) {
-        if ( Check )
-        {
-            if ( tupleLength != patternNaturalOrder.len() )
-            throw new TDBException(String.format("Mismatch: tuple length %d / index for length %d", patternNaturalOrder.len(), tupleLength)) ;
-        } 
-        
-        // Convert to index order.
-        Tuple<NodeId> pattern = tupleMap.map(patternNaturalOrder) ;
-        
-        // Canonical form.
-        int numSlots = 0 ;
-        int leadingIdx = -2;    // Index of last leading pattern NodeId.  Start less than numSlots-1
-        boolean leading = true ;
-        
-        // Records.
-        Record minRec = factory.createKeyOnly() ;
-        Record maxRec = factory.createKeyOnly() ;
-        
-        // Set the prefixes.
-        for ( int i = 0 ; i < pattern.len() ; i++ ) {
-            NodeId X = pattern.get(i) ;
-            if ( NodeId.isAny(X) ) {
-                X = null ;
-                // No longer seting leading key slots.
-                leading = false ;
-                continue ;
-            }
-//            if ( NodeId.isDoesNotExist(X) )
-//                return Iter.nullIterator();
-
-            numSlots++ ;
-            if ( leading ) {
-                leadingIdx = i ;
-                NodeIdFactory.set(X, minRec.getKey(), i*SizeOfNodeId) ;
-                NodeIdFactory.set(X, maxRec.getKey(), i*SizeOfNodeId) ;
-            }
-        }
-        
-        // Is it a simple existence test?
-        if ( numSlots == pattern.len() ) {
-            if ( index.contains(minRec) )
-                return new SingletonIterator<>(pattern) ;
-            else
-                return new NullIterator<>() ;
-        }
-        
-        Iterator<Record> iter = null ;
-        
-        if ( leadingIdx < 0 ) {
-            if ( ! fullScanAllowed )
-                return null ;
-            //System.out.println("Full scan") ;
-            // Full scan necessary
-            iter = index.iterator() ;
-        } else {
-            // Adjust the maxRec.
-            NodeId X = pattern.get(leadingIdx) ;
-            // Set the max Record to the leading NodeIds, +1.
-            // Example, SP? inclusive to S(P+1)? exclusive where ? is zero. 
-            NodeIdFactory.setNext(X, maxRec.getKey(), leadingIdx*SizeOfNodeId) ;
-            iter = index.iterator(minRec, maxRec) ;
-        }
-        
-        Iterator<Tuple<NodeId>> tuples = Iter.map(iter, item -> TupleLib.tuple(item, tupleMap)) ;
-        
-        if ( leadingIdx < numSlots-1 ) {
-            if ( ! partialScanAllowed )
-                return null ;
-            // Didn't match all defined slots in request.  
-            // Partial or full scan needed.
-            //pattern.unmap(colMap) ;
-            tuples = scan(tuples, patternNaturalOrder) ;
-        }
-        
-        return tuples ;
-    }
-    
-    @Override
-    public Iterator<Tuple<NodeId>> all()
-    {
-        Iterator<Record> iter = index.iterator() ;
-        return Iter.map(iter, item -> TupleLib.tuple(item, tupleMap)) ;
-    }
-    
-    private Iterator<Tuple<NodeId>> scan(Iterator<Tuple<NodeId>> iter, Tuple<NodeId> pattern) {
-        Predicate<Tuple<NodeId>> filter = (item) -> {
-            // Check on pattern and item (both in natural order)
-            for ( int i = 0 ; i < tupleLength ; i++ ) {
-                NodeId n = pattern.get(i) ;
-                // The pattern must be null/Any or match the tuple being tested.
-                if ( ! NodeId.isAny(n) )
-                    if ( ! item.get(i).equals(n) ) 
-                        return false ;
-            }
-            return true ;
-        } ;
-        
-        return Iter.filter(iter, filter) ;
-    }
-    
-    @Override
-    public void close() {
-        index.close() ;
-    }
-
-    @Override
-    public void sync() {
-        index.sync() ;
-    }
-
-    public final RangeIndex getRangeIndex() {
-        return index ;
-    }
-
-    //protected final RecordFactory getRecordFactory()        { return factory ; }
-    
-    @Override
-    public boolean isEmpty() {
-        return index.isEmpty() ;
-    }
-
-    @Override
-    public void clear() {
-        index.clear() ;
-    }
-
-    @Override
-    public long size() {
-        return index.size() ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/tupletable/TupleIndexRecordAsyncBulkAdd.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/tupletable/TupleIndexRecordAsyncBulkAdd.java b/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/tupletable/TupleIndexRecordAsyncBulkAdd.java
deleted file mode 100644
index 1f65c26..0000000
--- a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/tupletable/TupleIndexRecordAsyncBulkAdd.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * 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 org.seaborne.tdb2.store.tupletable;
-
-import static java.lang.String.format ;
-import static org.seaborne.tdb2.sys.SystemTDB.SizeOfNodeId ;
-
-import java.util.Collection ;
-import java.util.Iterator ;
-import java.util.function.Predicate ;
-
-import org.apache.jena.atlas.iterator.Iter ;
-import org.apache.jena.atlas.iterator.NullIterator ;
-import org.apache.jena.atlas.iterator.SingletonIterator ;
-import org.apache.jena.atlas.lib.tuple.Tuple ;
-import org.apache.jena.atlas.lib.tuple.TupleMap ;
-import org.seaborne.dboe.base.record.Record ;
-import org.seaborne.dboe.base.record.RecordFactory ;
-import org.seaborne.dboe.index.RangeIndex ;
-import org.seaborne.dboe.transaction.txn.Transaction ;
-import org.seaborne.tdb2.TDBException ;
-import org.seaborne.tdb2.lib.Async ;
-import org.seaborne.tdb2.lib.TupleLib ;
-import org.seaborne.tdb2.store.NodeId ;
-import org.seaborne.tdb2.store.NodeIdFactory;
-
-// Async addAll 
-public class TupleIndexRecordAsyncBulkAdd extends TupleIndexBase
-{
-    private static final boolean Check = false ;
-    private RangeIndex index ; 
-    private RecordFactory factory ;
-    
-    public TupleIndexRecordAsyncBulkAdd(int N,  TupleMap tupleMapping, String name, RecordFactory factory, RangeIndex index)
-    {
-        super(N, tupleMapping, name) ;
-        this.factory = factory ;
-        this.index = index ;
-        
-        if ( factory.keyLength() != N*SizeOfNodeId)
-            throw new TDBException(format("Mismatch: TupleIndex of length %d is not comparative with a factory for key length %d", N, factory.keyLength())) ;
-    }
-    
-    /** Insert a tuple */
-    @Override
-    protected void performAdd(Tuple<NodeId> tuple) {
-        switchToSync() ;
-        Record r = TupleLib.record(factory, tuple, tupleMap) ;
-        index.insert(r) ;
-    }
-    
-    /** Delete a tuple */
-    @Override
-    protected void performDelete(Tuple<NodeId> tuple) { 
-        switchToSync() ;
-        Record r = TupleLib.record(factory, tuple, tupleMap) ;
-        index.delete(r) ;
-    }
-    
-    private void switchToSync() {
-        async.completeAsyncOperations();
-    }
-
-    Async async = new Async(1,2) ;
-    Object lock = new Object() ;
-    
-    /** Insert tuples */
-    @Override
-    public void addAll(Collection<Tuple<NodeId>> tuples) {
-        Transaction txn = null ;
-        // pass into async block.
-        
-        async.execAsync(lock, () -> {
-            // Transaction?
-            
-            System.out.println(">>Async") ;
-            for ( Tuple<NodeId> t : tuples ) {
-                Record r = TupleLib.record(factory, t, tupleMap) ;
-                index.insert(r) ;
-            }
-            System.out.println("<<Async") ;
-        }) ;
-    }
-    
-    /** Delete tuples */
-    @Override
-    public void deleteAll(Collection<Tuple<NodeId>> tuples) {
-        tuples.stream().forEach(this::delete);
-    }
-    
-    /** Find all matching tuples - a slot of NodeId.NodeIdAny (or null) means match any.
-     *  Input pattern in natural order, not index order.
-     */
-    
-    @Override
-    protected Iterator<Tuple<NodeId>> performFind(Tuple<NodeId> pattern) {
-        switchToSync() ;
-        return findOrScan(pattern) ;
-    }
-
-    // Package visibility for testing.
-    final Iterator<Tuple<NodeId>> findOrScan(Tuple<NodeId> pattern) {
-        return findWorker(pattern, true, true) ;
-    }
-    
-    final Iterator<Tuple<NodeId>> findOrPartialScan(Tuple<NodeId> pattern) {
-        return findWorker(pattern, true, false) ;
-    }
-
-    final Iterator<Tuple<NodeId>> findByIndex(Tuple<NodeId> pattern) {
-        return findWorker(pattern, false, false) ;
-    }
-    
-    private Iterator<Tuple<NodeId>> findWorker(Tuple<NodeId> patternNaturalOrder, boolean partialScanAllowed, boolean fullScanAllowed) {
-        switchToSync();
-        if ( Check && tupleLength != patternNaturalOrder.len() )
-            throw new TDBException(String.format("Mismatch: tuple length %d / index for length %d", patternNaturalOrder.len(), tupleLength));
-
-        // Convert to index order.
-        Tuple<NodeId> pattern = tupleMap.map(patternNaturalOrder) ;
-        
-        // Canonical form.
-        int numSlots = 0 ;
-        int leadingIdx = -2;    // Index of last leading pattern NodeId.  Start less than numSlots-1
-        boolean leading = true ;
-        
-        // Records.
-        Record minRec = factory.createKeyOnly() ;
-        Record maxRec = factory.createKeyOnly() ;
-        
-        // Set the prefixes.
-        for ( int i = 0 ; i < pattern.len() ; i++ ) {
-            NodeId X = pattern.get(i) ;
-            if ( NodeId.isAny(X) ) {
-                X = null ;
-                // No longer setting leading key slots.
-                leading = false ;
-                continue ;
-            }
-
-            numSlots++ ;
-            if ( leading ) {
-                leadingIdx = i ;
-                NodeIdFactory.set(X, minRec.getKey(), i*SizeOfNodeId) ;
-                NodeIdFactory.set(X, maxRec.getKey(), i*SizeOfNodeId) ;
-            }
-        }
-        
-        // Is it a simple existence test?
-        if ( numSlots == pattern.len() ) {
-            if ( index.contains(minRec) )
-                return new SingletonIterator<>(pattern) ;
-            else
-                return new NullIterator<>() ;
-        }
-        
-        Iterator<Record> iter = null ;
-        
-        if ( leadingIdx < 0 ) {
-            if ( ! fullScanAllowed )
-                return null ;
-            //System.out.println("Full scan") ;
-            // Full scan necessary
-            iter = index.iterator() ;
-        } else {
-            // Adjust the maxRec.
-            NodeId X = pattern.get(leadingIdx) ;
-            // Set the max Record to the leading NodeIds, +1.
-            // Example, SP? inclusive to S(P+1)? exclusive where ? is zero. 
-            NodeIdFactory.setNext(X, maxRec.getKey(), leadingIdx*SizeOfNodeId) ;
-            iter = index.iterator(minRec, maxRec) ;
-        }
-        
-        Iterator<Tuple<NodeId>> tuples = Iter.map(iter, item -> TupleLib.tuple(item, tupleMap)) ;
-        
-        if ( leadingIdx < numSlots-1 ) {
-            if ( ! partialScanAllowed )
-                return null ;
-            // Didn't match all defined slots in request.  
-            // Partial or full scan needed.
-            //pattern.unmap(colMap) ;
-            tuples = scan(tuples, patternNaturalOrder) ;
-        }
-        
-        return tuples ;
-    }
-    
-    @Override
-    public Iterator<Tuple<NodeId>> all()
-    {
-        switchToSync() ;
-        Iterator<Record> iter = index.iterator() ;
-        return Iter.map(iter, item -> TupleLib.tuple(item, tupleMap)) ;
-    }
-    
-    private Iterator<Tuple<NodeId>> scan(Iterator<Tuple<NodeId>> iter, Tuple<NodeId> pattern) {
-        Predicate<Tuple<NodeId>> filter = (item) -> {
-            // Check on pattern and item (both in natural order)
-            for ( int i = 0 ; i < tupleLength ; i++ ) {
-                NodeId n = pattern.get(i) ;
-                // The pattern must be null/Any or match the tuple being tested.
-                if ( ! NodeId.isAny(n) )
-                    if ( ! item.get(i).equals(n) ) 
-                        return false ;
-            }
-            return true ;
-        } ;
-        
-        return Iter.filter(iter, filter) ;
-    }
-    
-    @Override
-    public void close() {
-        switchToSync() ;
-        index.close() ;
-    }
-
-    @Override
-    public void sync() {
-        switchToSync() ;
-        index.sync() ;
-    }
-
-    public final RangeIndex getRangeIndex() {
-        return index ;
-    }
-
-    //protected final RecordFactory getRecordFactory()        { return factory ; }
-    
-    @Override
-    public boolean isEmpty() {
-        switchToSync() ;
-        return index.isEmpty() ;
-    }
-
-    @Override
-    public void clear() {
-        switchToSync() ;
-        index.clear() ;
-    }
-
-    @Override
-    public long size() {
-        switchToSync() ;
-        return index.size() ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/tupletable/TupleIndexWrapper.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/tupletable/TupleIndexWrapper.java b/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/tupletable/TupleIndexWrapper.java
deleted file mode 100644
index ca8d8b8..0000000
--- a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/tupletable/TupleIndexWrapper.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * 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 org.seaborne.tdb2.store.tupletable;
-
-import java.util.Collection ;
-import java.util.Iterator ;
-
-import org.apache.jena.atlas.lib.tuple.Tuple ;
-import org.apache.jena.atlas.lib.tuple.TupleMap ;
-import org.seaborne.tdb2.store.NodeId ;
-
-public class TupleIndexWrapper implements TupleIndex
-{
-    protected final TupleIndex index ;
-
-    public TupleIndexWrapper(TupleIndex index) { this.index = index ; }
-    
-    @Override
-    public final TupleIndex wrapped() {
-        return index ;
-    }
-
-    @Override
-    public void add(Tuple<NodeId> tuple) {
-        index.add(tuple) ;
-    }
-
-    @Override
-    public void addAll(Collection<Tuple<NodeId>> tuples) {
-        index.addAll(tuples) ;
-    }
-
-    @Override
-    public void delete(Tuple<NodeId> tuple) {
-        index.delete(tuple) ;
-    }
-
-    @Override
-    public void deleteAll(Collection<Tuple<NodeId>> tuples) {
-        index.deleteAll(tuples);
-    }
-
-    @Override
-    public Iterator<Tuple<NodeId>> find(Tuple<NodeId> pattern) {
-        return index.find(pattern) ;
-    }
-
-    @Override
-    public Iterator<Tuple<NodeId>> all() {
-        return index.all() ;
-    }
-
-    @Override
-    public int getTupleLength() {
-        return index.getTupleLength() ;
-    }
-
-    @Override
-    public String getMappingStr() {
-        return index.getMappingStr() ;
-    }
-
-    @Override
-    public TupleMap getMapping() {
-        return index.getMapping() ;
-    }
-
-    @Override
-    public String getName() {
-        return index.getName() ;
-    }
-
-    @Override
-    public int weight(Tuple<NodeId> pattern) {
-        return index.weight(pattern) ;
-    }
-
-    @Override
-    public long size() {
-        return index.size() ;
-    }
-
-    @Override
-    public boolean isEmpty() {
-        return index.isEmpty() ;
-    }
-
-    @Override
-    public void clear() {
-        index.clear() ;
-    }
-
-    @Override
-    public void sync() {
-        index.sync() ;
-    }
-
-    @Override
-    public void close() {
-        index.close() ;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/tupletable/TupleTable.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/tupletable/TupleTable.java b/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/tupletable/TupleTable.java
deleted file mode 100644
index 7fd9bf6..0000000
--- a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/tupletable/TupleTable.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * 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 org.seaborne.tdb2.store.tupletable;
-
-import static java.lang.String.format ;
-
-import java.util.Iterator ;
-import java.util.List ;
-
-import org.apache.jena.atlas.iterator.Iter;
-import org.apache.jena.atlas.lib.Closeable ;
-import org.apache.jena.atlas.lib.Sync ;
-import org.apache.jena.atlas.lib.tuple.Tuple ;
-import org.apache.jena.atlas.logging.Log ;
-import org.seaborne.tdb2.TDBException ;
-import org.seaborne.tdb2.store.NodeId ;
-import org.seaborne.tdb2.sys.SystemTDB ;
-import org.slf4j.Logger ;
-import org.slf4j.LoggerFactory ;
-
-/** A TupleTable is a set of TupleIndexes.  The first TupleIndex is the "primary" index and must exist */
-public class TupleTable implements Sync, Closeable
-{
-    private static Logger log = LoggerFactory.getLogger(TupleTable.class) ;
-    
-    private final TupleIndex[] indexes ;
-    private final TupleIndex   scanAllIndex ;   // Use this index if a complete scan is needed.
-    private final int tupleLen ;
-    private boolean syncNeeded = false ;
-    
-    public TupleTable(int tupleLen, TupleIndex[] indexes)
-    {
-        this.tupleLen = tupleLen ;
-        this.indexes = indexes ;
-        if ( indexes[0] == null )
-            throw new TDBException("TupleTable: no primary index") ;
-        for ( TupleIndex index : indexes )
-        {
-            if ( index != null && index.getTupleLength() != tupleLen )
-                throw new TDBException("Incompatible index: "+index.getMappingStr()) ;
-        }
-        scanAllIndex = chooseScanAllIndex(tupleLen, indexes) ;
-    }
-    
-    /** Choose an index to scan in case we are asked for everything
-     * This needs to be ???G for the distinctAdjacent filter in union query to work.
-     */
-    private static TupleIndex chooseScanAllIndex(int tupleLen, TupleIndex[] indexes)
-    {
-        if ( tupleLen != 4 )
-            return indexes[0] ;
-        
-        for ( TupleIndex index : indexes )
-        {
-            // First look for SPOG
-            if ( index.getName().equals("SPOG") )
-                return index ;
-        }
-        
-        for ( TupleIndex index : indexes )
-        {
-            // Then look for any ???G
-            if ( index.getName().endsWith("G") )
-                return index ;
-        }
-        
-        Log.warn(SystemTDB.errlog, "Did not find a ???G index for full scans") ;
-        return indexes[0] ;
-    }
-
-    /** Insert a tuple */
-    public void add(Tuple<NodeId> t) {
-        // A "contains test" could be used to avoid needing to hit all
-        // the indexes when the triple is already present.
-        if ( tupleLen != t.len() )
-            throw new TDBException(format("Mismatch: inserting tuple of length %d into a table of tuples of length %d", t.len(), tupleLen)) ;
-        for ( int i = 0 ; i < indexes.length ; i++ ) {
-            if ( indexes[i] == null ) continue ;
-            indexes[i].add(t) ;
-            syncNeeded = true ;
-        }
-    }
-
-    /** Insert tuples */
-    public void addAll(List<Tuple<NodeId>> t) {
-        // Parallel.
-        for ( int i = 0 ; i < indexes.length ; i++ ) {
-            if ( indexes[i] == null ) continue ;
-            indexes[i].addAll(t) ;
-            syncNeeded = true ;
-        }
-    }
-
-    /** Delete a tuple */
-    public void delete( Tuple<NodeId> t ) { 
-        if ( tupleLen != t.len() )
-            throw new TDBException(format("Mismatch: deleting tuple of length %d from a table of tuples of length %d", t.len(), tupleLen)) ;
-
-        for ( TupleIndex index : indexes ) {
-            if ( index == null )
-                continue;
-            index.delete( t );
-        }
-    }
-    
-    /** Delete tuples */
-    public void deleteAll(List<Tuple<NodeId>> t) {
-        // Parallel.
-        for ( int i = 0 ; i < indexes.length ; i++ ) {
-            if ( indexes[i] == null ) continue ;
-            indexes[i].deleteAll(t) ;
-            syncNeeded = true ;
-        }
-    }
-
-    /** Find all matching tuples - a slot of NodeId.NodeIdAny means match any */
-    public Iterator<Tuple<NodeId>> find(Tuple<NodeId> pattern) {
-        if ( tupleLen != pattern.len() )
-            throw new TDBException(format("Mismatch: finding tuple of length %d in a table of tuples of length %d", pattern.len(), tupleLen)) ;
-        
-        int numSlots = 0 ;
-        // Canonical form. 
-        for ( int i = 0 ; i < tupleLen ; i++ ) {
-            NodeId x = pattern.get(i) ;
-            if ( ! NodeId.isAny(x) )
-                numSlots++ ;
-            if ( NodeId.isDoesNotExist(x))
-                return Iter.nullIterator();
-        }
-
-        if ( numSlots == 0 )
-            return scanAllIndex.all() ;
-        
-        int indexNumSlots = 0 ;
-        TupleIndex index = null ;
-        for ( TupleIndex idx : indexes ) {
-            if ( idx != null ) {
-                int w = idx.weight( pattern );
-                if ( w > indexNumSlots ) {
-                    indexNumSlots = w;
-                    index = idx;
-                }
-            }
-        }
-        
-        if ( index == null )
-            // No index at all.  Scan.
-            index = indexes[0] ;
-        return index.find(pattern) ;
-    }
-    
-    @Override
-    final public void close() {
-        for ( TupleIndex idx : indexes ) {
-            if ( idx != null )
-                idx.close();
-        }
-    }
-    
-    @Override
-    public void sync() {
-        if ( syncNeeded ) {
-            for ( TupleIndex idx : indexes ) {
-                if ( idx != null )
-                    idx.sync() ;
-            }
-            syncNeeded = false ;
-        }
-    }
-
-    public boolean isEmpty()        { return indexes[0].isEmpty() ; }
-    
-    public void clear() {
-        for ( TupleIndex idx : indexes ) {
-            if ( idx != null )
-                idx.clear() ;
-        }
-        syncNeeded = true ;
-    }
-    
-    public long size() {
-        return indexes[0].size() ;
-    }
-    
-    /** Get i'th index */ 
-    public TupleIndex getIndex(int i)                   { return indexes[i] ; }
-    
-    /** Get all indexes - for code that maipulates internal structures directly - use with care */ 
-    public TupleIndex[] getIndexes()                    { return indexes ; }
-    
-    /** Get the width of tuples in indexes in this table */
-    public int getTupleLen()                            { return tupleLen ; }
-
-    /** Set index - for code that manipulates internal structures directly - use with care */ 
-    public void setTupleIndex(int i, TupleIndex index) {
-        if ( index != null && index.getTupleLength() != tupleLen )
-            throw new TDBException("Incompatible index: " + index.getMappingStr()) ;
-        indexes[i] = index ;
-    }
-
-    /** Number of indexes on this tuple table */
-    public int numIndexes()                             { return indexes.length ; }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/value/DateTimeNode.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/value/DateTimeNode.java b/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/value/DateTimeNode.java
deleted file mode 100644
index 444dd39..0000000
--- a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/value/DateTimeNode.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * 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 org.seaborne.tdb2.store.value;
-
-import java.math.BigDecimal ;
-
-import javax.xml.datatype.DatatypeConfigurationException ;
-import javax.xml.datatype.DatatypeConstants ;
-import javax.xml.datatype.DatatypeFactory ;
-import javax.xml.datatype.XMLGregorianCalendar ;
-
-import org.apache.jena.atlas.lib.BitsInt ;
-import org.apache.jena.atlas.lib.BitsLong ;
-import org.apache.jena.atlas.lib.NumberUtils ;
-import org.seaborne.tdb2.TDBException ;
-
-public class DateTimeNode
-{
-    // ---- Layout
-    // Epoch base: 0000-01-01T00:00:00
-
-    // Layout:
-    // Bits 56-63 : type
-    
-    // Bits 49-55 (7 bits)  : timezone -- 15 min precision + special for Z and no timezone.
-    // Bits 27-48 (22 bits) : date, year is 13 bits = 8000 years  (0 to 7999)
-    // Bits 0-26  (27 bits) : time, to milliseconds 
-
-    // Layout:
-    // Hi: TZ YYYY MM DD HH MM SS.sss Lo:
-    // Looses the distinction between 00:00:00 vs 24:00:00 (of the day before).
-
-    // Const-ize
-    // 13 bits year, 4 bits month, 5 bits day => 22 bits
-    static final int       DATE_LEN        = 22;
-    // 5 bits hour + 6 bits minute + 16 bits seconds (to millisecond)
-    static final int       TIME_LEN        = 27;
-
-    static final int       MILLI           = 0;
-    static final int       MILLI_LEN       = 16;
-
-    static final int       MINUTES         = MILLI_LEN;
-    static final int       MINUTES_LEN     = 6;
-
-    static final int       HOUR            = MILLI_LEN + MINUTES_LEN;
-    static final int       HOUR_LEN        = 5;
-
-    static final int       DAY             = TIME_LEN;
-    static final int       DAY_LEN         = 5;
-
-    static final int       MONTH           = TIME_LEN + DAY_LEN;
-    static final int       MONTH_LEN       = 4;
-
-    static final int       YEAR            = TIME_LEN + MONTH_LEN + DAY_LEN;
-    static final int       YEAR_LEN        = 13;
-
-    static final int       TZ              = TIME_LEN + DATE_LEN;
-    static final int       TZ_LEN          = 7;
-    // Value for Z
-    static final int       TZ_Z            = 0x7F;
-    // Value for no timezone.
-    static final int       TZ_NONE         = 0x7E;
-    
-    static DatatypeFactory datatypeFactory = null;
-    static {
-        try {
-            datatypeFactory = DatatypeFactory.newInstance();
-        }
-        catch (DatatypeConfigurationException ex) {
-            throw new TDBException("DateTimeNode", ex);
-        }
-    }
-
-    // Packed in correct place.
-    static long time(long v, int hour, int mins, int millisec) {
-        // And bit offset for direct packing?
-        // HH:MM:SS.ssss => 5 bits H, 6 bits M, 16 bits S ==> 27 bits
-        v = BitsLong.pack(v, hour, HOUR, HOUR + HOUR_LEN);
-        v = BitsLong.pack(v, mins, MINUTES, MINUTES + MINUTES_LEN);
-        v = BitsLong.pack(v, millisec, MILLI, MILLI + MILLI_LEN);
-        return v;
-    }
-
-    // Packed in correct place.
-    static long date(long v, int year, int month, int day) {
-        // YYYY:MM:DD => 13 bits year, 4 bits month, 5 bits day => 22 bits
-        v = BitsLong.pack(v, year, YEAR, YEAR + YEAR_LEN);
-        v = BitsLong.pack(v, month, MONTH, MONTH + MONTH_LEN);
-        v = BitsLong.pack(v, day, DAY, DAY + DAY_LEN);
-        return v;
-    }
-
-    static long tz(long v, int tz_in_quarters) {
-        v = BitsLong.pack(v, tz_in_quarters, TZ, TZ + TZ_LEN);
-        return v;
-    }
-
-    // From string. Assumed legal. Retains all info this way.
-    // returns -1 for unpackable.
-    public static long packDate(String lex) {
-        return packDateTime(lex);
-    }
-
-    // From string. Assumed legal.
-    // Returns -1 for unpackable.
-
-    public static long packDateTime(String lex) {
-        try {
-            return packDateTime$(lex);
-        }
-        catch (Exception ex) {
-            return -1;
-        }
-    }
-
-    private static long packDateTime$(String lex) {
-        long v = 0;
-        // Whitespace facet processing.
-        lex = lex.trim();
-
-        boolean containsZ = (lex.indexOf('Z') > 0);
-
-        // Bug in Java 1.6 (build 5 at least)
-        // T24:00:00 not accepted.
-        // See also TestNodeId.nodeId_date_time_7
-
-        XMLGregorianCalendar xcal = datatypeFactory.newXMLGregorianCalendar(lex);
-
-        if ( xcal.getFractionalSecond() != null ) {
-            BigDecimal fs = xcal.getFractionalSecond();
-            // Were there sub-millisecond resolution fractional seconds?
-            // This isn't perfect but it needs a very long fractional part to break it,
-            // less than observable quantum of time.
-            if ( fs.doubleValue() != xcal.getMillisecond() / 1000.0 )
-                return -1;
-        }
-
-        int y = xcal.getYear();
-
-        if ( y < 0 || y >= 8000 )
-            return -1;
-
-        v = date(v, xcal.getYear(), xcal.getMonth(), xcal.getDay());
-        v = time(v, xcal.getHour(), xcal.getMinute(), xcal.getSecond() * 1000 + xcal.getMillisecond());
-
-        if ( containsZ )
-            return tz(v, TZ_Z);
-
-        int tz = xcal.getTimezone();
-        if ( tz == DatatypeConstants.FIELD_UNDEFINED )
-            return tz(v, TZ_NONE);
-
-        // Timezone is weird.
-        if ( tz % 15 != 0 )
-            return -1;
-
-        tz = tz / 15;
-        return tz(v, tz);
-    }
-
-    public static String unpackDateTime(long v) {
-        return unpack(v, true);
-    }
-
-    public static String unpackDate(long v) {
-        return unpack(v, false);
-    }
-
-    // Avoid calls to String.format
-    private static String unpack(long v, boolean isDateTime) {
-        // YYYY:MM:DD => 13 bits year, 4 bits month, 5 bits day => 22 bits
-        int years = (int)BitsLong.unpack(v, YEAR, YEAR + YEAR_LEN);
-        int months = (int)BitsLong.unpack(v, MONTH, MONTH + MONTH_LEN);
-        int days = (int)BitsLong.unpack(v, DAY, DAY + DAY_LEN);
-
-        // Hours: 5, mins 6, milli 16, TZ 7 => 34 bits
-        int hours = (int)BitsLong.unpack(v, HOUR, HOUR + HOUR_LEN);
-        int minutes = (int)BitsLong.unpack(v, MINUTES, MINUTES + MINUTES_LEN);
-        int milliSeconds = (int)BitsLong.unpack(v, MILLI, MILLI + MILLI_LEN);
-
-        int tz = (int)BitsLong.unpack(v, TZ, TZ + TZ_LEN);
-
-        int sec = milliSeconds / 1000;
-        int fractionSec = milliSeconds % 1000;
-
-        StringBuilder sb = new StringBuilder(50);
-        NumberUtils.formatInt(sb, years, 4);
-        sb.append('-');
-        NumberUtils.formatInt(sb, months, 2);
-        sb.append('-');
-        NumberUtils.formatInt(sb, days, 2);
-        if ( isDateTime ) {
-            sb.append('T');
-            NumberUtils.formatInt(sb, hours, 2);
-            sb.append(':');
-            NumberUtils.formatInt(sb, minutes, 2);
-            sb.append(':');
-            NumberUtils.formatInt(sb, sec, 2);
-
-            // Formatting needed : int->any
-            if ( fractionSec != 0 ) {
-                sb.append(".");
-                if ( fractionSec % 100 == 0 )
-                    NumberUtils.formatInt(sb, fractionSec / 100, 1);
-                else if ( fractionSec % 10 == 0 )
-                    NumberUtils.formatInt(sb, fractionSec / 10, 2);
-                else
-                    NumberUtils.formatInt(sb, fractionSec, 3);
-            }
-        }
-        // tz in 15min units
-        // Special values.
-        if ( tz == TZ_Z ) {
-            sb.append("Z");
-            return sb.toString();
-        }
-
-        if ( tz == TZ_NONE )
-            return sb.toString();
-
-        // Sign extend.
-        if ( BitsLong.isSet(v, TZ + TZ_LEN - 1) )
-            tz = BitsInt.set(tz, TZ_LEN, 32);
-
-        if ( tz < 0 ) {
-            tz = -tz;
-            sb.append('-');
-        } else
-            sb.append('+');
-
-        int tzH = tz / 4;
-        int tzM = (tz % 4) * 15;
-        NumberUtils.formatUnsignedInt(sb, tzH, 2);
-        sb.append(':');
-        NumberUtils.formatUnsignedInt(sb, tzM, 2);
-        return sb.toString();
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/value/DecimalNode.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/value/DecimalNode.java b/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/value/DecimalNode.java
deleted file mode 100644
index 55e7908..0000000
--- a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/value/DecimalNode.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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 org.seaborne.tdb2.store.value;
-
-/** Placeholder for a full length decimal , using int+long.*/
-public class DecimalNode {
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/value/DecimalNode56.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/value/DecimalNode56.java b/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/value/DecimalNode56.java
deleted file mode 100644
index 77cb3ce..0000000
--- a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/value/DecimalNode56.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * 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 org.seaborne.tdb2.store.value;
-
-import java.math.BigDecimal;
-import java.math.BigInteger;
-
-import org.apache.jena.atlas.lib.BitsLong ;
-
-
-// Decimal packed into 56 bits.
-public class DecimalNode56
-{
-    //private static Logger log = LoggerFactory.getLogger(DecimalNode.class) ;
-    
-    BigDecimal decimal = null ;
-    
-    // signed 8 bits of scale, signed 48 bits of value.
-    // Decimal precision is 47 bits (it's signed) or around 14 places.
-    // Not finance industry accuracy nor XSD (18 places minimum) but still useful.
-
-    static final int        SCALE_LEN = 8;
-    static final int        VALUE_LEN = 48;
-    static final int        ENC_LEN   = 48 + SCALE_LEN;
-
-    static final long       MAX_VALUE = (1L << (VALUE_LEN - 1)) - 1;
-    static final long       MIN_VALUE = -(1L << (VALUE_LEN - 1));
-
-    static final int        MAX_SCALE = (1 << (SCALE_LEN - 1)) - 1;
-    static final int        MIN_SCALE = -(1 << (SCALE_LEN - 1));
-
-    static final BigInteger MAX_I     = BigInteger.valueOf(MAX_VALUE);
-    static final BigInteger MIN_I     = BigInteger.valueOf(MIN_VALUE);
-
-    // Bits counts
-    static private int      SCALE_LO  = 56 - SCALE_LEN;
-    static private int      SCALE_HI  = 56;                               // Exclusive
-                                                                          // index
-
-    static private int      VALUE_LO  = 0;
-    static private int      VALUE_HI  = VALUE_LO + VALUE_LEN;
-
-    private int             scale;
-    private long            value;
-
-    public static DecimalNode56 valueOf(BigDecimal decimal) {
-        int scale = decimal.scale();
-        BigInteger bigInt = decimal.unscaledValue();
-        
-        //decimal.longValueExact(); // Throws exception
-        //new BigDecimal(long);
-
-        if ( bigInt.compareTo(MAX_I) > 0 || bigInt.compareTo(MIN_I) < 0 )
-            // This check makes sure that bigInt.longValue() is safe
-            return null;
-        return valueOf(bigInt.longValue(), scale);
-    }
-
-    public static DecimalNode56 valueOf(long binValue, int scale) {
-        if ( scale < MIN_SCALE || scale > MAX_SCALE ) {
-            // log.warn("Scale out of range: ("+binValue+","+scale+")") ;
-            return null;
-        }
-
-        if ( binValue < MIN_VALUE || binValue > MAX_VALUE ) {
-            // log.warn("Value out of range: ("+binValue+","+scale+")") ;
-            return null;
-        }
-
-        return new DecimalNode56(binValue, scale);
-    }
-
-    private DecimalNode56(long value, int scale) {
-        this.scale = scale;
-        this.value = value;
-    }
-
-    public long pack() {
-        return pack(value, scale);
-    }
-
-    /** Create the long value */
-    public static long pack(long value, int scale) {
-        // pack : scale, value
-        long v = 0;
-        v = BitsLong.pack(0L, scale, SCALE_LO, SCALE_HI);
-        v = BitsLong.pack(v, value, VALUE_LO, VALUE_HI);
-        // No need to do something about negative numbers
-        return v;
-    }
-
-    public static DecimalNode56 unpack(long v) {
-        int scale = (int)BitsLong.unpack(v, SCALE_LO, SCALE_HI);
-        long value = BitsLong.unpack(v, VALUE_LO, VALUE_HI);
-        return new DecimalNode56(value, scale);
-    }
-
-    public static BigDecimal unpackAsBigDecimal(long v) {
-        int scale = (int)BitsLong.unpack(v, SCALE_LO, SCALE_HI);
-        long value = BitsLong.unpack(v, VALUE_LO, VALUE_HI);
-        // Sign extend value.
-        if ( BitsLong.isSet(value, VALUE_HI - 1) )
-            value = value | -1L << (VALUE_HI);
-        return BigDecimal.valueOf(value, scale);
-    }
-
-    public BigDecimal get() {
-        if ( decimal == null )
-            decimal = BigDecimal.valueOf(value, scale);
-        return decimal;
-    }
-
-    @Override
-    public String toString() {
-        return get().toPlainString();
-    }
-
-    public int getScale() {
-        return scale;
-    }
-
-    public long getValue() {
-        return value;
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/value/DoubleNode62.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/value/DoubleNode62.java b/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/value/DoubleNode62.java
deleted file mode 100644
index b65d5eb..0000000
--- a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/value/DoubleNode62.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * 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 org.seaborne.tdb2.store.value;
-
-import org.apache.jena.atlas.lib.BitsLong;
-
-/**
- * Doubles packed into 62 bits.
- * <p>
- * Uses java's 64 bit long format (which is IEEE754 binary64) except that 2 bits are taken
- * from the exponent. This keeps the precision but reduces the range.
- * <p>
- * <b>Java
- * (<a href="https://en.wikipedia.org/wiki/Double-precision_floating-point_format">IEEE
- * 754 binary64</a>)</b>
- * 
- * <pre>
- * bit 63 : sign bit
- * bits 52-62 : exponent, 11 bits, the power of 2, bias -1023.
- * bits 0-51  : mantissa (significand) 52 bits (the leading one is not stored).
- * 
- * Exponents are 11 bits, with values -1022 to +1023 held as 1 to 2046 (11 bits, bias -1023)
- *    0x000 is signed zero.
- *    0x7FF is +/- infinity.
- * </pre>
- * 
- * for a maximum value of 1.797693e+308 = (2-2^-52)*2^1023 and smallest denormlized of
- * (1-2^-52)*2^-1022 = 2.225...e-308.
- * <p>
- * <b>DoubleNode62</b>
- * <p>
- * In a 62 bit double:
- * 
- * <pre>
- * bit 63 : pointer bit.
- * bit 62 : double type bit.
- * bit 61 : sign bit 
- * bits 52-60 : exponent, 9 bits, the power of 2, bias -255
- * bits 0-51  : mantissa (significand) 52 bits (the leading one is not stored).
- * 
- * Exponents are 9 bits, with values -254 to 255, held as 1 to 512 (9 bits, bias -255)
- *    0x000 is signed zero.
- *    0x1FF is +/- infinity.
- * </pre>
- * 
- * for a maximum value of (2-2^-52)*2^255 = 1.157921e+77 and smallest denormlized of
- * (1-2^-52)*2^-254 = 3.4544674e-77
- * <p>
- * 0 is not a legal encoding because the high bit is the pointer/value bit.
- * <p>
- * "No encoding" is 0xFF00_0000_0000_0000L which would otherwise be the smallest (most negative) denormalized value: 
- *  -3.5336941295567687E72
- * <p>All unencodeable numbers wil endup in the node table in full lexical form.  
- */  
-public class DoubleNode62 {
-    /**
-     * An encoded value that is not possible.
-     * (it has high bits set).
-     */ 
-    public static long NO_ENCODING = 0xFF00_0000_0000_0000L;
-
-    /** Encode as a 62 bit long.
-     * Return {@link #NO_ENCODING} for "not possible".
-     * The top two bits are zero if packing was possible.
-     */
-    public static long pack(double v) {
-        long x = Double.doubleToRawLongBits(v);
-        long sign = BitsLong.unpack(x, 63, 64);
-        long exp11 = BitsLong.unpack(x, 52, 63);
-        long exp9 = encode11to9(exp11);
-        if ( exp9 == -1 )
-            return NO_ENCODING;
-        long significand = BitsLong.unpack(x, 0, 52);
-        // Do not set the value bit or double bit.
-        // This is done when outting into bytes. 
-        long z = 0;
-        z = BitsLong.pack(z, sign, 61, 62);
-        z = BitsLong.pack(z, exp9, 52, 61);
-        z = BitsLong.pack(z, significand, 0, 52);
-        return z;
-    }
-
-    public static long insertType(long x) {
-        // bits 63 1 (pointer/value), bit 62 1(double)
-        return x | 0x3L<<62;
-    }
-
-    public static long removeType(long x) {
-        // bits 63 1 (pointer/value), bit 62 1(double)
-        return x & ~(0x3L<<62);
-    }
-
-    public static double unpack(long x) {
-        if ( x == NO_ENCODING )
-            throw new IllegalArgumentException("No encoding inline");
-        long sign = BitsLong.unpack(x, 61, 62);
-        long exp9 = BitsLong.unpack(x, 52, 61);
-        long significand = BitsLong.unpack(x, 0, 52);
-        long exp11 = decode9to11(exp9);
-        long z = 0;
-        z = BitsLong.pack(z, sign, 63, 64);
-        z = BitsLong.pack(z, exp11, 52, 63);
-        z = BitsLong.pack(z, significand, 0, 52);
-        double d = Double.longBitsToDouble(z);
-        return d;
-    }
-
-    // Exponent: returns -1 for out of inlien range.
-    private static long encode11to9(long exp11) {
-        if ( exp11 == 0 )
-            return 0L;
-        if ( exp11 == 0x7FF )
-            return 0x3FFL;
-        
-        // Remove bias.
-        long expRebase = exp11 - 1023;
-        if ( expRebase < -254 || expRebase > 255 )
-            // Out of range.
-            return -1;
-        long exp9 = expRebase + 255;
-        return exp9;
-    }
-
-    // Exponent
-    private static long decode9to11(long exp9) {
-        if ( exp9 == 0 )
-            return 0L;
-        else if ( exp9 == 0x1FF )
-            return 0x7FFL;
-        long expRebase = exp9 - 255;
-        long exp11 = expRebase + 1023;
-        return exp11;
-        
-    }
-
-    // ---- Constants without type bits (so bits 62 and 63 are zero).
-    /** 
-     * 0x1ff0000000000000L
-     * @see Double#POSITIVE_INFINITY
-     */
-    public static final long POSITIVE_INFINITY_BITS = pack(Double.POSITIVE_INFINITY);
-
-    /** 
-     * @see Double#POSITIVE_INFINITY
-     */
-    public static final double POSITIVE_INFINITY = unpack(POSITIVE_INFINITY_BITS);
-
-    /**
-     * 0x3ff0000000000000L
-     * @see Double#NEGATIVE_INFINITY
-     */
-    public static final long NEGATIVE_INFINITY_BITS = pack(Double.NEGATIVE_INFINITY);
-
-    /**
-     * @see Double#NEGATIVE_INFINITY
-     */
-    public static final double NEGATIVE_INFINITY = unpack(NEGATIVE_INFINITY_BITS);
-
-    /**
-     * 0x1ff8000000000000L
-     * @see Double#NaN
-     */
-    public static final long NaN_BITS = pack(Double.NaN);
-
-    /**
-     * @see Double#NaN
-     */
-    public static final double NaN = unpack(NaN_BITS);
-
-    /**
-     * 0x3fefffffffffffffL
-     * <br/>
-     * (2-2<sup>-52</sup>)&middot;2<sup>255</sup>.
-     * 
-     * @see Double#MAX_VALUE
-     */
-    public static final long MAX_VALUE_BITS = 0x3fefffffffffffffL;
-
-    /**
-     * 0x3fefffffffffffffL
-     * <br/>
-     * (2-2<sup>-52</sup>)&middot;2<sup>255</sup>.
-     * 
-     * @see Double#MAX_VALUE
-     */
-    public static final double MAX_VALUE = unpack(MAX_VALUE_BITS);
-
-    /**
-     * 0x0010000000000000L
-     * @see Double#MIN_NORMAL
-     */
-    public static final long MIN_NORMAL_BITS = 0x0010000000000000L;
-
-    /**
-     * @see Double#MIN_NORMAL
-     */
-    public static final double MIN_NORMAL = unpack(0x0010000000000000L);
-
-    /**
-     * 0x01L
-     * @see Double#MIN_VALUE
-     */
-    public static final long MIN_VALUE_BITS = 0x01L;
-
-    /**
-     * 0x01L
-     * @see Double#MIN_VALUE
-     */
-    public static final double MIN_VALUE = unpack(MIN_VALUE_BITS);
-
-    /**
-     * @see Double#MAX_EXPONENT
-     */
-    public static final int MAX_EXPONENT = 255;
-
-    /**
-     * @see Double#MIN_EXPONENT
-     */
-    public static final int MIN_EXPONENT = -254;
-
-    /**
-     * @see Double#SIZE
-     */
-    public static final int SIZE = 62;
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/value/FloatNode.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/value/FloatNode.java b/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/value/FloatNode.java
deleted file mode 100644
index 0de6b14..0000000
--- a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/value/FloatNode.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * 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 org.seaborne.tdb2.store.value;
-
-public class FloatNode {
-    // 32 bits of value; collapses NaNs to a single value.
-
-    public static long pack(float v) {
-        return Float.floatToIntBits(v);
-    }
-
-    public static float unpack(long v) {
-        return Float.intBitsToFloat((int)v);
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/value/IntegerNode.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/value/IntegerNode.java b/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/value/IntegerNode.java
deleted file mode 100644
index 023ef1b..0000000
--- a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/store/value/IntegerNode.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * 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 org.seaborne.tdb2.store.value;
-
-import org.apache.jena.atlas.lib.BitsLong;
-
-public class IntegerNode {
-    // 56 bits of value, including sign bit.
-    public static int  LEN   = 56;
-    public static int  LBITS = Long.SIZE;
-    public static long MAX   = (1L << (LEN - 1)) - 1;
-    public static long MIN   = -(1L << (LEN - 1));
-
-    public static long pack(long v) {
-        if ( v >= MIN && v <= MAX ) {
-            v = BitsLong.clear(v, LEN, LBITS);
-            return v;
-        } else
-            return -1;
-    }
-
-    public static long unpack(long v) {
-        long val = BitsLong.clear(v, LEN, LBITS);
-        // Sign extends to 64 bits.
-        if ( BitsLong.isSet(val, LEN - 1) )
-            val = BitsLong.set(v, LEN, LBITS);
-        return val;
-    }
-    
-    // Same - renamed.
-    
-    public static long pack56(long v) {
-        if ( v >= MIN && v <= MAX ) {
-            v = BitsLong.clear(v, LEN, LBITS);
-            return v;
-        } else
-            return -1;
-    }
-
-    public static long unpack56(long v) {
-        long val = BitsLong.clear(v, LEN, LBITS);
-        // Sign extends to 64 bits.
-        if ( BitsLong.isSet(val, LEN - 1) )
-            val = BitsLong.set(v, LEN, LBITS);
-        return val;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/sys/ConnectionTracker.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/sys/ConnectionTracker.java b/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/sys/ConnectionTracker.java
deleted file mode 100644
index f2950eb..0000000
--- a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/sys/ConnectionTracker.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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 org.seaborne.tdb2.sys;
-
-abstract class ConnectionTracker<X> {
-
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/sys/CopyDSG.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/sys/CopyDSG.java b/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/sys/CopyDSG.java
deleted file mode 100644
index 4e53ea3..0000000
--- a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/sys/CopyDSG.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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 org.seaborne.tdb2.sys;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.jena.atlas.iterator.Iter;
-import org.apache.jena.graph.Graph;
-import org.apache.jena.graph.Node;
-import org.apache.jena.sparql.core.DatasetGraph;
-import org.apache.jena.sparql.core.Quad;
-import org.seaborne.dboe.jenax.Txn;
-
-/** Copy operations of any {@link DatasetGraph} */
-public class CopyDSG {
-
-    public static void copy(DatasetGraph dsgSrc, DatasetGraph dsgDst) {
-        Txn.executeRead(dsgSrc, ()->{
-            Txn.executeWrite(dsgDst, () -> {
-                Iterator<Quad> iter = dsgSrc.find();
-                iter.forEachRemaining(dsgDst::add);
-                copyPrefixes(dsgSrc, dsgDst);
-            });
-        });
-    }
-
-    public static void copyPrefixes(DatasetGraph dsgSrc, DatasetGraph dsgDst) {
-        List<Node> graphNames = Iter.toList(dsgSrc.listGraphNodes());
-        copyPrefixes(dsgSrc.getDefaultGraph(), dsgDst.getDefaultGraph());
-        graphNames.forEach((gn)->copyPrefixes(dsgSrc.getGraph(gn), dsgDst.getGraph(gn)));
-    }
-
-    public static void copyPrefixes(Graph srcGraph, Graph dstGraph) {
-        dstGraph.getPrefixMapping().setNsPrefixes(srcGraph.getPrefixMapping());
-    }
-}

http://git-wip-us.apache.org/repos/asf/jena/blob/3d456654/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/sys/DatabaseConnection.java
----------------------------------------------------------------------
diff --git a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/sys/DatabaseConnection.java b/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/sys/DatabaseConnection.java
deleted file mode 100644
index e9e6c27..0000000
--- a/jena-db/jena-tdb2/src/main/java/org/seaborne/tdb2/sys/DatabaseConnection.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * 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 org.seaborne.tdb2.sys;
-
-import java.io.IOException ;
-import java.nio.file.Path ;
-import java.nio.file.Paths ;
-import java.util.HashSet ;
-import java.util.Map ;
-import java.util.Set ;
-import java.util.concurrent.ConcurrentHashMap ;
-
-import org.apache.jena.atlas.io.IO ;
-import org.apache.jena.atlas.lib.FileOps ;
-import org.apache.jena.sparql.core.DatasetGraph ;
-import org.seaborne.dboe.base.file.Location ;
-import org.seaborne.dboe.base.file.ProcessFileLock ;
-import org.seaborne.dboe.sys.Names ;
-import org.seaborne.tdb2.TDBException ;
-import org.seaborne.tdb2.setup.StoreParams ;
-import org.seaborne.tdb2.store.DatasetGraphSwitchable ;
-
-// StoreConnection, DatabaseConnection < Connection<X> 
-
-public class DatabaseConnection {
-    // ConnectionTracker<X> 
-    
-    private static Map<Location, DatabaseConnection> cache = new ConcurrentHashMap<>() ;
-    
-    /** Get the {@code DatabaseConnection} to a location, 
-     *  creating the storage structures if it does not exist. */ 
-    public synchronized static DatabaseConnection connectCreate(Location location) {
-        return connectCreate(location, null) ;
-    }
-
-    /** Get the {@code DatabaseConnection} to a location, 
-     *  creating the storage structures if it does not exist.
-     *  Use the provided {@link StoreParams} - any persistent setting 
-     *  already at the location take precedence.
-     */ 
-    public synchronized static DatabaseConnection connectCreate(Location location, StoreParams params) {
-        return make(location, params) ;
-    }
-    
-    /**
-     * Return a {@code StoreConnection} for a particular location,
-     * creating it if it does not exist in storage.
-     */
-    private synchronized static DatabaseConnection make(Location location, StoreParams params) {
-        if ( location.isMemUnique() ) {
-            // Uncached, in-memory. 
-            DatasetGraph dsg = DatabaseOps.create(location);
-            DatabaseConnection dbConn = new DatabaseConnection(dsg, location, null);
-            return dbConn;
-        }
-        // Cached by Location. Named in-memory or on-disk.
-        DatabaseConnection dbConn = cache.computeIfAbsent(location, (loc)->buildForCache(loc, params));
-        return dbConn ;
-    }
-    
-    private static DatabaseConnection buildForCache(Location location, StoreParams params) {
-        if ( location.isMemUnique() ) {
-            throw new TDBException("Can't buildForCache a memory-unique location");
-        }
-        ProcessFileLock lock = null;
-        if (SystemTDB.DiskLocationMultiJvmUsagePrevention && ! location.isMem() ) {
-            lock = lockForLocation(location);
-            // Take the lock.  This is atomic.
-            lock.lockEx();
-        }
-        DatasetGraph dsg = DatabaseOps.create(location);
-        return new DatabaseConnection(dsg, location, lock) ;
-    }
-    
-//    private static DatasetGraph buildMem(Location location, StoreParams params) {
-//        return StoreConnection.connectCreate(location, params).getDatasetGraph(); 
-//    }
-//
-//    private static DatasetGraph buildDisk(Location location, StoreParams params) {
-//        return DatabaseOps.create(location);
-//    }
-
-    // DRY
-    /** Create or fetch a {@link ProcessFileLock} for a Location */
-    public static ProcessFileLock lockForLocation(Location location) {
-        FileOps.ensureDir(location.getDirectoryPath());
-        String lockFilename = location.getPath(Names.TDB_LOCK_FILE);
-        Path path = Paths.get(lockFilename);
-        try {
-            path.toFile().createNewFile();
-        } catch(IOException ex) { IO.exception(ex); return null; }
-        return ProcessFileLock.create(lockFilename);
-    }
-    
-    /** Use via {@link TDBInternal#expel} wherever possible.
-     * <p>
-     * Stop managing a location. Use with great care (testing only).<br/>
-     * Does not expel from {@link StoreConnection}.
-     */
-    public static synchronized void internalExpel(Location location, boolean force) {
-        // ** Check it is a container location 
-        DatabaseConnection dbConn = cache.get(location) ;
-        if ( dbConn == null )
-            return ;
-        dbConn.isValid = false;
-        //dbConn.datasetGraph = null;
-        //dbConn.datasetGraphSwitchable = null;
-        cache.remove(location) ;
-        // Release the lock after the cache is emptied.
-        if (SystemTDB.DiskLocationMultiJvmUsagePrevention && ! location.isMem() ) {
-            if ( ! dbConn.lock.isLockedHere() )
-                SystemTDB.errlog.warn("Location " + location.getDirectoryPath() + " was not locked by this process.");
-            dbConn.lock.unlock();
-            ProcessFileLock.release(dbConn.lock);
-        }
-    }
-    
-    /** 
-     * Stop managing all locations. 
-     * Use with extreme care.
-     * This is intended to support internal testing.
-     */
-    public static synchronized void internalReset() {
-        // Copy to avoid potential CME.
-        Set<Location> x = new HashSet<>(cache.keySet()) ;
-        for (Location loc : x)
-            internalExpel(loc, true) ;
-        if ( ! cache.isEmpty() )
-            System.err.println("DatabaseConnection: Cache not empty!");
-        cache.clear() ;
-    }
-    
-    // One of the other.
-    private final DatasetGraphSwitchable   datasetGraphSwitchable;
-    private final DatasetGraph             datasetGraph;
-    // This is the location of the TDB2 container directory. 
-    private final Location          location ;
-    private final ProcessFileLock   lock ;
-    private boolean                 isValid = true ;
-    
-    private DatabaseConnection(DatasetGraph dsg, Location location, ProcessFileLock fileLock)
-    {
-        this.datasetGraph = dsg;
-        this.datasetGraphSwitchable =  ( dsg instanceof DatasetGraphSwitchable ) ? (DatasetGraphSwitchable )dsg : null;
-        this.location = location ;
-        this.lock = fileLock;
-    }
-
-    public DatasetGraph getDatasetGraph() {
-        return datasetGraph;
-    }
-
-    public DatasetGraphSwitchable getDatasetGraphSwitchable() {
-        return datasetGraphSwitchable;
-    }
-    
-    public Location getLocation() {
-        return location ;
-    }
-    
-    public ProcessFileLock getLock() {
-        return lock ;
-    }
-}