Skip to content

Commit

Permalink
Update AbstractLogicalRuleTest.java
Browse files Browse the repository at this point in the history
  • Loading branch information
dickensc committed May 17, 2024
1 parent 552a2f5 commit 1851af2
Showing 1 changed file with 18 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import org.junit.Before;
import org.junit.Test;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

Expand Down Expand Up @@ -172,4 +171,22 @@ public void testHash() {
assertEquals(rule1.hashCode(), rule3.hashCode());
assertNotEquals(rule2.hashCode(), rule3.hashCode());
}

@Test
public void testAtomWeightedRule() {
// DoubleClosed(A, B): SingleOpen(A) & SingleClosed(B) -> SingleOpen(B)
AbstractLogicalRule rule = new WeightedLogicalRule(
new Implication(
new Conjunction(
new QueryAtom(singleOpened, new Variable("A")),
new QueryAtom(singleClosed, new Variable("B"))
),
new QueryAtom(singleOpened, new Variable("B"))
),
new Weight(1.0f, new QueryAtom(doubleClosed, new Variable("A"), new Variable("B"))),
true
);

assertEquals("1.0 * DOUBLECLOSED(A, B): ( SINGLEOPENED(A) & SINGLECLOSED(B) ) >> SINGLEOPENED(B) ^2", rule.toString());
}
}

0 comments on commit 1851af2

Please sign in to comment.