Search in sources :

Example 1 with LiteralTriple

use of nl.knaw.huygens.timbuctoo.rdf.LiteralTriple in project timbuctoo by HuygensING.

the class TriplePropertyConverterTest method toCreatesATripleWithAJsonVersionOfPersonNames.

@Test
public void toCreatesATripleWithAJsonVersionOfPersonNames() throws Exception {
    PersonNames value = new PersonNames();
    value.list.add(PersonName.newInstance("forename", "surname"));
    ObjectMapper objectMapper = new ObjectMapper();
    String objectValue = objectMapper.writeValueAsString(value);
    Tuple<String, List<Triple>> to = instance.to(new PersonNamesProperty(PROP_NAME, value));
    LiteralTriple triple = (LiteralTriple) to.getRight().get(0);
    assertThat(triple.getSubject(), is(SUBJECT_URI));
    assertThat(triple.getPredicate(), endsWith(PROP_NAME));
    assertThat(triple.getObject(), is(objectValue));
    assertThat(triple.getDatatype(), is("http://timbuctoo.huygens.knaw.nl/personnames"));
}
Also used : PersonNames(nl.knaw.huygens.timbuctoo.model.PersonNames) LiteralTriple(nl.knaw.huygens.timbuctoo.rdf.LiteralTriple) List(java.util.List) PersonNamesProperty(nl.knaw.huygens.timbuctoo.core.dto.property.PersonNamesProperty) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Aggregations

ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 List (java.util.List)1 PersonNamesProperty (nl.knaw.huygens.timbuctoo.core.dto.property.PersonNamesProperty)1 PersonNames (nl.knaw.huygens.timbuctoo.model.PersonNames)1 LiteralTriple (nl.knaw.huygens.timbuctoo.rdf.LiteralTriple)1 Test (org.junit.Test)1