Add support for symmetric constraint
This commit is contained in:
parent
9cb4a46277
commit
3c181c9070
@ -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<EntityIdValue, Set<EntityIdValue>>());
|
||||
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user