use of org.openrefine.wikidata.updates.TermedStatementEntityEditBuilder in project OpenRefine by OpenRefine.
the class UpdateSchedulerTest method testNewItemNotMentioned.
@Test
public void testNewItemNotMentioned() throws ImpossibleSchedulingException {
TermedStatementEntityEdit updateA = new TermedStatementEntityEditBuilder(existingIdA).addStatement(sAtoNewA).build();
List<TermedStatementEntityEdit> scheduled = schedule(updateA);
TermedStatementEntityEdit newUpdate = new TermedStatementEntityEditBuilder(newIdA).build();
assertEquals(Arrays.asList(newUpdate, updateA), scheduled);
}
use of org.openrefine.wikidata.updates.TermedStatementEntityEditBuilder in project OpenRefine by OpenRefine.
the class UpdateSchedulerTest method testMergeNew.
@Test
public void testMergeNew() throws ImpossibleSchedulingException {
TermedStatementEntityEdit update1 = new TermedStatementEntityEditBuilder(newIdA).addLabel(Datamodel.makeMonolingualTextValue("hello", "fr"), true).addStatement(sNewAtoB).build();
TermedStatementEntityEdit update2 = new TermedStatementEntityEditBuilder(newIdA).addLabel(Datamodel.makeMonolingualTextValue("hello", "fr"), true).build();
TermedStatementEntityEdit merged = update1.merge(update2);
assertEquals(Collections.singletonList(merged), schedule(update1, update2));
}
use of org.openrefine.wikidata.updates.TermedStatementEntityEditBuilder in project OpenRefine by OpenRefine.
the class WikibaseAPIUpdateSchedulerTest method testUpdateIsNotSplit.
@Test
public void testUpdateIsNotSplit() throws ImpossibleSchedulingException {
TermedStatementEntityEdit updateA = new TermedStatementEntityEditBuilder(existingIdA).addStatement(sAtoNewA).addStatement(sAtoNewB).build();
TermedStatementEntityEdit newUpdateA = new TermedStatementEntityEditBuilder(newIdA).build();
TermedStatementEntityEdit newUpdateB = new TermedStatementEntityEditBuilder(newIdB).build();
List<TermedStatementEntityEdit> scheduled = schedule(updateA);
assertSetEquals(Arrays.asList(newUpdateA, newUpdateB, updateA), scheduled);
}
use of org.openrefine.wikidata.updates.TermedStatementEntityEditBuilder in project OpenRefine by OpenRefine.
the class WikibaseAPIUpdateSchedulerTest method testOrderPreserved.
@Test
public void testOrderPreserved() throws ImpossibleSchedulingException {
TermedStatementEntityEdit updateA = new TermedStatementEntityEditBuilder(existingIdA).addStatement(sAtoB).build();
TermedStatementEntityEdit updateB = new TermedStatementEntityEditBuilder(existingIdB).addStatement(sBtoA).build();
List<TermedStatementEntityEdit> scheduled = schedule(updateA, updateB);
assertEquals(Arrays.asList(updateA, updateB), scheduled);
}
use of org.openrefine.wikidata.updates.TermedStatementEntityEditBuilder in project OpenRefine by OpenRefine.
the class WikibaseAPIUpdateSchedulerTest method testMixedUpdate.
@Test
public void testMixedUpdate() throws ImpossibleSchedulingException {
TermedStatementEntityEdit updateA = new TermedStatementEntityEditBuilder(existingIdA).addStatement(sAtoNewA).addStatement(sAtoNewB).addStatement(sAtoB).build();
TermedStatementEntityEdit newUpdateA = new TermedStatementEntityEditBuilder(newIdA).addStatement(sNewAtoB).build();
TermedStatementEntityEdit newUpdateB = new TermedStatementEntityEditBuilder(newIdB).build();
List<TermedStatementEntityEdit> scheduled = schedule(updateA, newUpdateA);
assertEquals(Arrays.asList(newUpdateA, newUpdateB, updateA), scheduled);
}
Aggregations