Mercurial > code > home > repos > streamed-graph
comparison src/layout/Layout.ts @ 117:069c1f70afa5
cleanup
author | drewp@bigasterisk.com |
---|---|
date | Sat, 19 Mar 2022 17:45:01 -0700 |
parents | dd3325cc023e |
children | c2923b20bf5c |
comparison
equal
deleted
inserted
replaced
116:dd3325cc023e | 117:069c1f70afa5 |
---|---|
5 import { rdf, rdfs } from "./namespaces"; | 5 import { rdf, rdfs } from "./namespaces"; |
6 import { uniqueSortedTerms, UriPairMap } from "./rdf_value"; | 6 import { uniqueSortedTerms, UriPairMap } from "./rdf_value"; |
7 import { ViewConfig } from "./ViewConfig"; | 7 import { ViewConfig } from "./ViewConfig"; |
8 | 8 |
9 type UriSet = Immutable.Set<NamedNode>; | 9 type UriSet = Immutable.Set<NamedNode>; |
10 export type TypeToSubjs = Immutable.Map<NamedNode, UriSet>; | |
11 | 10 |
12 interface ColumnHeader { | 11 interface ColumnHeader { |
13 rdfType: NamedNode; | 12 rdfType: NamedNode; |
14 pred: NamedNode; | 13 pred: NamedNode; |
15 } | 14 } |
37 export interface LayoutResult { | 36 export interface LayoutResult { |
38 sections: (AlignedTable | FreeStatements)[]; | 37 sections: (AlignedTable | FreeStatements)[]; |
39 } | 38 } |
40 | 39 |
41 class AlignedTableBuilder { | 40 class AlignedTableBuilder { |
42 subjSet = Immutable.Set<NamedNode>(); | 41 subjSet: UriSet = Immutable.Set(); |
43 predSet = Immutable.Set<NamedNode>(); | 42 predSet: UriSet = Immutable.Set(); |
44 cell = new UriPairMap(); | 43 cell = new UriPairMap(); |
45 constructor( | 44 constructor( |
46 public rdfType: NamedNode /* plus join types, sort instructions */ | 45 public rdfType: NamedNode /* plus join types, sort instructions */ |
47 ) {} | 46 ) {} |
48 | 47 |
155 } | 154 } |
156 | 155 |
157 // The description of how this page should look: sections, tables, etc. | 156 // The description of how this page should look: sections, tables, etc. |
158 export class Layout { | 157 export class Layout { |
159 constructor(public viewConfig?: ViewConfig) {} | 158 constructor(public viewConfig?: ViewConfig) {} |
159 | |
160 _groupAllStatements( | 160 _groupAllStatements( |
161 graph: Store, | 161 graph: Store, |
162 tablesWantingSubject: SubjectTableBuilders, | 162 tablesWantingSubject: SubjectTableBuilders, |
163 ungrouped: Quad[] | 163 ungrouped: Quad[] |
164 ) { | 164 ) { |
175 null, | 175 null, |
176 null, | 176 null, |
177 null | 177 null |
178 ); | 178 ); |
179 } | 179 } |
180 | |
180 plan(graph: Store): LayoutResult { | 181 plan(graph: Store): LayoutResult { |
181 const ungrouped: Quad[] = []; | 182 const ungrouped: Quad[] = []; |
182 | 183 |
183 const tableBuilders = this.viewConfig | 184 const tableBuilders = this.viewConfig |
184 ? this.viewConfig.tables.map((t) => new AlignedTableBuilder(t.primary)) | 185 ? this.viewConfig.tables.map((t) => new AlignedTableBuilder(t.primary)) |