diff --git a/extensions/wikidata/module/langs/translation-en.json b/extensions/wikidata/module/langs/translation-en.json
index b7be57aca..70c396c90 100644
--- a/extensions/wikidata/module/langs/translation-en.json
+++ b/extensions/wikidata/module/langs/translation-en.json
@@ -193,6 +193,10 @@
"non-printable-characters": {
"title": "Non-printable characters in strings.",
"body": "Strings such as {example_string} contain non-printable characters."
+ },
+ "invalid-identifier-space": {
+ "title": "Invalid identifier space for reconciled cells.",
+ "body": "Some reconciled cells such as {example_cell} were ignored because they are not reconciled to Wikidata."
}
}
}
diff --git a/extensions/wikidata/src/org/openrefine/wikidata/schema/WbItemVariable.java b/extensions/wikidata/src/org/openrefine/wikidata/schema/WbItemVariable.java
index 599f0e551..00c634580 100644
--- a/extensions/wikidata/src/org/openrefine/wikidata/schema/WbItemVariable.java
+++ b/extensions/wikidata/src/org/openrefine/wikidata/schema/WbItemVariable.java
@@ -23,8 +23,10 @@
******************************************************************************/
package org.openrefine.wikidata.schema;
+import org.openrefine.wikidata.qa.QAWarning;
import org.openrefine.wikidata.schema.entityvalues.ReconItemIdValue;
import org.openrefine.wikidata.schema.exceptions.SkipSchemaExpressionException;
+import org.wikidata.wdtk.datamodel.helpers.Datamodel;
import org.wikidata.wdtk.datamodel.interfaces.ItemIdValue;
import com.fasterxml.jackson.annotation.JsonCreator;
@@ -61,6 +63,12 @@ public class WbItemVariable extends WbVariableExpr {
throws SkipSchemaExpressionException {
if (cell.recon != null
&& (Judgment.Matched.equals(cell.recon.judgment) || Judgment.New.equals(cell.recon.judgment))) {
+ if (!cell.recon.identifierSpace.equals(Datamodel.SITE_WIKIDATA)) {
+ QAWarning warning = new QAWarning("invalid-identifier-space", null, QAWarning.Severity.INFO, 1);
+ warning.setProperty("example_cell", cell.value.toString());
+ ctxt.addWarning(warning);
+ throw new SkipSchemaExpressionException();
+ }
return new ReconItemIdValue(cell.recon, cell.value.toString());
}
throw new SkipSchemaExpressionException();
diff --git a/extensions/wikidata/tests/src/org/openrefine/wikidata/schema/WbItemVariableTest.java b/extensions/wikidata/tests/src/org/openrefine/wikidata/schema/WbItemVariableTest.java
index de19a8aff..8533ea0c9 100644
--- a/extensions/wikidata/tests/src/org/openrefine/wikidata/schema/WbItemVariableTest.java
+++ b/extensions/wikidata/tests/src/org/openrefine/wikidata/schema/WbItemVariableTest.java
@@ -67,6 +67,16 @@ public class WbItemVariableTest extends WbVariableTest {
Cell cell = new Cell("some value", recon);
isSkipped(cell);
}
+
+ @Test
+ public void testInvalidSpace() {
+ Recon recon = Recon.makeWikidataRecon(34989L);
+ recon.identifierSpace = "http://my.own.wikiba.se/";
+ recon.candidates = Collections.singletonList(new ReconCandidate("Q123", "some item", null, 100.0));
+ recon.judgment = Recon.Judgment.Matched;
+ Cell cell = new Cell("some value", recon);
+ isSkipped(cell);
+ }
@Test
public void testUnreconciledCell() {