Package com.hp.hpl.jena.tdb.nodetable

Examples of com.hp.hpl.jena.tdb.nodetable.NodeTable


       
        @Override
        public NodeTable buildNodeTable(FileSet fsIndex, FileSet fsObjectFile, int sizeNode2NodeIdCache,
                                        int sizeNodeId2NodeCache, int sizeNodeMissCacheSize)
        {
            NodeTable nt = builder.buildNodeTable(fsIndex, fsObjectFile, sizeNode2NodeIdCache, sizeNodeId2NodeCache, sizeNodeMissCacheSize) ;
            // It just knows, right?
            FileRef ref = FileRef.create(fsObjectFile.filename(Names.extNodeData)) ;
            recorder.record(ref, nt) ;
            return nt ;
        }
View Full Code Here


    abstract protected ObjectFile createObjectFile() ;
    abstract protected Location getLocation() ;
   
    private NodeTableTrans create(Transaction txn, Node...nodes)
    {
        NodeTable base = SetupTDB.makeNodeTable(getLocation()) ;
        for ( Node n : nodes )
            base.getAllocateNodeId(n) ;
        return create(txn, base) ;
    }
View Full Code Here

   
    @Test public void nodetrans_02()
    {
        Transaction txn = createTxn(11) ;
        NodeTableTrans ntt = create(txn) ;
        NodeTable nt0 = ntt.getBaseNodeTable() ;
       
        ntt.begin(txn) ;
        // Add a node
        NodeId nodeId = ntt.getAllocateNodeId(node1) ;
        // Check not in the base.
        assertNull(nt0.getNodeForNodeId(nodeId)) ;
        // Check is in the transaction node table.
        assertEquals(NodeId.NodeDoesNotExist, nt0.getNodeIdForNode(node1)) ;
        assertEquals(node1, ntt.getNodeForNodeId(nodeId)) ;
       
        ntt.commitPrepare(txn) ;
        ntt.commitEnact(txn) ;
        // Check it is now in the base.
        assertEquals(node1, nt0.getNodeForNodeId(nodeId)) ;
        assertEquals(nodeId, nt0.getNodeIdForNode(node1)) ;
        ntt.commitClearup(txn) ;
    }
View Full Code Here

    @Test public void nodetrans_03()
    {
        Transaction txn = createTxn(11) ;
        NodeTableTrans ntt = create(txn) ;
        NodeTable nt0 = ntt.getBaseNodeTable() ;
        
        ntt.begin(txn) ;
        // Add a node
        NodeId nodeId = ntt.getAllocateNodeId(node1) ;
        // Check not in the base.
        assertEquals(NodeId.NodeDoesNotExist, nt0.getNodeIdForNode(node1)) ;
        assertNull(nt0.getNodeForNodeId(nodeId)) ;
        // Check is in the transaction node table.
        assertEquals(node1, ntt.getNodeForNodeId(nodeId)) ;
       
        ntt.abort(txn) ;
        // Check it is not in the base.
        assertEquals(NodeId.NodeDoesNotExist, nt0.getNodeIdForNode(node1)) ;
        assertNull(nt0.getNodeForNodeId(nodeId)) ;
        ntt.commitClearup(txn) ;
    }
View Full Code Here

   
    @Test public void nodetrans_04()
    {
        Transaction txn = createTxn(11) ;
        NodeTableTrans ntt = create(txn, node1) ;
        NodeTable nt0 = ntt.getBaseNodeTable() ;
        ntt.begin(txn) ;
        // Add a node
        NodeId nodeId = ntt.getAllocateNodeId(node2) ;
        // Not here
        assertEquals(NodeId.NodeDoesNotExist, nt0.getNodeIdForNode(node2)) ;
        // Is here
        assertEquals(nodeId, ntt.getNodeIdForNode(node2)) ;
        ntt.commitPrepare(txn) ;
        ntt.commitEnact(txn) ;
        assertEquals(nodeId, nt0.getNodeIdForNode(node2)) ;
        ntt.commitClearup(txn) ;
    }
View Full Code Here

        return indexes ;
    }
   
    private static TripleTable createTripleTableMem(DatasetControl policy)
    {
        NodeTable nodeTable = NodeTableFactory.createMem(IndexBuilder.mem()) ;
        return createTripleTable(IndexBuilder.mem(), nodeTable, Location.mem(), tripleIndexes, policy) ;
    }
View Full Code Here

        return new TripleTable(indexes, nodeTable, policy) ;
    }

    private static QuadTable createQuadTableMem(DatasetControl policy)
    {
        NodeTable nodeTable = NodeTableFactory.createMem(IndexBuilder.mem()) ;
        return createQuadTable(IndexBuilder.mem(), nodeTable, null, tripleIndexes, policy) ;
    }
View Full Code Here

   
    /** Create or connect a TDB dataset (graph-level) */
    private static DatasetGraphTDB _createDatasetGraph(IndexBuilder indexBuilder, Location location, String[] graphIndexDesc, String[] quadIndexDesc)
    {
        DatasetControl policy = new DatasetControlMRSW() ;
        @SuppressWarnings("deprecation")
        NodeTable nodeTable = NodeTableFactory.create(indexBuilder, location) ;
        TripleTable triples = createTripleTable(indexBuilder, nodeTable, location, graphIndexDesc, policy) ;
        QuadTable quads = createQuadTable(indexBuilder, nodeTable, location, quadIndexDesc, policy) ;
        @SuppressWarnings("deprecation")
        DatasetPrefixesTDB prefixes = DatasetPrefixesTDB.create(indexBuilder, location, policy) ;
View Full Code Here

        @Override
        public NodeTable buildNodeTable(FileSet fsIndex, FileSet fsObjectFile, int sizeNode2NodeIdCache,
                                        int sizeNodeId2NodeCache, int sizeNodeMissCacheSize)
        {
            FileRef ref = FileRef.create(fsObjectFile.filename(Names.extNodeData)) ;
            NodeTable ntBase = nodeTables.get(ref) ;
            if ( ntBase == null )
                throw new TDBException("No NodeTable for "+ref) ;
           
            RecordFactory recordFactory = new RecordFactory(SystemTDB.LenNodeHash, SystemTDB.SizeOfNodeId) ;
            Index idx = new IndexMap(recordFactory) ;
            String objFilename = fsObjectFile.filename(Names.extNodeData+"-"+Names.extJournal) ;
            ObjectFile objectFile ;
           
            if ( fsObjectFile.isMem() )
                objectFile = FileFactory.createObjectFileMem(objFilename) ;
            else
                objectFile = FileFactory.createObjectFileDisk(objFilename) ;

            NodeTableTrans ntt = new NodeTableTrans(txn ,fsObjectFile.getBasename(), ntBase, idx, objectFile) ;
            txn.addComponent(ntt) ;
           
            // Add inline wrapper.
            NodeTable nt = NodeTableInline.create(ntt) ;
            return nt ;
        }
View Full Code Here

        @Override
        public NodeTable buildNodeTable(FileSet fsIndex, FileSet fsObjectFile,
                                        int sizeNode2NodeIdCache, int sizeNodeId2NodeCache, int sizeNodeMissCacheSize)
        {
            FileRef ref = FileRef.create(fsObjectFile.filename(Names.extNodeData)) ;
            NodeTable nt = nodeTables.get(ref) ;
            nt = new NodeTableReadonly(nt) ;
            return nt ;
        }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.tdb.nodetable.NodeTable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.