use of org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue in project OpenRefine by OpenRefine.
the class TermedStatementEntityEditTest method testMergeLabelsIfNew.
@Test
public void testMergeLabelsIfNew() {
MonolingualTextValue label1 = Datamodel.makeMonolingualTextValue("first label", "en");
MonolingualTextValue label2 = Datamodel.makeMonolingualTextValue("second label", "en");
TermedStatementEntityEdit edit1 = new TermedStatementEntityEditBuilder(existingSubject).addLabel(label1, false).build();
TermedStatementEntityEdit edit2 = new TermedStatementEntityEditBuilder(existingSubject).addLabel(label2, false).build();
TermedStatementEntityEdit merged = edit1.merge(edit2);
assertEquals(Collections.singleton(label1), merged.getLabelsIfNew());
assertEquals(Collections.emptySet(), merged.getLabels());
}
use of org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue in project OpenRefine by OpenRefine.
the class TermedStatementEntityEditTest method testMergeDescriptionsIfNewOverriding2.
@Test
public void testMergeDescriptionsIfNewOverriding2() {
MonolingualTextValue description1 = Datamodel.makeMonolingualTextValue("first description", "en");
MonolingualTextValue description2 = Datamodel.makeMonolingualTextValue("second description", "en");
TermedStatementEntityEdit update1 = new TermedStatementEntityEditBuilder(existingSubject).addDescription(description1, false).build();
TermedStatementEntityEdit update2 = new TermedStatementEntityEditBuilder(existingSubject).addDescription(description2, true).build();
TermedStatementEntityEdit merged = update1.merge(update2);
assertEquals(Collections.singleton(description2), merged.getDescriptions());
assertEquals(Collections.emptySet(), merged.getDescriptionsIfNew());
}
use of org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue in project OpenRefine by OpenRefine.
the class TermedStatementEntityEditTest method testMergeDescriptionsIfNewOverriding.
@Test
public void testMergeDescriptionsIfNewOverriding() {
MonolingualTextValue description1 = Datamodel.makeMonolingualTextValue("first description", "en");
MonolingualTextValue description2 = Datamodel.makeMonolingualTextValue("second description", "en");
TermedStatementEntityEdit edit1 = new TermedStatementEntityEditBuilder(existingSubject).addDescription(description1, true).build();
TermedStatementEntityEdit edit2 = new TermedStatementEntityEditBuilder(existingSubject).addDescription(description2, false).build();
TermedStatementEntityEdit merged = edit1.merge(edit2);
assertEquals(Collections.singleton(description1), merged.getDescriptions());
assertEquals(Collections.emptySet(), merged.getDescriptionsIfNew());
}
use of org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue in project OpenRefine by OpenRefine.
the class TermedStatementEntityEditTest method testConstructOverridingLabels.
@Test
public void testConstructOverridingLabels() {
MonolingualTextValue label1 = Datamodel.makeMonolingualTextValue("first label", "en");
MonolingualTextValue label2 = Datamodel.makeMonolingualTextValue("second label", "en");
TermedStatementEntityEdit update = new TermedStatementEntityEditBuilder(existingSubject).addLabel(label1, false).addLabel(label2, true).build();
assertEquals(Collections.singleton(label2), update.getLabels());
assertEquals(Collections.emptySet(), update.getLabelsIfNew());
}
use of org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue in project OpenRefine by OpenRefine.
the class TermedStatementEntityEditTest method testMergeLabels.
@Test
public void testMergeLabels() {
MonolingualTextValue label1 = Datamodel.makeMonolingualTextValue("first label", "en");
MonolingualTextValue label2 = Datamodel.makeMonolingualTextValue("second label", "en");
TermedStatementEntityEdit edit1 = new TermedStatementEntityEditBuilder(existingSubject).addLabel(label1, true).build();
TermedStatementEntityEdit edit2 = new TermedStatementEntityEditBuilder(existingSubject).addLabel(label2, true).build();
TermedStatementEntityEdit merged = edit1.merge(edit2);
assertEquals(Collections.singleton(label2), merged.getLabels());
}
Aggregations