Search in sources :

Example 1 with RdbmsStore

use of fr.lirmm.graphik.graal.store.rdbms.RdbmsStore in project graal by graphik-team.

the class StoreTest method caseSensitivityTest.

@Theory
public void caseSensitivityTest(AtomSet store) throws AtomSetException, IteratorException, ParseException, SQLException {
    Assume.assumeTrue(!(store instanceof RdbmsStore) || ((RdbmsStore) store).getDriver().isCaseSensitive());
    Atom toAdd = DlgpParser.parseAtom("<P>(a,b).");
    Atom toCheck = DlgpParser.parseAtom("<p>(a,b).");
    Predicate predicateToCheck = new Predicate("p", 2);
    store.add(toAdd);
    Assert.assertTrue(store.contains(toAdd));
    Assert.assertFalse(store.contains(toCheck));
    CloseableIterator<?> it = store.termsByPredicatePosition(predicateToCheck, 0);
    Assert.assertFalse(it.hasNext());
    it = store.atomsByPredicate(predicateToCheck);
    Assert.assertFalse(it.hasNext());
    it = store.match(DlgpParser.parseAtom("<p>(X,Y)."));
    Assert.assertFalse(it.hasNext());
}
Also used : RdbmsStore(fr.lirmm.graphik.graal.store.rdbms.RdbmsStore) Atom(fr.lirmm.graphik.graal.api.core.Atom) Predicate(fr.lirmm.graphik.graal.api.core.Predicate) Theory(org.junit.experimental.theories.Theory)

Example 2 with RdbmsStore

use of fr.lirmm.graphik.graal.store.rdbms.RdbmsStore in project graal by graphik-team.

the class TestUtil method getStores.

public static RdbmsStore[] getStores() {
    if (defaultRdbms != null) {
        try {
            defaultRdbms.getDriver().getConnection().createStatement().executeQuery("DROP SCHEMA PUBLIC CASCADE");
        } catch (SQLException e) {
            throw new Error(e);
        }
        defaultRdbms.close();
    }
    if (plainTableRdbms != null) {
        try {
            plainTableRdbms.getDriver().getConnection().createStatement().executeQuery("DROP SCHEMA PUBLIC CASCADE");
        } catch (SQLException e) {
            throw new Error(e);
        }
        plainTableRdbms.close();
    }
    try {
        defaultRdbms = new AdHocRdbmsStore(new HSQLDBDriver(DEFAULT_TEST, null));
        plainTableRdbms = new NaturalRDBMSStore(new HSQLDBDriver(PLAIN_TABLE_TEST, null));
    } catch (AtomSetException e) {
        throw new Error(e);
    } catch (SQLException e) {
        throw new Error(e);
    }
    return new RdbmsStore[] { defaultRdbms, plainTableRdbms };
}
Also used : SQLException(java.sql.SQLException) AtomSetException(fr.lirmm.graphik.graal.api.core.AtomSetException) HSQLDBDriver(fr.lirmm.graphik.graal.store.rdbms.driver.HSQLDBDriver) RdbmsStore(fr.lirmm.graphik.graal.store.rdbms.RdbmsStore) AdHocRdbmsStore(fr.lirmm.graphik.graal.store.rdbms.adhoc.AdHocRdbmsStore) NaturalRDBMSStore(fr.lirmm.graphik.graal.store.rdbms.natural.NaturalRDBMSStore) AdHocRdbmsStore(fr.lirmm.graphik.graal.store.rdbms.adhoc.AdHocRdbmsStore)

Aggregations

RdbmsStore (fr.lirmm.graphik.graal.store.rdbms.RdbmsStore)2 Atom (fr.lirmm.graphik.graal.api.core.Atom)1 AtomSetException (fr.lirmm.graphik.graal.api.core.AtomSetException)1 Predicate (fr.lirmm.graphik.graal.api.core.Predicate)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 SQLException (java.sql.SQLException)1 Theory (org.junit.experimental.theories.Theory)1