Search in sources :

Example 81 with TermedStatementEntityEditBuilder

use of org.openrefine.wikidata.updates.TermedStatementEntityEditBuilder in project OpenRefine by OpenRefine.

the class QuickStatementsExporterTest method testNameDesc.

@Test
public void testNameDesc() throws IOException {
    /**
     * Adding labels and description without overriding is not supported by QS, so we fall back on adding them with
     * overriding.
     */
    TermedStatementEntityEdit update = new TermedStatementEntityEditBuilder(qid1).addLabel(Datamodel.makeMonolingualTextValue("some label", "en"), true).addDescription(Datamodel.makeMonolingualTextValue("some description", "en"), true).build();
    assertEquals("Q1377\tLen\t\"some label\"\n" + "Q1377\tDen\t\"some description\"\n", export(update));
}
Also used : TermedStatementEntityEditBuilder(org.openrefine.wikidata.updates.TermedStatementEntityEditBuilder) TermedStatementEntityEdit(org.openrefine.wikidata.updates.TermedStatementEntityEdit) Test(org.testng.annotations.Test) WikidataRefineTest(org.openrefine.wikidata.testing.WikidataRefineTest)

Example 82 with TermedStatementEntityEditBuilder

use of org.openrefine.wikidata.updates.TermedStatementEntityEditBuilder in project OpenRefine by OpenRefine.

the class QuickStatementsExporterTest method testOptionalNameDesc.

@Test
public void testOptionalNameDesc() throws IOException {
    TermedStatementEntityEdit update = new TermedStatementEntityEditBuilder(newIdA).addLabel(Datamodel.makeMonolingualTextValue("my new item", "en"), false).addDescription(Datamodel.makeMonolingualTextValue("isn't it awesome?", "en"), false).addAlias(Datamodel.makeMonolingualTextValue("fabitem", "en")).build();
    assertEquals("CREATE\n" + "LAST\tLen\t\"my new item\"\n" + "LAST\tDen\t\"isn't it awesome?\"\n" + "LAST\tAen\t\"fabitem\"\n", export(update));
}
Also used : TermedStatementEntityEditBuilder(org.openrefine.wikidata.updates.TermedStatementEntityEditBuilder) TermedStatementEntityEdit(org.openrefine.wikidata.updates.TermedStatementEntityEdit) Test(org.testng.annotations.Test) WikidataRefineTest(org.openrefine.wikidata.testing.WikidataRefineTest)

Example 83 with TermedStatementEntityEditBuilder

use of org.openrefine.wikidata.updates.TermedStatementEntityEditBuilder in project OpenRefine by OpenRefine.

the class CommonDescriptionScrutinizerTest method testIdenticalWithLabel1.

@Test
public void testIdenticalWithLabel1() {
    String description = "identical with label";
    TermedStatementEntityEdit update = new TermedStatementEntityEditBuilder(TestingData.newIdA).addDescription(Datamodel.makeMonolingualTextValue(description, "en"), true).addLabel(Datamodel.makeMonolingualTextValue("bonjour", "fr"), true).build();
    scrutinize(update);
    assertNoWarningRaised();
}
Also used : TermedStatementEntityEditBuilder(org.openrefine.wikidata.updates.TermedStatementEntityEditBuilder) TermedStatementEntityEdit(org.openrefine.wikidata.updates.TermedStatementEntityEdit) Test(org.testng.annotations.Test)

Example 84 with TermedStatementEntityEditBuilder

use of org.openrefine.wikidata.updates.TermedStatementEntityEditBuilder in project OpenRefine by OpenRefine.

the class CommonDescriptionScrutinizerTest method testGoodDesc.

@Test
public void testGoodDesc() {
    String description = "good description";
    TermedStatementEntityEdit update = new TermedStatementEntityEditBuilder(TestingData.newIdA).addDescription(Datamodel.makeMonolingualTextValue(description, "en"), true).build();
    scrutinize(update);
    assertNoWarningRaised();
}
Also used : TermedStatementEntityEditBuilder(org.openrefine.wikidata.updates.TermedStatementEntityEditBuilder) TermedStatementEntityEdit(org.openrefine.wikidata.updates.TermedStatementEntityEdit) Test(org.testng.annotations.Test)

Example 85 with TermedStatementEntityEditBuilder

use of org.openrefine.wikidata.updates.TermedStatementEntityEditBuilder in project OpenRefine by OpenRefine.

the class CommonDescriptionScrutinizerTest method testIdenticalWithLabel.

@Test
public void testIdenticalWithLabel() {
    String description = "identical with label";
    TermedStatementEntityEdit update = new TermedStatementEntityEditBuilder(TestingData.newIdA).addDescription(Datamodel.makeMonolingualTextValue(description, "en"), true).addLabel(Datamodel.makeMonolingualTextValue(description, "en"), true).build();
    scrutinize(update);
    assertWarningsRaised(CommonDescriptionScrutinizer.descIdenticalWithLabel);
}
Also used : TermedStatementEntityEditBuilder(org.openrefine.wikidata.updates.TermedStatementEntityEditBuilder) TermedStatementEntityEdit(org.openrefine.wikidata.updates.TermedStatementEntityEdit) Test(org.testng.annotations.Test)

Aggregations

TermedStatementEntityEditBuilder (org.openrefine.wikidata.updates.TermedStatementEntityEditBuilder)107 TermedStatementEntityEdit (org.openrefine.wikidata.updates.TermedStatementEntityEdit)102 Test (org.testng.annotations.Test)101 ItemIdValue (org.wikidata.wdtk.datamodel.interfaces.ItemIdValue)57 Statement (org.wikidata.wdtk.datamodel.interfaces.Statement)56 ConstraintFetcher (org.openrefine.wikidata.qa.ConstraintFetcher)52 Snak (org.wikidata.wdtk.datamodel.interfaces.Snak)49 StatementImpl (org.wikidata.wdtk.datamodel.implementation.StatementImpl)44 SnakGroup (org.wikidata.wdtk.datamodel.interfaces.SnakGroup)34 ValueSnak (org.wikidata.wdtk.datamodel.interfaces.ValueSnak)18 WikidataRefineTest (org.openrefine.wikidata.testing.WikidataRefineTest)13 ArrayList (java.util.ArrayList)11 StatementEdit (org.openrefine.wikidata.updates.StatementEdit)9 JacksonSerializationTest (org.openrefine.wikidata.testing.JacksonSerializationTest)7 NoValueSnak (org.wikidata.wdtk.datamodel.interfaces.NoValueSnak)5 ReconEntityIdValue (org.openrefine.wikidata.schema.entityvalues.ReconEntityIdValue)4 Claim (org.wikidata.wdtk.datamodel.interfaces.Claim)4 EntityIdValue (org.wikidata.wdtk.datamodel.interfaces.EntityIdValue)4 ItemDocument (org.wikidata.wdtk.datamodel.interfaces.ItemDocument)3 Engine (com.google.refine.browsing.Engine)2