diff --git a/extensions/wikidata/src/org/openrefine/wikidata/qa/scrutinizers/InverseConstraintScrutinizer.java b/extensions/wikidata/src/org/openrefine/wikidata/qa/scrutinizers/InverseConstraintScrutinizer.java index 6a1a7b619..88bc2c3ae 100644 --- a/extensions/wikidata/src/org/openrefine/wikidata/qa/scrutinizers/InverseConstraintScrutinizer.java +++ b/extensions/wikidata/src/org/openrefine/wikidata/qa/scrutinizers/InverseConstraintScrutinizer.java @@ -59,6 +59,9 @@ public class InverseConstraintScrutinizer extends StatementScrutinizer { return _inverse.get(pid); } else { PropertyIdValue inversePid = _fetcher.getInversePid(pid); + if (inversePid == null && _fetcher.isSymmetric(pid)) { + inversePid = pid; + } _inverse.put(pid, inversePid); _statements.put(pid, new HashMap>()); diff --git a/extensions/wikidata/tests/src/org/openrefine/wikidata/qa/scrutinizers/InverseConstaintScrutinizerTest.java b/extensions/wikidata/tests/src/org/openrefine/wikidata/qa/scrutinizers/InverseConstaintScrutinizerTest.java index a44bddbd6..a4313d9f5 100644 --- a/extensions/wikidata/tests/src/org/openrefine/wikidata/qa/scrutinizers/InverseConstaintScrutinizerTest.java +++ b/extensions/wikidata/tests/src/org/openrefine/wikidata/qa/scrutinizers/InverseConstaintScrutinizerTest.java @@ -37,6 +37,7 @@ public class InverseConstaintScrutinizerTest extends StatementScrutinizerTest { private ItemIdValue idB = TestingData.newIdB; private PropertyIdValue pidWithInverse = MockConstraintFetcher.pidWithInverse; private PropertyIdValue inversePid = MockConstraintFetcher.inversePid; + private PropertyIdValue symmetricPid = MockConstraintFetcher.symmetricPid; @Override public EditScrutinizer getScrutinizer() { @@ -50,6 +51,14 @@ public class InverseConstaintScrutinizerTest extends StatementScrutinizerTest { scrutinize(update); assertWarningsRaised(InverseConstraintScrutinizer.type); } + + @Test + public void testSymmetric() { + ItemUpdate update = new ItemUpdateBuilder(idA) + .addStatement(TestingData.generateStatement(idA, symmetricPid, idB)).build(); + scrutinize(update); + assertWarningsRaised(InverseConstraintScrutinizer.type); + } @Test public void testNoSymmetricClosure() {