Search in sources :

Example 6 with RmlMappingDocument

use of nl.knaw.huygens.timbuctoo.rml.rmldata.RmlMappingDocument in project timbuctoo by HuygensING.

the class RmlMapperTest method canHandleMappingsInTheWrongOrder.

@Test
public void canHandleMappingsInTheWrongOrder() {
    final String theNamePredicate = "http://example.org/vocab#name";
    final String theWrittenByPredicate = "http://example.org/vocab#writtenBy";
    RmlMappingDocument rmlMappingDocument = rmlMappingDocument().withTripleMap("http://example.org/documentsMap", makeDocumentMap(theWrittenByPredicate)).withTripleMap("http://example.org/personsMap", makePersonMap(theNamePredicate)).build(makePersonDocumentSourceFactory());
    List<Quad> result = rmlMappingDocument.execute(new ThrowingErrorHandler()).collect(toList());
    assertThat(result, contains(likeTriple(uri("http://www.example.org/persons/1"), uri(theNamePredicate), literal("Bill")), likeTriple(uri("http://www.example.org/documents/1"), uri(theWrittenByPredicate), uri("http://www.example.org/persons/1"))));
}
Also used : Quad(nl.knaw.huygens.timbuctoo.rml.dto.Quad) RmlMappingDocument(nl.knaw.huygens.timbuctoo.rml.rmldata.RmlMappingDocument) Test(org.junit.Test)

Aggregations

Quad (nl.knaw.huygens.timbuctoo.rml.dto.Quad)6 RmlMappingDocument (nl.knaw.huygens.timbuctoo.rml.rmldata.RmlMappingDocument)6 Test (org.junit.Test)5 ImmutableMap (com.google.common.collect.ImmutableMap)1 Lists (com.google.common.collect.Lists)1 Maps (com.google.common.collect.Maps)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Set (java.util.Set)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Consumer (java.util.function.Consumer)1 Function (java.util.function.Function)1 Collectors (java.util.stream.Collectors)1 Collectors.toList (java.util.stream.Collectors.toList)1 ANY (nl.knaw.huygens.timbuctoo.rml.TripleMatcher.ANY)1 TripleMatcher.likeTriple (nl.knaw.huygens.timbuctoo.rml.TripleMatcher.likeTriple)1