Search in sources :

Example 6 with DataStream

use of nl.knaw.huygens.timbuctoo.core.dto.DataStream in project timbuctoo by HuygensING.

the class TripleImporterIntegrationTest method importTripleShouldMapToARelationBetweenTheSubjectAndAnExistingObjectVertex.

@Test
public void importTripleShouldMapToARelationBetweenTheSubjectAndAnExistingObjectVertex() throws Exception {
    final Triple abadan = createTripleIterator(ABADAN_POINT_TRIPLE).next();
    final Triple iran = createTripleIterator(IRAN_POINT_TRIPLE).next();
    final Triple relation = createTripleIterator(ABADAN_IS_PART_OF_IRAN_TRIPLE).next();
    instance.importTriple(true, abadan);
    instance.importTriple(true, iran);
    instance.importTriple(true, relation);
    rdfImportSession.commit();
    rdfImportSession.close();
    Collection collectionMetadata = timbuctooActions.getCollectionMetadata(DEFAULT_COLLECTION_NAME);
    DataStream<ReadEntity> result = timbuctooActions.getCollection(collectionMetadata, 0, 10, false, (entity, entityVertex) -> {
    }, (traversalSource, vre, target, relationRef) -> {
    });
    assertThat(result.map(readEntity -> readEntity), hasSize(2));
}
Also used : Triple(org.apache.jena.graph.Triple) TripleCreator.createSingleTriple(nl.knaw.huygens.timbuctoo.rdf.TripleCreator.createSingleTriple) ReadEntity(nl.knaw.huygens.timbuctoo.core.dto.ReadEntity) TripleCreator.createTripleIterator(nl.knaw.huygens.timbuctoo.rdf.TripleCreator.createTripleIterator) CoreMatchers.hasItem(org.hamcrest.CoreMatchers.hasItem) CoreMatchers.equalTo(org.hamcrest.CoreMatchers.equalTo) RdfImportSession(nl.knaw.huygens.timbuctoo.core.RdfImportSession) TimbuctooActionsStubs(nl.knaw.huygens.timbuctoo.core.TimbuctooActionsStubs) Collection(nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection) TripleCreator.createSingleTripleWithLiteralObject(nl.knaw.huygens.timbuctoo.rdf.TripleCreator.createSingleTripleWithLiteralObject) Matchers.hasProperty(org.hamcrest.Matchers.hasProperty) VresBuilder(nl.knaw.huygens.timbuctoo.model.vre.vres.VresBuilder) TimbuctooActions(nl.knaw.huygens.timbuctoo.core.TimbuctooActions) CoreMatchers.allOf(org.hamcrest.CoreMatchers.allOf) Matchers.hasSize(org.hamcrest.Matchers.hasSize) OptionalPresentMatcher.present(nl.knaw.huygens.hamcrest.OptionalPresentMatcher.present) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) TestGraphBuilder.newGraph(nl.knaw.huygens.timbuctoo.util.TestGraphBuilder.newGraph) Before(org.junit.Before) RelationType(nl.knaw.huygens.timbuctoo.core.dto.RelationType) CollectionNameHelper(nl.knaw.huygens.timbuctoo.core.CollectionNameHelper) TinkerPopOperations(nl.knaw.huygens.timbuctoo.database.tinkerpop.TinkerPopOperations) Matchers.notNullValue(org.hamcrest.Matchers.notNullValue) DataStream(nl.knaw.huygens.timbuctoo.core.dto.DataStream) TinkerPopGraphManager(nl.knaw.huygens.timbuctoo.server.TinkerPopGraphManager) CollectionBuilder(nl.knaw.huygens.timbuctoo.core.dto.dataset.CollectionBuilder) EntityFinisherHelper(nl.knaw.huygens.timbuctoo.core.EntityFinisherHelper) Triple(org.apache.jena.graph.Triple) TripleCreator.createSingleTriple(nl.knaw.huygens.timbuctoo.rdf.TripleCreator.createSingleTriple) Test(org.junit.Test) Vres(nl.knaw.huygens.timbuctoo.model.vre.Vres) ReadEntity(nl.knaw.huygens.timbuctoo.core.dto.ReadEntity) List(java.util.List) Matchers.contains(org.hamcrest.Matchers.contains) Matchers.containsInAnyOrder(org.hamcrest.Matchers.containsInAnyOrder) Vre(nl.knaw.huygens.timbuctoo.model.vre.Vre) Optional(java.util.Optional) ExtendedIterator(org.apache.jena.util.iterator.ExtendedIterator) Matchers.is(org.hamcrest.Matchers.is) Collection(nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection) Test(org.junit.Test)

Aggregations

List (java.util.List)6 Optional (java.util.Optional)6 DataStream (nl.knaw.huygens.timbuctoo.core.dto.DataStream)6 ReadEntity (nl.knaw.huygens.timbuctoo.core.dto.ReadEntity)6 Collection (nl.knaw.huygens.timbuctoo.core.dto.dataset.Collection)6 Vres (nl.knaw.huygens.timbuctoo.model.vre.Vres)6 IOException (java.io.IOException)5 UUID (java.util.UUID)5 AlreadyUpdatedException (nl.knaw.huygens.timbuctoo.core.AlreadyUpdatedException)5 EntityFinisherHelper (nl.knaw.huygens.timbuctoo.core.EntityFinisherHelper)5 NotFoundException (nl.knaw.huygens.timbuctoo.core.NotFoundException)5 RelationType (nl.knaw.huygens.timbuctoo.core.dto.RelationType)5 CollectionBuilder (nl.knaw.huygens.timbuctoo.core.dto.dataset.CollectionBuilder)5 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)4 Lists (com.google.common.collect.Lists)4 URI (java.net.URI)4 Instant (java.time.Instant)4 Collectors.toList (java.util.stream.Collectors.toList)4 CollectionNameHelper.defaultEntityTypeName (nl.knaw.huygens.timbuctoo.core.CollectionNameHelper.defaultEntityTypeName)4 RelationNotPossibleException (nl.knaw.huygens.timbuctoo.core.RelationNotPossibleException)4