use of nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.Predicate in project timbuctoo by HuygensING.
the class PredicateTest method mergeThrowsExceptionIfPredicateDirectionsDontMatch.
@Test(expected = IllegalArgumentException.class)
public void mergeThrowsExceptionIfPredicateDirectionsDontMatch() throws Exception {
Predicate predicate1 = createPredicate("predicate", Direction.OUT, "testOwner");
Predicate predicate2 = createPredicate("predicate", Direction.IN, "testOwner");
predicate1.merge(predicate2);
}
use of nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.Predicate in project timbuctoo by HuygensING.
the class PredicateTest method mergeCombinesValuesMap.
@Test
public void mergeCombinesValuesMap() throws Exception {
Predicate predicate1 = createPredicate("predicate", Direction.OUT, "testOwner");
Map<String, Long> valueTypes1 = new HashMap<>();
valueTypes1.put("Test Value", 1L);
valueTypes1.put("Test Value 2", 1L);
predicate1.setValueTypes(valueTypes1);
final Predicate predicate2 = createPredicate("predicate", Direction.OUT, "testOwner");
Map<String, Long> valueTypes2 = new HashMap<>();
valueTypes2.put("Test Value", 1L);
valueTypes2.put("Test Value 2", 1L);
valueTypes2.put("Test Value 3", 1L);
predicate2.setValueTypes(valueTypes2);
Predicate mergedPredicate = predicate1.merge(predicate2);
assertThat(mergedPredicate.getValueTypes(), IsMapContaining.hasEntry("Test Value", 2L));
assertThat(mergedPredicate.getValueTypes(), IsMapContaining.hasEntry("Test Value 2", 2L));
assertThat(mergedPredicate.getValueTypes(), IsMapContaining.hasEntry("Test Value 3", 1L));
}
use of nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.Predicate in project timbuctoo by HuygensING.
the class PredicateTest method mergeThrowsExceptionIfPredicateOwnersDontMatch.
@Test(expected = IllegalArgumentException.class)
public void mergeThrowsExceptionIfPredicateOwnersDontMatch() throws Exception {
Predicate predicate1 = createPredicate("predicate", Direction.OUT, "testOwner");
Predicate predicate2 = createPredicate("predicate", Direction.OUT, "testOwner2");
predicate1.merge(predicate2);
}
use of nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.Predicate in project timbuctoo by HuygensING.
the class PredicateTest method mergeThrowsExceptionIfPredicateNamesDontMatch.
@Test(expected = IllegalArgumentException.class)
public void mergeThrowsExceptionIfPredicateNamesDontMatch() throws Exception {
Predicate predicate1 = createPredicate("predicate1", Direction.OUT, "testOwner");
Predicate predicate2 = createPredicate("predicate2", Direction.OUT, "testOwner");
predicate1.merge(predicate2);
}
use of nl.knaw.huygens.timbuctoo.v5.datastores.schemastore.dto.Predicate in project timbuctoo by HuygensING.
the class RdfDescriptionSaver method delRelation.
@Override
public void delRelation(String subject, String predicate, String object, String graph) throws RdfProcessingFailedException {
try {
if (Objects.equals(subject, baseUri)) {
ValueFactory vf = SimpleValueFactory.getInstance();
model.remove(vf.createIRI(subject), vf.createIRI(predicate), vf.createIRI(object));
}
} catch (Exception e) {
throw new RdfProcessingFailedException(e);
}
}
Aggregations