Mercurial > code > home > repos > streamed-graph
comparison src/layout/ViewConfig.test.ts @ 122:2e8fa3fec0c8
support joining subjects into wider rows
author | drewp@bigasterisk.com |
---|---|
date | Sun, 20 Mar 2022 14:12:03 -0700 |
parents | 2468f2227d22 |
children |
comparison
equal
deleted
inserted
replaced
121:3584f24becf4 | 122:2e8fa3fec0c8 |
---|---|
1 import { Util } from "n3"; | 1 import { Util } from "n3"; |
2 import { EX } from "./namespaces"; | |
2 import { ViewConfig } from "./ViewConfig"; | 3 import { ViewConfig } from "./ViewConfig"; |
3 | 4 |
4 describe("ViewModel", () => { | 5 describe("ViewModel", () => { |
5 it("gets a table description", async () => { | 6 it("gets a table description", async () => { |
6 const vc = new ViewConfig(); | 7 const vc = new ViewConfig(); |
11 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | 12 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . |
12 @prefix : <http://bigasterisk.com/netRoutes/ns#> . | 13 @prefix : <http://bigasterisk.com/netRoutes/ns#> . |
13 | 14 |
14 <> a ex:View ; rdfs:label "repos" . | 15 <> a ex:View ; rdfs:label "repos" . |
15 <> ex:table demo:table1 . | 16 <> ex:table demo:table1 . |
16 demo:table1 | 17 demo:table1 |
17 ex:primaryType :FilteredNic; | 18 ex:primaryType :FilteredNic; |
18 ex:joinType :Traffic . | 19 ex:joinType :Traffic . |
19 `); | 20 `); |
20 const NET = Util.prefix("http://bigasterisk.com/netRoutes/ns#"); | 21 const NET = Util.prefix("http://bigasterisk.com/netRoutes/ns#"); |
21 | 22 |
22 expect(vc.tables[0].primary).toEqual(NET("FilteredNic")); | 23 expect(vc.tables[0].primary).toEqual(NET("FilteredNic")); |
23 expect(vc.tables[0].joins).toEqual([NET("Traffic")]); | 24 expect(vc.tables[0].joins).toEqual([NET("Traffic")]); |
24 }); | 25 }); |
26 it("gets pred joins", async () => { | |
27 const vc = new ViewConfig(); | |
28 await vc.readFromGraph(` | |
29 @prefix ex: <http://example.com/> . | |
30 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | |
31 @prefix : <http://example.com/> . | |
32 | |
33 <> a :View; :table [ | |
34 :primaryType :T1; | |
35 :link [:predicate :predLink; :rtype :T2 ] ] . | |
36 `); | |
37 expect(vc.tables[0].primary).toEqual(EX("T1")); | |
38 expect(vc.tables[0].links).toEqual([{ pred: EX("predLink") }]); | |
39 }); | |
25 }); | 40 }); |