Search in sources :

Example 1 with MemoryStore

use of org.eclipse.rdf4j.sail.memory.MemoryStore in project graal by graphik-team.

the class TestUtil method getAtomSet.

public static AtomSet[] getAtomSet() {
    if (neo4jStore != null) {
        neo4jStore.close();
    }
    try {
        if (defaultRDBMSStore != null) {
            defaultRDBMSStore.close();
        }
        if (plainTableRDBMSStore != null) {
            plainTableRDBMSStore.close();
        }
        defaultRDBMSStore = new AdHocRdbmsStore(new HSQLDBDriver(DEFAULT_RDBMS_TEST, null));
        plainTableRDBMSStore = new NaturalRDBMSStore(new HSQLDBDriver(PLAIN_TABLE_RDBMS_TEST, null));
        defaultRDBMSStore.clear();
        plainTableRDBMSStore.clear();
        rm(NEO4J_TEST);
        neo4jStore = new Neo4jStore(NEO4J_TEST);
        if (sailStore != null) {
            sailStore.close();
        }
        try {
            sailStore = new RDF4jStore(new SailRepository(new MemoryStore()));
        } catch (AtomSetException e) {
            Assert.assertTrue("Error while creating SailStore", false);
        }
        return new AtomSet[] { new DefaultInMemoryGraphStore(), new LinkedListAtomSet(), defaultRDBMSStore, plainTableRDBMSStore, neo4jStore, sailStore };
    } catch (SQLException e) {
        throw new Error(e);
    } catch (AtomSetException e) {
        throw new Error(e);
    }
}
Also used : Neo4jStore(fr.lirmm.graphik.graal.store.gdb.Neo4jStore) RDF4jStore(fr.lirmm.graphik.graal.store.triplestore.rdf4j.RDF4jStore) SailRepository(org.eclipse.rdf4j.repository.sail.SailRepository) SQLException(java.sql.SQLException) LinkedListAtomSet(fr.lirmm.graphik.graal.core.atomset.LinkedListAtomSet) AtomSet(fr.lirmm.graphik.graal.api.core.AtomSet) LinkedListAtomSet(fr.lirmm.graphik.graal.core.atomset.LinkedListAtomSet) IOError(java.io.IOError) NaturalRDBMSStore(fr.lirmm.graphik.graal.store.rdbms.natural.NaturalRDBMSStore) AdHocRdbmsStore(fr.lirmm.graphik.graal.store.rdbms.adhoc.AdHocRdbmsStore) MemoryStore(org.eclipse.rdf4j.sail.memory.MemoryStore) AtomSetException(fr.lirmm.graphik.graal.api.core.AtomSetException) HSQLDBDriver(fr.lirmm.graphik.graal.store.rdbms.driver.HSQLDBDriver) DefaultInMemoryGraphStore(fr.lirmm.graphik.graal.core.atomset.graph.DefaultInMemoryGraphStore)

Example 2 with MemoryStore

use of org.eclipse.rdf4j.sail.memory.MemoryStore in project nextprot-api by calipho-sib.

the class PhenotypicTTLIntegrationTest method init.

@Before
public void init() throws Exception {
    String prefixes = this.mockMvc.perform(get("/common-prefixes.ttl")).andReturn().getResponse().getContentAsString();
    // Prepare repository
    String ttlContent = this.mockMvc.perform(get("/entry/NX_Q15858.ttl")).andReturn().getResponse().getContentAsString();
    // Daniel: Missing terminologies and other things I guess...
    String ttl = prefixes + ttlContent;
    // System.out.println(ttl);
    testRepo = new SailRepository(new MemoryStore());
    testRepo.initialize();
    InputStream stream = new ByteArrayInputStream((ttl).getBytes());
    testRepo.getConnection().add(stream, "", RDFFormat.TURTLE, new Resource[] {});
}
Also used : MemoryStore(org.eclipse.rdf4j.sail.memory.MemoryStore) SailRepository(org.eclipse.rdf4j.repository.sail.SailRepository) ByteArrayInputStream(java.io.ByteArrayInputStream) ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) Before(org.junit.Before)

Aggregations

SailRepository (org.eclipse.rdf4j.repository.sail.SailRepository)2 MemoryStore (org.eclipse.rdf4j.sail.memory.MemoryStore)2 AtomSet (fr.lirmm.graphik.graal.api.core.AtomSet)1 AtomSetException (fr.lirmm.graphik.graal.api.core.AtomSetException)1 LinkedListAtomSet (fr.lirmm.graphik.graal.core.atomset.LinkedListAtomSet)1 DefaultInMemoryGraphStore (fr.lirmm.graphik.graal.core.atomset.graph.DefaultInMemoryGraphStore)1 Neo4jStore (fr.lirmm.graphik.graal.store.gdb.Neo4jStore)1 AdHocRdbmsStore (fr.lirmm.graphik.graal.store.rdbms.adhoc.AdHocRdbmsStore)1 HSQLDBDriver (fr.lirmm.graphik.graal.store.rdbms.driver.HSQLDBDriver)1 NaturalRDBMSStore (fr.lirmm.graphik.graal.store.rdbms.natural.NaturalRDBMSStore)1 RDF4jStore (fr.lirmm.graphik.graal.store.triplestore.rdf4j.RDF4jStore)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOError (java.io.IOError)1 InputStream (java.io.InputStream)1 SQLException (java.sql.SQLException)1 Before (org.junit.Before)1