use of nl.knaw.huygens.timbuctoo.v5.dataset.ChangeFetcher in project timbuctoo by HuygensING.
the class ChangeFetcherImplTest method showsAdditions.
@Test
public void showsAdditions() throws Exception {
final BdbNonPersistentEnvironmentCreator databaseCreator = new BdbNonPersistentEnvironmentCreator();
final BdbTripleStore bdbTripleStore = new BdbTripleStore(databaseCreator.getDatabase("a", "b", "rdfData", true, TupleBinding.getPrimitiveBinding(String.class), TupleBinding.getPrimitiveBinding(String.class), new StringStringIsCleanHandler()));
final BdbTruePatchStore truePatchStore = new BdbTruePatchStore(databaseCreator.getDatabase("a", "b", "truePatch", true, TupleBinding.getPrimitiveBinding(String.class), TupleBinding.getPrimitiveBinding(String.class), new StringStringIsCleanHandler()));
bdbTripleStore.putQuad("subj", "pred", OUT, "obj", null, null);
truePatchStore.put("subj", 0, "pred", OUT, true, "obj", null, null);
ChangeFetcherImpl changeFetcher = new ChangeFetcherImpl(truePatchStore, bdbTripleStore, 0);
try (Stream<CursorQuad> predicates = changeFetcher.getPredicates("subj", "pred", OUT, false, false, true)) {
assertThat(predicates.count(), is(1L));
}
try (Stream<CursorQuad> predicates = changeFetcher.getPredicates("subj", "pred", OUT, true, true, true)) {
assertThat(predicates.count(), is(1L));
}
try (Stream<CursorQuad> predicates = changeFetcher.getPredicates("subj", "pred", OUT, true, false, true)) {
assertThat(predicates.count(), is(1L));
}
bdbTripleStore.putQuad("subj", "pred", OUT, "obj2", null, null);
truePatchStore.put("subj", 1, "pred", OUT, true, "obj2", null, null);
changeFetcher = new ChangeFetcherImpl(truePatchStore, bdbTripleStore, 1);
try (Stream<CursorQuad> predicates = changeFetcher.getPredicates("subj", "pred", OUT, false, false, true)) {
assertThat(predicates.count(), is(1L));
}
try (Stream<CursorQuad> predicates = changeFetcher.getPredicates("subj", "pred", OUT, true, true, true)) {
assertThat(predicates.count(), is(2L));
}
try (Stream<CursorQuad> predicates = changeFetcher.getPredicates("subj", "pred", OUT, true, false, true)) {
assertThat(predicates.count(), is(1L));
}
}
Aggregations