changeset 121:3584f24becf4

cleanup
author drewp@bigasterisk.com
date Sun, 20 Mar 2022 14:10:56 -0700
parents a7519d92dbc6
children 2e8fa3fec0c8
files src/layout/Layout.test.ts src/layout/Layout.ts
diffstat 2 files changed, 5 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/layout/Layout.test.ts	Sun Mar 20 13:33:51 2022 -0700
+++ b/src/layout/Layout.test.ts	Sun Mar 20 14:10:56 2022 -0700
@@ -34,10 +34,10 @@
   it("accepts a ViewConfig", async () => {
     const vc = new ViewConfig();
     await vc.readFromGraph(`
-      @prefix ex: <http://example.com/> .
+      @prefix : <http://example.com/> .
       @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
 
-      <> a ex:View; rdfs:label "repos" .`);
+      <> a :View; rdfs:label "repos" .`);
     const layout = new Layout(vc);
     const lr = layout.plan(await twoStatements());
   });
@@ -74,7 +74,6 @@
       const vc = new ViewConfig();
       await vc.readFromGraph(`
         @prefix : <http://example.com/> .
-        @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
   
         <> a :View; :table [ :primaryType :T1 ] .`);
       const layout = new Layout(vc);
@@ -115,8 +114,6 @@
   it("makes two tables", async () => {
     const vc = new ViewConfig();
     await vc.readFromGraph(`
-      @prefix ex: <http://example.com/> .
-      @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
       @prefix : <http://example.com/> .
 
       <> a :View; :table [ :primaryType :T1 ], [ :primaryType :T2 ] .`);
@@ -146,7 +143,7 @@
     ]);
   });
   describe("joins multiple types into one table", () => {
-    it("can simply merge types", async () => {
+    it("can simply display multiple types merged together", async () => {
       const vc = new ViewConfig();
       await vc.readFromGraph(`
         @prefix ex: <http://example.com/> .
@@ -177,7 +174,7 @@
         [[], [EX("big")]],
       ]);
     });
-    it("groups columns by type", async()=>{
+    it("groups columns by type", async () => {
       const vc = new ViewConfig();
       await vc.readFromGraph(`
         @prefix ex: <http://example.com/> .
--- a/src/layout/Layout.ts	Sun Mar 20 13:33:51 2022 -0700
+++ b/src/layout/Layout.ts	Sun Mar 20 14:10:56 2022 -0700
@@ -234,8 +234,7 @@
         if (q.subject.equals(subj)) {
           const p = q.predicate as NamedNode;
           preds.push(p);
-          po = po.set(p, po.get(p, []));
-          po.get(p)?.push(q.object as Term);
+          po = addToValues(po, p, q.object as NamedNode);
         }
       });