Java Code Examples for com.bigdata.rdf.sail.BigdataSail#getUnisolatedConnection()

The following examples show how to use com.bigdata.rdf.sail.BigdataSail#getUnisolatedConnection() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BigdataGASRunner.java    From database with GNU General Public License v2.0 6 votes vote down vote up
private void loadFiles(final BigdataSail sail, final String[] loadSet)
        throws Exception {
    boolean ok = false;
    final SailConnection cxn = sail.getUnisolatedConnection();
    try {
        final GraphLoader loader = new BigdataSailGraphLoader(cxn);
        for (String f : loadSet) {
            loader.loadGraph(null/* fallback */, f/* resource */);
        }
        cxn.commit();
        ok = true;
    } finally {
        if (!ok)
            cxn.rollback();
        cxn.close();
    }
}
 
Example 2
Source File: AbstractTestNanoSparqlClient.java    From database with GNU General Public License v2.0 4 votes vote down vote up
protected Server newFixture(final String lnamespace) throws Exception {

	   final IIndexManager indexManager = getIndexManager();
		
		final Properties properties = getProperties();

		// Create the triple store instance.
        createTripleStore(indexManager, lnamespace, properties);
        
        // Open an unisolated connection on that namespace and figure out what
        // mode the namespace is using.
        {
            final BigdataSail sail = new BigdataSail(lnamespace, indexManager);
            try {
                sail.initialize();
                final BigdataSailConnection con = sail.getUnisolatedConnection();
                try {
                    final AbstractTripleStore tripleStore = con.getTripleStore();
        if (tripleStore.isStatementIdentifiers()) {
			testMode = TestMode.sids;
        } else if (tripleStore.isQuads()) {
            testMode = TestMode.quads;
        } else {
            testMode = TestMode.triples;
        }
                } finally {
                    con.close();
                }
            } finally {
                sail.shutDown();
            }
        }

        final Map<String, String> initParams = new LinkedHashMap<String, String>();
        {

            initParams.put(ConfigParams.NAMESPACE, lnamespace);

            initParams.put(ConfigParams.CREATE, "false");
            
        }
        // Start server for that kb instance.
        final Server fixture = NanoSparqlServer.newInstance(0/* port */,
                indexManager, initParams);

        fixture.start();
		
        return fixture;
	}
 
Example 3
Source File: AbstractApiTask.java    From database with GNU General Public License v2.0 3 votes vote down vote up
protected BigdataSailConnection getUnisolatedSailConnection() throws SailException, InterruptedException {
    
    // Wrap with SAIL.
    final BigdataSail sail = new BigdataSail(namespace, getIndexManager());

    sail.initialize();

    final BigdataSailConnection conn = sail.getUnisolatedConnection();
    
    // Setup a change listener. It will notice the #of mutations.
    conn.addChangeLog(new SailChangeLog());
    
    return conn;

}