Search in sources :

Example 1 with PersonNamesProperty

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

the class TriplePropertyConverterTest method toAddsTheValueTypePersonNames.

@Test
public void toAddsTheValueTypePersonNames() throws Exception {
    PersonNames value = new PersonNames();
    value.list.add(PersonName.newInstance("forename", "surname"));
    Tuple<String, List<Triple>> to = instance.to(new PersonNamesProperty(PROP_NAME, value));
    assertThat(to.getRight(), contains(allOf(hasProperty("datatype", is("http://timbuctoo.huygens.knaw.nl/personnames")))));
}
Also used : PersonNames(nl.knaw.huygens.timbuctoo.model.PersonNames) List(java.util.List) PersonNamesProperty(nl.knaw.huygens.timbuctoo.core.dto.property.PersonNamesProperty) Test(org.junit.Test)

Example 2 with PersonNamesProperty

use of nl.knaw.huygens.timbuctoo.core.dto.property.PersonNamesProperty 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

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