Mercurial > code > home > repos > streamed-graph
comparison src/layout/Layout.test.ts @ 119:8715633f5213
fancier column sorting to bring preds from the same type together
author | drewp@bigasterisk.com |
---|---|
date | Sun, 20 Mar 2022 01:17:35 -0700 |
parents | c2923b20bf5c |
children | 3584f24becf4 |
comparison
equal
deleted
inserted
replaced
118:c2923b20bf5c | 119:8715633f5213 |
---|---|
153 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | 153 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . |
154 @prefix : <http://example.com/> . | 154 @prefix : <http://example.com/> . |
155 | 155 |
156 <> a :View; :table [ :primaryType :T1; :joinType :T2 ] . | 156 <> a :View; :table [ :primaryType :T1; :joinType :T2 ] . |
157 `); | 157 `); |
158 vc.graph.forEach((q) => console.log("vc", q), null, null, null, null); | |
159 const layout = new Layout(vc); | 158 const layout = new Layout(vc); |
160 const lr = layout.plan( | 159 const lr = layout.plan( |
161 await n3Graph(` | 160 await n3Graph(` |
162 @prefix : <http://example.com/> . | 161 @prefix : <http://example.com/> . |
163 :g1 { | 162 :g1 { |
176 expect(section0.rows).toEqual([ | 175 expect(section0.rows).toEqual([ |
177 [[EX("red")], []], | 176 [[EX("red")], []], |
178 [[], [EX("big")]], | 177 [[], [EX("big")]], |
179 ]); | 178 ]); |
180 }); | 179 }); |
180 it("groups columns by type", async()=>{ | |
181 const vc = new ViewConfig(); | |
182 await vc.readFromGraph(` | |
183 @prefix ex: <http://example.com/> . | |
184 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | |
185 @prefix : <http://example.com/> . | |
186 | |
187 <> a :View; :table [ :primaryType :T1; :joinType :T2, :T3 ] . | |
188 `); | |
189 const layout = new Layout(vc); | |
190 const lr = layout.plan( | |
191 await n3Graph(` | |
192 @prefix : <http://example.com/> . | |
193 :g1 { | |
194 :a a :T1; :p1 :red; :p3 :green . | |
195 :b a :T2; :p2 :blue . | |
196 } | |
197 `) | |
198 ); | |
199 const section0 = lr.sections[0] as AlignedTable; | |
200 expect(section0.columnHeaders).toEqual([ | |
201 { rdfTypes: [EX("T1")], pred: EX("p1") }, | |
202 { rdfTypes: [EX("T1")], pred: EX("p3") }, | |
203 { rdfTypes: [EX("T2")], pred: EX("p2") }, | |
204 ]); | |
205 }) | |
181 }); | 206 }); |
182 it.skip("makes a table out of ungrouped triples with the same type", async () => {}); | 207 it.skip("makes a table out of ungrouped triples with the same type", async () => {}); |
183 }); | 208 }); |