use of nl.knaw.huygens.timbuctoo.v5.dataset.ImportStatus in project timbuctoo by HuygensING.
the class BdbSchemaStoreTest method generatesASchemaForAllAdded.
@Test
public void generatesASchemaForAllAdded() throws Exception {
final DummyDataStorage dataStore = new DummyDataStorage();
ChangeFetcher changeFetcher = new DummyChangeFetcher(CursorQuad.create("subj", "pred", Direction.OUT, ChangeType.ASSERTED, "obj", null, null, ""), CursorQuad.create("subj", RdfConstants.RDF_TYPE, Direction.OUT, ChangeType.ASSERTED, "type", null, null, ""), CursorQuad.create("obj", "pred", Direction.IN, ChangeType.ASSERTED, "subj", null, null, ""));
BdbSchemaStore schemaStore = new BdbSchemaStore(dataStore, new ImportStatus(new LogList()));
schemaStore.start();
schemaStore.onChangedSubject("subj", changeFetcher);
schemaStore.onChangedSubject("obj", changeFetcher);
schemaStore.finish();
assertThat(dataStore.getResult(), is("{\n" + " \"http://timbuctoo.huygens.knaw.nl/static/v5/vocabulary#unknown\" : {\n" + " \"name\" : \"http://timbuctoo.huygens.knaw.nl/static/v5/vocabulary#unknown\",\n" + " \"predicates\" : [ {\n" + " \"name\" : \"pred\",\n" + " \"direction\" : \"IN\",\n" + " \"valueTypes\" : { },\n" + " \"referenceTypes\" : {\n" + " \"type\" : 1\n" + " },\n" + " \"subjectsWithThisPredicate\" : 1,\n" + " \"subjectsWithThisPredicateAsList\" : 0,\n" + " \"hasBeenList\" : false,\n" + " \"hasBeenSingular\" : true\n" + " } ],\n" + " \"subjectsWithThisType\" : 1\n" + " },\n" + " \"type\" : {\n" + " \"name\" : \"type\",\n" + " \"predicates\" : [ {\n" + " \"name\" : \"http://www.w3.org/1999/02/22-rdf-syntax-ns#type\",\n" + " \"direction\" : \"OUT\",\n" + " \"valueTypes\" : { },\n" + " \"referenceTypes\" : {\n" + " \"http://timbuctoo.huygens.knaw.nl/static/v5/vocabulary#unknown\" : 1\n" + " },\n" + " \"subjectsWithThisPredicate\" : 1,\n" + " \"subjectsWithThisPredicateAsList\" : 0,\n" + " \"hasBeenList\" : false,\n" + " \"hasBeenSingular\" : true\n" + " }, {\n" + " \"name\" : \"pred\",\n" + " \"direction\" : \"OUT\",\n" + " \"valueTypes\" : { },\n" + " \"referenceTypes\" : {\n" + " \"http://timbuctoo.huygens.knaw.nl/static/v5/vocabulary#unknown\" : 1\n" + " },\n" + " \"subjectsWithThisPredicate\" : 1,\n" + " \"subjectsWithThisPredicateAsList\" : 0,\n" + " \"hasBeenList\" : false,\n" + " \"hasBeenSingular\" : true\n" + " } ],\n" + " \"subjectsWithThisType\" : 1\n" + " }\n" + "}"));
}
Aggregations