Search in sources :

Example 1 with MethodNotImplementedError

use of fr.lirmm.graphik.util.MethodNotImplementedError in project graal by graphik-team.

the class StoreTest method removeAllTest.

@Theory
public void removeAllTest(AtomSet store) throws AtomSetException, IteratorException {
    // given
    store.add(DlgpParser.parseAtom("<P>(b,a)."));
    store.add(DlgpParser.parseAtom("<P>(a,a)."));
    store.add(DlgpParser.parseAtom("<P>(b,b)."));
    store.add(DlgpParser.parseAtom("<P>(a,c)."));
    store.add(DlgpParser.parseAtom("<Q>(a,a)."));
    store.add(DlgpParser.parseAtom("<Q>(a,b)."));
    // when
    try {
        store.removeAll(DlgpParser.parseAtomSet("<P>(a,c), <Q>(a,a)."));
    } catch (MethodNotImplementedError e) {
        return;
    }
    // then
    Assert.assertFalse(store.contains(DlgpParser.parseAtom("<P>(a,c).")));
    Assert.assertFalse(store.contains(DlgpParser.parseAtom("<Q>(a,a).")));
    Assert.assertEquals(3, Iterators.count(store.atomsByPredicate(new Predicate("P", 2))));
    Assert.assertEquals(1, Iterators.count(store.atomsByPredicate(new Predicate("Q", 2))));
}
Also used : MethodNotImplementedError(fr.lirmm.graphik.util.MethodNotImplementedError) Predicate(fr.lirmm.graphik.graal.api.core.Predicate) Theory(org.junit.experimental.theories.Theory)

Example 2 with MethodNotImplementedError

use of fr.lirmm.graphik.util.MethodNotImplementedError in project graal by graphik-team.

the class StoreTest method removeTest.

@Theory
public void removeTest(AtomSet store) throws AtomSetException, IteratorException {
    // given
    store.add(DlgpParser.parseAtom("<P>(b,a)."));
    store.add(DlgpParser.parseAtom("<P>(a,a)."));
    store.add(DlgpParser.parseAtom("<P>(b,b)."));
    store.add(DlgpParser.parseAtom("<P>(a,c)."));
    store.add(DlgpParser.parseAtom("<Q>(a,a)."));
    store.add(DlgpParser.parseAtom("<Q>(a,b)."));
    // when
    try {
        store.remove(DlgpParser.parseAtom("<P>(a,c)."));
    } catch (MethodNotImplementedError e) {
        return;
    }
    // then
    Assert.assertFalse(store.contains(DlgpParser.parseAtom("<P>(a,c).")));
    Assert.assertEquals(3, Iterators.count(store.atomsByPredicate(new Predicate("P", 2))));
    Assert.assertEquals(2, Iterators.count(store.atomsByPredicate(new Predicate("Q", 2))));
}
Also used : MethodNotImplementedError(fr.lirmm.graphik.util.MethodNotImplementedError) Predicate(fr.lirmm.graphik.graal.api.core.Predicate) Theory(org.junit.experimental.theories.Theory)

Aggregations

Predicate (fr.lirmm.graphik.graal.api.core.Predicate)2 MethodNotImplementedError (fr.lirmm.graphik.util.MethodNotImplementedError)2 Theory (org.junit.experimental.theories.Theory)2