comparison src/render/GraphView.ts @ 113:4822d5621463

cleanup
author drewp@bigasterisk.com
date Sat, 19 Mar 2022 15:45:03 -0700
parents 3cdbbd913f1d
children c2923b20bf5c
comparison
equal deleted inserted replaced
112:f46b9dfa9b9c 113:4822d5621463
81 return this._renderFreeStatements(section as FreeStatements); 81 return this._renderFreeStatements(section as FreeStatements);
82 } 82 }
83 } 83 }
84 84
85 _renderAlignedTable(section: AlignedTable): TemplateResult { 85 _renderAlignedTable(section: AlignedTable): TemplateResult {
86 let anyType: NamedNode = new NamedNode('');
86 const heads = section.columnHeaders.map((ch) => { 87 const heads = section.columnHeaders.map((ch) => {
88 anyType = ch.rdfType;
87 return html`<th>${this.nodeDisplay.render(ch.pred)}</th>`; 89 return html`<th>${this.nodeDisplay.render(ch.pred)}</th>`;
88 }); 90 });
89 const cells = []; 91 const cells = [];
90 92
91 for (let rowIndex in section.rows) { 93 for (let rowIndex in section.rows) {
98 bodyCols.push(html`<td>${display}</td>`); 100 bodyCols.push(html`<td>${display}</td>`);
99 } 101 }
100 cells.push(html`<tr>${headerCol}${bodyCols}</tr>`); 102 cells.push(html`<tr>${headerCol}${bodyCols}</tr>`);
101 } 103 }
102 return html` 104 return html`
103 <pre> {JSON.stringify(section.rows,null,' ')}</pre> 105 <div>[icon] Resources of type ${this.nodeDisplay.render(anyType)}</div>
104 <div class="typeBlockScroll"> 106 <div class="typeBlockScroll">
105 <table class="typeBlock"> 107 <table class="typeBlock">
106 <thead> 108 <thead>
107 <th>Subject</th> 109 <th>Subject</th>
108 ${heads} 110 ${heads}
109 </thead> 111 </thead>
110 <tbody> 112 <tbody>
111 ${cells} 113 ${cells}
112 </tbody> 114 </tbody>
113 </table> 115 </table>
114 </div> 116 </div>
115 `; 117 `;
116 } 118 }
117 119
118 _renderFreeStatements(section: FreeStatements): TemplateResult { 120 _renderFreeStatements(section: FreeStatements): TemplateResult {
159 161
160 _drawColumnHead(pred: NamedNode): TemplateResult { 162 _drawColumnHead(pred: NamedNode): TemplateResult {
161 return html` <th>${this.nodeDisplay.render(pred)}</th> `; 163 return html` <th>${this.nodeDisplay.render(pred)}</th> `;
162 } 164 }
163 165
164 // _thead(layout: MultiSubjsTypeBlockLayout): TemplateResult {
165 // return html`
166 // <thead>
167 // <tr>
168 // <th></th>
169 // ${layout.preds.map(this._drawColumnHead.bind(this))}
170 // </tr>
171 // </thead>
172 // `;
173 // }
174
175 // _msbCell(layout: MultiSubjsTypeBlockLayout, subj: NamedNode) {
176 // return (pred: NamedNode): TemplateResult => {
177 // const objs = layout.graphCells.get(layout.makeCellKey(subj, pred));
178 // if (!objs || !objs.size) {
179 // return html` <td></td> `;
180 // }
181 // const objsList = Array.from(objs);
182 // objsList.sort();
183 // return html` <td>${objsList.map(this._drawObj.bind(this))}</td> `;
184 // };
185 // }
186
187 // _instanceRow(layout: MultiSubjsTypeBlockLayout) {
188 // return (subj: NamedNode): TemplateResult => {
189 // return html`
190 // <tr>
191 // <td>${this.nodeDisplay.render(subj)}</td>
192 // ${layout.preds.map(this._msbCell(layout, subj))}
193 // </tr>
194 // `;
195 // };
196 // }
197
198 // _multiSubjsTypeBlock(byType: TypeToSubjs, table: TableDesc) {
199 // const layout = new MultiSubjsTypeBlockLayout(this.graph, byType, table);
200
201 // let typeNames = [html`${this.nodeDisplay.render(table.primary)}`];
202 // if (table.joins) {
203 // typeNames.push(html` joined with [`);
204 // for (let j of table.joins) {
205 // typeNames.push(html`${this.nodeDisplay.render(j)}`);
206 // }
207 // typeNames.push(html`]`);
208 // }
209 166
210 // return html` 167 // return html`
211 // <div>[icon] Resources of type ${typeNames}</div> 168 // <div>[icon] Resources of type ${typeNames}</div>
212 // <div class="typeBlockScroll"> 169 // <div class="typeBlockScroll">
213 // <table class="typeBlock"> 170 // <table class="typeBlock">