Search in sources :

Example 6 with ImportPropertyDescriptions

use of nl.knaw.huygens.timbuctoo.bulkupload.parsingstatemachine.ImportPropertyDescriptions in project timbuctoo by HuygensING.

the class TinkerpopSaverTest method addPropertyDescriptionsAddsThePropertyDescriptionsToTheCollection.

@Test
public void addPropertyDescriptionsAddsThePropertyDescriptionsToTheCollection() {
    final TinkerpopSaver instance = new TinkerpopSaver(vres, graphWrapper, VRE_NAME, VRE_NAME, MAX_VERTICES_PER_TRANSACTION, VRE_NAME);
    ImportPropertyDescriptions importPropertyDescriptions = new ImportPropertyDescriptions();
    importPropertyDescriptions.getOrCreate(6).setPropertyName("first");
    importPropertyDescriptions.getOrCreate(5).setPropertyName("second");
    importPropertyDescriptions.getOrCreate(7).setPropertyName("third");
    instance.addPropertyDescriptions(rawCollection, importPropertyDescriptions);
    List<Vertex> properties = graphWrapper.getGraph().traversal().V(rawCollection.id()).out("hasProperty").toList();
    assertThat(properties, hasSize(3));
    assertThat(properties, containsInAnyOrder(likeVertex().withProperty("order", 0).withProperty("id", 6).withProperty("name", "first"), likeVertex().withProperty("order", 1).withProperty("id", 5).withProperty("name", "second"), likeVertex().withProperty("order", 2).withProperty("id", 7).withProperty("name", "third")));
}
Also used : ImportPropertyDescriptions(nl.knaw.huygens.timbuctoo.bulkupload.parsingstatemachine.ImportPropertyDescriptions) Vertex(org.apache.tinkerpop.gremlin.structure.Vertex) VertexMatcher.likeVertex(nl.knaw.huygens.timbuctoo.util.VertexMatcher.likeVertex) TinkerpopSaver(nl.knaw.huygens.timbuctoo.database.tinkerpop.TinkerpopSaver) Test(org.junit.Test)

Aggregations

ImportPropertyDescriptions (nl.knaw.huygens.timbuctoo.bulkupload.parsingstatemachine.ImportPropertyDescriptions)6 Test (org.junit.Test)6 Matchers.containsString (org.hamcrest.Matchers.containsString)3 TinkerpopSaver (nl.knaw.huygens.timbuctoo.database.tinkerpop.TinkerpopSaver)2 VertexMatcher.likeVertex (nl.knaw.huygens.timbuctoo.util.VertexMatcher.likeVertex)2 RawUploadRdfSaver (nl.knaw.huygens.timbuctoo.v5.bulkupload.RawUploadRdfSaver)2 Vertex (org.apache.tinkerpop.gremlin.structure.Vertex)2 Row (nl.knaw.huygens.timbuctoo.rml.Row)1 ThrowingErrorHandler (nl.knaw.huygens.timbuctoo.rml.ThrowingErrorHandler)1 JexlRowFactory (nl.knaw.huygens.timbuctoo.rml.datasource.jexl.JexlRowFactory)1 HashMapBasedJoinHandler (nl.knaw.huygens.timbuctoo.rml.datasource.joinhandlers.HashMapBasedJoinHandler)1 StringStringIsCleanHandler (nl.knaw.huygens.timbuctoo.v5.berkeleydb.isclean.StringStringIsCleanHandler)1 ImportStatus (nl.knaw.huygens.timbuctoo.v5.dataset.ImportStatus)1 BasicDataSetMetaData (nl.knaw.huygens.timbuctoo.v5.dataset.dto.BasicDataSetMetaData)1 DataSetMetaData (nl.knaw.huygens.timbuctoo.v5.dataset.dto.DataSetMetaData)1 LogList (nl.knaw.huygens.timbuctoo.v5.dataset.dto.LogList)1 RmlDataSourceStore (nl.knaw.huygens.timbuctoo.v5.datastores.rmldatasource.RmlDataSourceStore)1 BdbNonPersistentEnvironmentCreator (nl.knaw.huygens.timbuctoo.v5.dropwizard.BdbNonPersistentEnvironmentCreator)1 RdfSerializer (nl.knaw.huygens.timbuctoo.v5.rdfio.RdfSerializer)1 RdfDataSource (nl.knaw.huygens.timbuctoo.v5.rml.RdfDataSource)1