Search in sources :

Example 16 with ImportStatus

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" + "}"));
}
Also used : LogList(nl.knaw.huygens.timbuctoo.v5.dataset.dto.LogList) ImportStatus(nl.knaw.huygens.timbuctoo.v5.dataset.ImportStatus) ChangeFetcher(nl.knaw.huygens.timbuctoo.v5.dataset.ChangeFetcher) Test(org.junit.Test)

Aggregations

ImportStatus (nl.knaw.huygens.timbuctoo.v5.dataset.ImportStatus)8 LogStorageFailedException (nl.knaw.huygens.timbuctoo.v5.filestorage.exceptions.LogStorageFailedException)6 Test (org.junit.Test)6 IOException (java.io.IOException)5 DataSet (nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSet)5 File (java.io.File)4 ImportManager (nl.knaw.huygens.timbuctoo.v5.dataset.ImportManager)4 LogEntry (nl.knaw.huygens.timbuctoo.v5.dataset.dto.LogEntry)4 LogList (nl.knaw.huygens.timbuctoo.v5.dataset.dto.LogList)4 User (nl.knaw.huygens.timbuctoo.v5.security.dto.User)4 FileInputStream (java.io.FileInputStream)3 InputStream (java.io.InputStream)3 Optional (java.util.Optional)3 POST (javax.ws.rs.POST)3 MediaType (javax.ws.rs.core.MediaType)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 Collectors (java.util.stream.Collectors)2 Response (javax.ws.rs.core.Response)2