Package com.hp.hpl.jena.tdb.store

Examples of com.hp.hpl.jena.tdb.store.DatasetGraphTDB


        //    lastreader
       
        if ( mode == ReadWrite.READ )
        {  
            // If a READ transaction, and a previously built one is cached, use it.
            DatasetGraphTDB dsgCached = currentReaderView.get();
            if ( dsgCached != null )
            {
                // No components so we don't need to notify them.
                // We can just reuse the storage dataset.
                return new DatasetGraphTxn(dsgCached, txn) ;
View Full Code Here


    public static synchronized StoreConnection make(Location location)
    {
        StoreConnection sConn = cache.get(location) ;
        if (sConn != null)
            return sConn ;
        DatasetGraphTDB dsg = DatasetBuilderStd.build(location) ;
        sConn = _makeAndCache(dsg) ;
        return sConn ;
    }
View Full Code Here

     * Return a StoreConnection backed by in-memory datastructures (for
     * testing).
     */
    public static StoreConnection createMemUncached()
    {
        DatasetGraphTDB dsg = DatasetBuilderStd.build(Location.mem()) ;
        return new StoreConnection(dsg) ;
    }
View Full Code Here

public class DumpOps
{
    public static void dump(Dataset ds)
    {
        DatasetGraphTDB dsg = (DatasetGraphTDB)(ds.asDatasetGraph()) ;

        NodeTupleTable nodeTupleTableTriples = dsg.getTripleTable().getNodeTupleTable() ;
        NodeTupleTable nodeTupleTableQuads = dsg.getQuadTable().getNodeTupleTable() ;

        if ( nodeTupleTableTriples.getNodeTable() != nodeTupleTableQuads.getNodeTable() )
            throw new CmdException("Different node tables for triples and quads") ;

        NodeTable nodeTable = nodeTupleTableTriples.getNodeTable() ;
        // V special.
        Set<NodeTable> dumpedNodeTables = new HashSet<>() ;



        if ( true )
        {
            System.out.print("## Node Table\n") ;
            dumpNodeTable(nodeTupleTableTriples.getNodeTable(), dumpedNodeTables) ;
            dumpNodeTable(nodeTupleTableQuads.getNodeTable(), dumpedNodeTables) ;
        }

        if ( false )
        {
            System.out.print("## Triple Table\n") ;
            dumpNodeTupleTable(nodeTupleTableTriples.getTupleTable()) ;
            System.out.print("## Quad Table\n") ;
            dumpNodeTupleTable(nodeTupleTableQuads.getTupleTable()) ;
        }

        // Indexes.
        if ( true )
        {
            dumpTupleIndexes(nodeTupleTableTriples.getTupleTable().getIndexes()) ;
            dumpTupleIndexes(nodeTupleTableQuads.getTupleTable().getIndexes()) ;
        }

        // Prefixes
        if ( true )
        {
            System.out.print("## Prefix Table\n")
            DatasetPrefixesTDB prefixes = dsg.getPrefixes() ;

            NodeTupleTable pntt = prefixes.getNodeTupleTable() ;
            if ( ! dumpedNodeTables.contains(pntt.getNodeTable()))
            {
                dumpNodeTable(pntt.getNodeTable(), dumpedNodeTables) ;
View Full Code Here

        dsgW2.commit() ;
        dsgW2.end() ;
       
        sConn.forceRecoverFromJournal() ;
        DatasetGraphTDB dsg = sConn.getBaseDataset() ;
        assertTrue(dsg.contains(q1)) ;
        assertTrue(dsg.contains(q2)) ;
    }
View Full Code Here

        dsgW3.end() ;

        dsgR1.end() ;
       
        sConn.flush() ;
        DatasetGraphTDB dsg = sConn.getBaseDataset() ;
        assertTrue(dsg.contains(q1)) ;
        assertTrue(dsg.contains(q2)) ;
        assertTrue(dsg.contains(q3)) ;
    }
View Full Code Here

   
    private static DatasetGraphTDB createPlain(Location location) { return TDBMaker.createDatasetGraphTDB(location) ; }
   
    private void setupPlain() {
        // Make without transactions.
        DatasetGraphTDB dsg = createPlain(location) ;
        dsg.add(quad1) ;
        dsg.close() ;
        StoreConnection.release(location) ;
        return ;
    }
View Full Code Here

    }
   
    @Test
    public void testPlain() {
        assertEquals (3, countRDFNodes()) ;
        DatasetGraphTDB dsg = createPlain(location) ;
        assertTrue(dsg.contains(quad1)) ;
        dsg.add(quad2) ;
        assertTrue(dsg.contains(quad2)) ;
        dsg.close() ;
        StoreConnection.release(location) ;
        assertEquals (4, countRDFNodes()) ;
    }
View Full Code Here

    @Override
    protected void exec()
    {
        // This formats the location correctly.
        // But we're not really interested in it all.
        DatasetGraphTDB dsg = DatasetBuilderStd.build(location) ;
       
        // so close indexes and the prefix table.
        dsg.getTripleTable().getNodeTupleTable().getTupleTable().close();
        dsg.getQuadTable().getNodeTupleTable().getTupleTable().close();
        // Later - attach prefix table to parser.
        dsg.getPrefixes().close() ;
       
        ProgressLogger monitor = new ProgressLogger(cmdLog, "Data", BulkLoader.DataTickPoint,BulkLoader.superTick) ;
        OutputStream outputTriples = null ;
        OutputStream outputQuads = null ;
       
        try {
            outputTriples = new FileOutputStream(dataFileTriples) ;
            outputQuads = new FileOutputStream(dataFileQuads) ;
        }
        catch (FileNotFoundException e) { throw new AtlasException(e) ; }
       
        NodeTableBuilder sink = new NodeTableBuilder(dsg, monitor, outputTriples, outputQuads) ;
        monitor.start() ;
        sink.startBulk() ;
        for( String filename : datafiles)
        {
            if ( datafiles.size() > 0 )
                cmdLog.info("Load: "+filename+" -- "+Utils.nowAsString()) ;
            RiotReader.parse(filename, sink) ;
        }
        sink.finishBulk() ;
        IO.close(outputTriples) ;
        IO.close(outputQuads) ;
       
        // ---- Stats
       
        // See Stats class.
        if ( ! location.isMem() )
            Stats.write(dsg.getLocation().getPath(Names.optStats), sink.getCollector().results()) ;
       
        // ---- Monitor
        long time = monitor.finish() ;

        long total = monitor.getTicks() ;
View Full Code Here

        TDBMaker.reset() ;
       
        DatasetGraphMakerTDB f = TDBMaker.getImplFactory() ;

       
        DatasetGraphTDB dg0 = TDBMaker._createDatasetGraph(Location.mem()) ;

        // Uncached.
        TDBMaker.setImplFactory(TDBMaker.uncachedFactory) ;
        DatasetGraphTDB dg1 = TDBMaker._createDatasetGraph(Location.mem()) ;
        DatasetGraphTDB dg2 = TDBMaker._createDatasetGraph(Location.mem()) ;
        assertNotSame(dg1, dg2) ;
       
        // Switch back to cached.
        TDBMaker.setImplFactory(f) ;
        DatasetGraphTDB dg3 = TDBMaker._createDatasetGraph(Location.mem()) ;
        assertNotSame(dg3, dg1) ;
        assertNotSame(dg3, dg2) ;
        assertSame(dg3, dg0) ;
    }
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.tdb.store.DatasetGraphTDB

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.