diff options
author | 2023-03-07 16:26:26 +0100 | |
---|---|---|
committer | 2023-03-31 15:38:59 +0200 | |
commit | 372058e54825ab58a66c25ae528e81a656c22659 (patch) | |
tree | 3686057057ebcad2faae7233dc691ecacc3e9fe2 /subprojects/store-query/src/test/java | |
parent | refactor: use Cursor in query result sets (diff) | |
download | refinery-372058e54825ab58a66c25ae528e81a656c22659.tar.gz refinery-372058e54825ab58a66c25ae528e81a656c22659.tar.zst refinery-372058e54825ab58a66c25ae528e81a656c22659.zip |
feat: terms and improved query evaluation
* Implement data terms for computations in queries.
* Function-like queries with computed results.
* Improved query evaluation, including positive and negative diagonal
cosntraints.
* Preliminary local search support.
* Changes to the DNF representation for count and aggregation support.
feat: terms wip
feat: query terms wip
feat: query evaluation, diagonal constraints, local search wip
fix reasoning compilation wip
Diffstat (limited to 'subprojects/store-query/src/test/java')
-rw-r--r-- | subprojects/store-query/src/test/java/tools/refinery/store/query/DnfBuilderTest.java | 50 | ||||
-rw-r--r-- | subprojects/store-query/src/test/java/tools/refinery/store/query/DnfToDefinitionStringTest.java (renamed from subprojects/store-query/src/test/java/tools/refinery/store/query/DnfToStringTest.java) | 60 | ||||
-rw-r--r-- | subprojects/store-query/src/test/java/tools/refinery/store/query/tests/StructurallyEqualToTest.java | 22 |
3 files changed, 68 insertions, 64 deletions
diff --git a/subprojects/store-query/src/test/java/tools/refinery/store/query/DnfBuilderTest.java b/subprojects/store-query/src/test/java/tools/refinery/store/query/DnfBuilderTest.java index e6701fe3..ceb46d6f 100644 --- a/subprojects/store-query/src/test/java/tools/refinery/store/query/DnfBuilderTest.java +++ b/subprojects/store-query/src/test/java/tools/refinery/store/query/DnfBuilderTest.java | |||
@@ -1,7 +1,9 @@ | |||
1 | package tools.refinery.store.query; | 1 | package tools.refinery.store.query; |
2 | 2 | ||
3 | import org.junit.jupiter.api.Test; | 3 | import org.junit.jupiter.api.Test; |
4 | import tools.refinery.store.query.dnf.Dnf; | ||
4 | import tools.refinery.store.query.literal.BooleanLiteral; | 5 | import tools.refinery.store.query.literal.BooleanLiteral; |
6 | import tools.refinery.store.query.term.Variable; | ||
5 | import tools.refinery.store.query.view.KeyOnlyRelationView; | 7 | import tools.refinery.store.query.view.KeyOnlyRelationView; |
6 | import tools.refinery.store.representation.Symbol; | 8 | import tools.refinery.store.representation.Symbol; |
7 | 9 | ||
@@ -12,8 +14,8 @@ import static tools.refinery.store.query.tests.QueryMatchers.structurallyEqualTo | |||
12 | class DnfBuilderTest { | 14 | class DnfBuilderTest { |
13 | @Test | 15 | @Test |
14 | void eliminateTrueTest() { | 16 | void eliminateTrueTest() { |
15 | var p = new Variable("p"); | 17 | var p = Variable.of("p"); |
16 | var q = new Variable("q"); | 18 | var q = Variable.of("q"); |
17 | var friend = new Symbol<>("friend", 2, Boolean.class, false); | 19 | var friend = new Symbol<>("friend", 2, Boolean.class, false); |
18 | var friendView = new KeyOnlyRelationView<>(friend); | 20 | var friendView = new KeyOnlyRelationView<>(friend); |
19 | 21 | ||
@@ -28,8 +30,8 @@ class DnfBuilderTest { | |||
28 | 30 | ||
29 | @Test | 31 | @Test |
30 | void eliminateFalseTest() { | 32 | void eliminateFalseTest() { |
31 | var p = new Variable("p"); | 33 | var p = Variable.of("p"); |
32 | var q = new Variable("q"); | 34 | var q = Variable.of("q"); |
33 | var friend = new Symbol<>("friend", 2, Boolean.class, false); | 35 | var friend = new Symbol<>("friend", 2, Boolean.class, false); |
34 | var friendView = new KeyOnlyRelationView<>(friend); | 36 | var friendView = new KeyOnlyRelationView<>(friend); |
35 | 37 | ||
@@ -45,8 +47,8 @@ class DnfBuilderTest { | |||
45 | 47 | ||
46 | @Test | 48 | @Test |
47 | void alwaysTrueTest() { | 49 | void alwaysTrueTest() { |
48 | var p = new Variable("p"); | 50 | var p = Variable.of("p"); |
49 | var q = new Variable("q"); | 51 | var q = Variable.of("q"); |
50 | var friend = new Symbol<>("friend", 2, Boolean.class, false); | 52 | var friend = new Symbol<>("friend", 2, Boolean.class, false); |
51 | var friendView = new KeyOnlyRelationView<>(friend); | 53 | var friendView = new KeyOnlyRelationView<>(friend); |
52 | 54 | ||
@@ -62,8 +64,8 @@ class DnfBuilderTest { | |||
62 | 64 | ||
63 | @Test | 65 | @Test |
64 | void alwaysFalseTest() { | 66 | void alwaysFalseTest() { |
65 | var p = new Variable("p"); | 67 | var p = Variable.of("p"); |
66 | var q = new Variable("q"); | 68 | var q = Variable.of("q"); |
67 | var friend = new Symbol<>("friend", 2, Boolean.class, false); | 69 | var friend = new Symbol<>("friend", 2, Boolean.class, false); |
68 | var friendView = new KeyOnlyRelationView<>(friend); | 70 | var friendView = new KeyOnlyRelationView<>(friend); |
69 | 71 | ||
@@ -78,8 +80,8 @@ class DnfBuilderTest { | |||
78 | 80 | ||
79 | @Test | 81 | @Test |
80 | void eliminateTrueDnfTest() { | 82 | void eliminateTrueDnfTest() { |
81 | var p = new Variable("p"); | 83 | var p = Variable.of("p"); |
82 | var q = new Variable("q"); | 84 | var q = Variable.of("q"); |
83 | var friend = new Symbol<>("friend", 2, Boolean.class, false); | 85 | var friend = new Symbol<>("friend", 2, Boolean.class, false); |
84 | var friendView = new KeyOnlyRelationView<>(friend); | 86 | var friendView = new KeyOnlyRelationView<>(friend); |
85 | var trueDnf = Dnf.builder().parameter(p).clause().build(); | 87 | var trueDnf = Dnf.builder().parameter(p).clause().build(); |
@@ -95,8 +97,8 @@ class DnfBuilderTest { | |||
95 | 97 | ||
96 | @Test | 98 | @Test |
97 | void eliminateFalseDnfTest() { | 99 | void eliminateFalseDnfTest() { |
98 | var p = new Variable("p"); | 100 | var p = Variable.of("p"); |
99 | var q = new Variable("q"); | 101 | var q = Variable.of("q"); |
100 | var friend = new Symbol<>("friend", 2, Boolean.class, false); | 102 | var friend = new Symbol<>("friend", 2, Boolean.class, false); |
101 | var friendView = new KeyOnlyRelationView<>(friend); | 103 | var friendView = new KeyOnlyRelationView<>(friend); |
102 | var falseDnf = Dnf.builder().parameter(p).build(); | 104 | var falseDnf = Dnf.builder().parameter(p).build(); |
@@ -113,8 +115,8 @@ class DnfBuilderTest { | |||
113 | 115 | ||
114 | @Test | 116 | @Test |
115 | void alwaysTrueDnfTest() { | 117 | void alwaysTrueDnfTest() { |
116 | var p = new Variable("p"); | 118 | var p = Variable.of("p"); |
117 | var q = new Variable("q"); | 119 | var q = Variable.of("q"); |
118 | var friend = new Symbol<>("friend", 2, Boolean.class, false); | 120 | var friend = new Symbol<>("friend", 2, Boolean.class, false); |
119 | var friendView = new KeyOnlyRelationView<>(friend); | 121 | var friendView = new KeyOnlyRelationView<>(friend); |
120 | var trueDnf = Dnf.builder().parameter(p).clause().build(); | 122 | var trueDnf = Dnf.builder().parameter(p).clause().build(); |
@@ -131,8 +133,8 @@ class DnfBuilderTest { | |||
131 | 133 | ||
132 | @Test | 134 | @Test |
133 | void alwaysFalseDnfTest() { | 135 | void alwaysFalseDnfTest() { |
134 | var p = new Variable("p"); | 136 | var p = Variable.of("p"); |
135 | var q = new Variable("q"); | 137 | var q = Variable.of("q"); |
136 | var friend = new Symbol<>("friend", 2, Boolean.class, false); | 138 | var friend = new Symbol<>("friend", 2, Boolean.class, false); |
137 | var friendView = new KeyOnlyRelationView<>(friend); | 139 | var friendView = new KeyOnlyRelationView<>(friend); |
138 | var falseDnf = Dnf.builder().parameter(p).build(); | 140 | var falseDnf = Dnf.builder().parameter(p).build(); |
@@ -148,8 +150,8 @@ class DnfBuilderTest { | |||
148 | 150 | ||
149 | @Test | 151 | @Test |
150 | void eliminateNotFalseDnfTest() { | 152 | void eliminateNotFalseDnfTest() { |
151 | var p = new Variable("p"); | 153 | var p = Variable.of("p"); |
152 | var q = new Variable("q"); | 154 | var q = Variable.of("q"); |
153 | var friend = new Symbol<>("friend", 2, Boolean.class, false); | 155 | var friend = new Symbol<>("friend", 2, Boolean.class, false); |
154 | var friendView = new KeyOnlyRelationView<>(friend); | 156 | var friendView = new KeyOnlyRelationView<>(friend); |
155 | var falseDnf = Dnf.builder().parameter(p).build(); | 157 | var falseDnf = Dnf.builder().parameter(p).build(); |
@@ -165,8 +167,8 @@ class DnfBuilderTest { | |||
165 | 167 | ||
166 | @Test | 168 | @Test |
167 | void eliminateNotTrueDnfTest() { | 169 | void eliminateNotTrueDnfTest() { |
168 | var p = new Variable("p"); | 170 | var p = Variable.of("p"); |
169 | var q = new Variable("q"); | 171 | var q = Variable.of("q"); |
170 | var friend = new Symbol<>("friend", 2, Boolean.class, false); | 172 | var friend = new Symbol<>("friend", 2, Boolean.class, false); |
171 | var friendView = new KeyOnlyRelationView<>(friend); | 173 | var friendView = new KeyOnlyRelationView<>(friend); |
172 | var trueDnf = Dnf.builder().parameter(p).clause().build(); | 174 | var trueDnf = Dnf.builder().parameter(p).clause().build(); |
@@ -183,8 +185,8 @@ class DnfBuilderTest { | |||
183 | 185 | ||
184 | @Test | 186 | @Test |
185 | void alwaysNotFalseDnfTest() { | 187 | void alwaysNotFalseDnfTest() { |
186 | var p = new Variable("p"); | 188 | var p = Variable.of("p"); |
187 | var q = new Variable("q"); | 189 | var q = Variable.of("q"); |
188 | var friend = new Symbol<>("friend", 2, Boolean.class, false); | 190 | var friend = new Symbol<>("friend", 2, Boolean.class, false); |
189 | var friendView = new KeyOnlyRelationView<>(friend); | 191 | var friendView = new KeyOnlyRelationView<>(friend); |
190 | var falseDnf = Dnf.builder().parameter(p).build(); | 192 | var falseDnf = Dnf.builder().parameter(p).build(); |
@@ -201,8 +203,8 @@ class DnfBuilderTest { | |||
201 | 203 | ||
202 | @Test | 204 | @Test |
203 | void alwaysNotTrueDnfTest() { | 205 | void alwaysNotTrueDnfTest() { |
204 | var p = new Variable("p"); | 206 | var p = Variable.of("p"); |
205 | var q = new Variable("q"); | 207 | var q = Variable.of("q"); |
206 | var friend = new Symbol<>("friend", 2, Boolean.class, false); | 208 | var friend = new Symbol<>("friend", 2, Boolean.class, false); |
207 | var friendView = new KeyOnlyRelationView<>(friend); | 209 | var friendView = new KeyOnlyRelationView<>(friend); |
208 | var trueDnf = Dnf.builder().parameter(p).clause().build(); | 210 | var trueDnf = Dnf.builder().parameter(p).clause().build(); |
diff --git a/subprojects/store-query/src/test/java/tools/refinery/store/query/DnfToStringTest.java b/subprojects/store-query/src/test/java/tools/refinery/store/query/DnfToDefinitionStringTest.java index e6e4bef3..9b469bb0 100644 --- a/subprojects/store-query/src/test/java/tools/refinery/store/query/DnfToStringTest.java +++ b/subprojects/store-query/src/test/java/tools/refinery/store/query/DnfToDefinitionStringTest.java | |||
@@ -1,6 +1,8 @@ | |||
1 | package tools.refinery.store.query; | 1 | package tools.refinery.store.query; |
2 | 2 | ||
3 | import org.junit.jupiter.api.Test; | 3 | import org.junit.jupiter.api.Test; |
4 | import tools.refinery.store.query.dnf.Dnf; | ||
5 | import tools.refinery.store.query.term.Variable; | ||
4 | import tools.refinery.store.query.view.KeyOnlyRelationView; | 6 | import tools.refinery.store.query.view.KeyOnlyRelationView; |
5 | import tools.refinery.store.representation.Symbol; | 7 | import tools.refinery.store.representation.Symbol; |
6 | 8 | ||
@@ -8,13 +10,13 @@ import static org.hamcrest.MatcherAssert.assertThat; | |||
8 | import static org.hamcrest.Matchers.is; | 10 | import static org.hamcrest.Matchers.is; |
9 | import static tools.refinery.store.query.literal.Literals.not; | 11 | import static tools.refinery.store.query.literal.Literals.not; |
10 | 12 | ||
11 | class DnfToStringTest { | 13 | class DnfToDefinitionStringTest { |
12 | @Test | 14 | @Test |
13 | void noClausesTest() { | 15 | void noClausesTest() { |
14 | var p = new Variable("p"); | 16 | var p = Variable.of("p"); |
15 | var dnf = Dnf.builder("Example").parameter(p).build(); | 17 | var dnf = Dnf.builder("Example").parameter(p).build(); |
16 | 18 | ||
17 | assertThat(dnf.toString(), is(""" | 19 | assertThat(dnf.toDefinitionString(), is(""" |
18 | pred Example(p) <-> | 20 | pred Example(p) <-> |
19 | <no clauses>. | 21 | <no clauses>. |
20 | """)); | 22 | """)); |
@@ -24,7 +26,7 @@ class DnfToStringTest { | |||
24 | void noParametersTest() { | 26 | void noParametersTest() { |
25 | var dnf = Dnf.builder("Example").build(); | 27 | var dnf = Dnf.builder("Example").build(); |
26 | 28 | ||
27 | assertThat(dnf.toString(), is(""" | 29 | assertThat(dnf.toDefinitionString(), is(""" |
28 | pred Example() <-> | 30 | pred Example() <-> |
29 | <no clauses>. | 31 | <no clauses>. |
30 | """)); | 32 | """)); |
@@ -32,10 +34,10 @@ class DnfToStringTest { | |||
32 | 34 | ||
33 | @Test | 35 | @Test |
34 | void emptyClauseTest() { | 36 | void emptyClauseTest() { |
35 | var p = new Variable("p"); | 37 | var p = Variable.of("p"); |
36 | var dnf = Dnf.builder("Example").parameter(p).clause().build(); | 38 | var dnf = Dnf.builder("Example").parameter(p).clause().build(); |
37 | 39 | ||
38 | assertThat(dnf.toString(), is(""" | 40 | assertThat(dnf.toDefinitionString(), is(""" |
39 | pred Example(p) <-> | 41 | pred Example(p) <-> |
40 | <empty>. | 42 | <empty>. |
41 | """)); | 43 | """)); |
@@ -43,13 +45,13 @@ class DnfToStringTest { | |||
43 | 45 | ||
44 | @Test | 46 | @Test |
45 | void relationViewPositiveTest() { | 47 | void relationViewPositiveTest() { |
46 | var p = new Variable("p"); | 48 | var p = Variable.of("p"); |
47 | var q = new Variable("q"); | 49 | var q = Variable.of("q"); |
48 | var friend = new Symbol<>("friend", 2, Boolean.class, false); | 50 | var friend = new Symbol<>("friend", 2, Boolean.class, false); |
49 | var friendView = new KeyOnlyRelationView<>(friend); | 51 | var friendView = new KeyOnlyRelationView<>(friend); |
50 | var dnf = Dnf.builder("Example").parameter(p).clause(friendView.call(p, q)).build(); | 52 | var dnf = Dnf.builder("Example").parameter(p).clause(friendView.call(p, q)).build(); |
51 | 53 | ||
52 | assertThat(dnf.toString(), is(""" | 54 | assertThat(dnf.toDefinitionString(), is(""" |
53 | pred Example(p) <-> | 55 | pred Example(p) <-> |
54 | @RelationView("key") friend(p, q). | 56 | @RelationView("key") friend(p, q). |
55 | """)); | 57 | """)); |
@@ -57,13 +59,13 @@ class DnfToStringTest { | |||
57 | 59 | ||
58 | @Test | 60 | @Test |
59 | void relationViewNegativeTest() { | 61 | void relationViewNegativeTest() { |
60 | var p = new Variable("p"); | 62 | var p = Variable.of("p"); |
61 | var q = new Variable("q"); | 63 | var q = Variable.of("q"); |
62 | var friend = new Symbol<>("friend", 2, Boolean.class, false); | 64 | var friend = new Symbol<>("friend", 2, Boolean.class, false); |
63 | var friendView = new KeyOnlyRelationView<>(friend); | 65 | var friendView = new KeyOnlyRelationView<>(friend); |
64 | var dnf = Dnf.builder("Example").parameter(p).clause(not(friendView.call(p, q))).build(); | 66 | var dnf = Dnf.builder("Example").parameter(p).clause(not(friendView.call(p, q))).build(); |
65 | 67 | ||
66 | assertThat(dnf.toString(), is(""" | 68 | assertThat(dnf.toDefinitionString(), is(""" |
67 | pred Example(p) <-> | 69 | pred Example(p) <-> |
68 | !(@RelationView("key") friend(p, q)). | 70 | !(@RelationView("key") friend(p, q)). |
69 | """)); | 71 | """)); |
@@ -71,13 +73,13 @@ class DnfToStringTest { | |||
71 | 73 | ||
72 | @Test | 74 | @Test |
73 | void relationViewTransitiveTest() { | 75 | void relationViewTransitiveTest() { |
74 | var p = new Variable("p"); | 76 | var p = Variable.of("p"); |
75 | var q = new Variable("q"); | 77 | var q = Variable.of("q"); |
76 | var friend = new Symbol<>("friend", 2, Boolean.class, false); | 78 | var friend = new Symbol<>("friend", 2, Boolean.class, false); |
77 | var friendView = new KeyOnlyRelationView<>(friend); | 79 | var friendView = new KeyOnlyRelationView<>(friend); |
78 | var dnf = Dnf.builder("Example").parameter(p).clause(friendView.callTransitive(p, q)).build(); | 80 | var dnf = Dnf.builder("Example").parameter(p).clause(friendView.callTransitive(p, q)).build(); |
79 | 81 | ||
80 | assertThat(dnf.toString(), is(""" | 82 | assertThat(dnf.toDefinitionString(), is(""" |
81 | pred Example(p) <-> | 83 | pred Example(p) <-> |
82 | @RelationView("key") friend+(p, q). | 84 | @RelationView("key") friend+(p, q). |
83 | """)); | 85 | """)); |
@@ -85,13 +87,13 @@ class DnfToStringTest { | |||
85 | 87 | ||
86 | @Test | 88 | @Test |
87 | void multipleParametersTest() { | 89 | void multipleParametersTest() { |
88 | var p = new Variable("p"); | 90 | var p = Variable.of("p"); |
89 | var q = new Variable("q"); | 91 | var q = Variable.of("q"); |
90 | var friend = new Symbol<>("friend", 2, Boolean.class, false); | 92 | var friend = new Symbol<>("friend", 2, Boolean.class, false); |
91 | var friendView = new KeyOnlyRelationView<>(friend); | 93 | var friendView = new KeyOnlyRelationView<>(friend); |
92 | var dnf = Dnf.builder("Example").parameters(p, q).clause(friendView.call(p, q)).build(); | 94 | var dnf = Dnf.builder("Example").parameters(p, q).clause(friendView.call(p, q)).build(); |
93 | 95 | ||
94 | assertThat(dnf.toString(), is(""" | 96 | assertThat(dnf.toDefinitionString(), is(""" |
95 | pred Example(p, q) <-> | 97 | pred Example(p, q) <-> |
96 | @RelationView("key") friend(p, q). | 98 | @RelationView("key") friend(p, q). |
97 | """)); | 99 | """)); |
@@ -99,8 +101,8 @@ class DnfToStringTest { | |||
99 | 101 | ||
100 | @Test | 102 | @Test |
101 | void multipleLiteralsTest() { | 103 | void multipleLiteralsTest() { |
102 | var p = new Variable("p"); | 104 | var p = Variable.of("p"); |
103 | var q = new Variable("q"); | 105 | var q = Variable.of("q"); |
104 | var person = new Symbol<>("person", 1, Boolean.class, false); | 106 | var person = new Symbol<>("person", 1, Boolean.class, false); |
105 | var personView = new KeyOnlyRelationView<>(person); | 107 | var personView = new KeyOnlyRelationView<>(person); |
106 | var friend = new Symbol<>("friend", 2, Boolean.class, false); | 108 | var friend = new Symbol<>("friend", 2, Boolean.class, false); |
@@ -114,7 +116,7 @@ class DnfToStringTest { | |||
114 | ) | 116 | ) |
115 | .build(); | 117 | .build(); |
116 | 118 | ||
117 | assertThat(dnf.toString(), is(""" | 119 | assertThat(dnf.toDefinitionString(), is(""" |
118 | pred Example(p) <-> | 120 | pred Example(p) <-> |
119 | @RelationView("key") person(p), | 121 | @RelationView("key") person(p), |
120 | @RelationView("key") person(q), | 122 | @RelationView("key") person(q), |
@@ -124,8 +126,8 @@ class DnfToStringTest { | |||
124 | 126 | ||
125 | @Test | 127 | @Test |
126 | void multipleClausesTest() { | 128 | void multipleClausesTest() { |
127 | var p = new Variable("p"); | 129 | var p = Variable.of("p"); |
128 | var q = new Variable("q"); | 130 | var q = Variable.of("q"); |
129 | var friend = new Symbol<>("friend", 2, Boolean.class, false); | 131 | var friend = new Symbol<>("friend", 2, Boolean.class, false); |
130 | var friendView = new KeyOnlyRelationView<>(friend); | 132 | var friendView = new KeyOnlyRelationView<>(friend); |
131 | var dnf = Dnf.builder("Example") | 133 | var dnf = Dnf.builder("Example") |
@@ -134,7 +136,7 @@ class DnfToStringTest { | |||
134 | .clause(friendView.call(q, p)) | 136 | .clause(friendView.call(q, p)) |
135 | .build(); | 137 | .build(); |
136 | 138 | ||
137 | assertThat(dnf.toString(), is(""" | 139 | assertThat(dnf.toDefinitionString(), is(""" |
138 | pred Example(p) <-> | 140 | pred Example(p) <-> |
139 | @RelationView("key") friend(p, q) | 141 | @RelationView("key") friend(p, q) |
140 | ; | 142 | ; |
@@ -144,10 +146,10 @@ class DnfToStringTest { | |||
144 | 146 | ||
145 | @Test | 147 | @Test |
146 | void dnfTest() { | 148 | void dnfTest() { |
147 | var p = new Variable("p"); | 149 | var p = Variable.of("p"); |
148 | var q = new Variable("q"); | 150 | var q = Variable.of("q"); |
149 | var r = new Variable("r"); | 151 | var r = Variable.of("r"); |
150 | var s = new Variable("s"); | 152 | var s = Variable.of("s"); |
151 | var person = new Symbol<>("person", 1, Boolean.class, false); | 153 | var person = new Symbol<>("person", 1, Boolean.class, false); |
152 | var personView = new KeyOnlyRelationView<>(person); | 154 | var personView = new KeyOnlyRelationView<>(person); |
153 | var friend = new Symbol<>("friend", 2, Boolean.class, false); | 155 | var friend = new Symbol<>("friend", 2, Boolean.class, false); |
@@ -162,7 +164,7 @@ class DnfToStringTest { | |||
162 | ) | 164 | ) |
163 | .build(); | 165 | .build(); |
164 | 166 | ||
165 | assertThat(dnf.toString(), is(""" | 167 | assertThat(dnf.toDefinitionString(), is(""" |
166 | pred Example(p) <-> | 168 | pred Example(p) <-> |
167 | @RelationView("key") person(p), | 169 | @RelationView("key") person(p), |
168 | @RelationView("key") person(q), | 170 | @RelationView("key") person(q), |
diff --git a/subprojects/store-query/src/test/java/tools/refinery/store/query/tests/StructurallyEqualToTest.java b/subprojects/store-query/src/test/java/tools/refinery/store/query/tests/StructurallyEqualToTest.java index 0cda22df..a61e2b65 100644 --- a/subprojects/store-query/src/test/java/tools/refinery/store/query/tests/StructurallyEqualToTest.java +++ b/subprojects/store-query/src/test/java/tools/refinery/store/query/tests/StructurallyEqualToTest.java | |||
@@ -1,8 +1,8 @@ | |||
1 | package tools.refinery.store.query.tests; | 1 | package tools.refinery.store.query.tests; |
2 | 2 | ||
3 | import org.junit.jupiter.api.Test; | 3 | import org.junit.jupiter.api.Test; |
4 | import tools.refinery.store.query.Dnf; | 4 | import tools.refinery.store.query.dnf.Dnf; |
5 | import tools.refinery.store.query.Variable; | 5 | import tools.refinery.store.query.term.Variable; |
6 | import tools.refinery.store.query.view.KeyOnlyRelationView; | 6 | import tools.refinery.store.query.view.KeyOnlyRelationView; |
7 | import tools.refinery.store.representation.Symbol; | 7 | import tools.refinery.store.representation.Symbol; |
8 | 8 | ||
@@ -14,8 +14,8 @@ import static tools.refinery.store.query.tests.QueryMatchers.structurallyEqualTo | |||
14 | class StructurallyEqualToTest { | 14 | class StructurallyEqualToTest { |
15 | @Test | 15 | @Test |
16 | void flatEqualsTest() { | 16 | void flatEqualsTest() { |
17 | var p = new Variable("p"); | 17 | var p = Variable.of("p"); |
18 | var q = new Variable("q"); | 18 | var q = Variable.of("q"); |
19 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 19 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
20 | var personView = new KeyOnlyRelationView<>(person); | 20 | var personView = new KeyOnlyRelationView<>(person); |
21 | 21 | ||
@@ -27,8 +27,8 @@ class StructurallyEqualToTest { | |||
27 | 27 | ||
28 | @Test | 28 | @Test |
29 | void flatNotEqualsTest() { | 29 | void flatNotEqualsTest() { |
30 | var p = new Variable("p"); | 30 | var p = Variable.of("p"); |
31 | var q = new Variable("q"); | 31 | var q = Variable.of("q"); |
32 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 32 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
33 | var personView = new KeyOnlyRelationView<>(person); | 33 | var personView = new KeyOnlyRelationView<>(person); |
34 | 34 | ||
@@ -41,8 +41,8 @@ class StructurallyEqualToTest { | |||
41 | 41 | ||
42 | @Test | 42 | @Test |
43 | void deepEqualsTest() { | 43 | void deepEqualsTest() { |
44 | var p = new Variable("p"); | 44 | var p = Variable.of("p"); |
45 | var q = new Variable("q"); | 45 | var q = Variable.of("q"); |
46 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 46 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
47 | var personView = new KeyOnlyRelationView<>(person); | 47 | var personView = new KeyOnlyRelationView<>(person); |
48 | 48 | ||
@@ -58,8 +58,8 @@ class StructurallyEqualToTest { | |||
58 | 58 | ||
59 | @Test | 59 | @Test |
60 | void deepNotEqualsTest() { | 60 | void deepNotEqualsTest() { |
61 | var p = new Variable("p"); | 61 | var p = Variable.of("p"); |
62 | var q = new Variable("q"); | 62 | var q = Variable.of("q"); |
63 | var person = new Symbol<>("Person", 1, Boolean.class, false); | 63 | var person = new Symbol<>("Person", 1, Boolean.class, false); |
64 | var personView = new KeyOnlyRelationView<>(person); | 64 | var personView = new KeyOnlyRelationView<>(person); |
65 | 65 | ||
@@ -72,6 +72,6 @@ class StructurallyEqualToTest { | |||
72 | 72 | ||
73 | var assertion = structurallyEqualTo(expected); | 73 | var assertion = structurallyEqualTo(expected); |
74 | var error = assertThrows(AssertionError.class, () -> assertThat(actual, assertion)); | 74 | var error = assertThrows(AssertionError.class, () -> assertThat(actual, assertion)); |
75 | assertThat(error.getMessage(), containsString(" called from Expected ")); | 75 | assertThat(error.getMessage(), containsString(" called from Expected/1 ")); |
76 | } | 76 | } |
77 | } | 77 | } |