comparison src/graph_view.ts @ 94:a5f53d397526

view: pick types to show at top-level
author drewp@bigasterisk.com
date Wed, 12 Jan 2022 22:09:20 -0800
parents 955cde1550c3
children 4d19759d0d9a
comparison
equal deleted inserted replaced
93:955cde1550c3 94:a5f53d397526
209 `; 209 `;
210 } 210 }
211 211
212 async makeTemplate(): Promise<TemplateResult> { 212 async makeTemplate(): Promise<TemplateResult> {
213 await this.view.ready; 213 await this.view.ready;
214 const { byType, typedSubjs, untypedSubjs } = groupByRdfType(this.graph); 214 const { byType, typesPresent, untypedSubjs } = groupByRdfType(this.graph);
215 let viewTitle = html` (no view)`; 215 let viewTitle = html` (no view)`;
216 if (this.view.url) { 216 if (this.view.url) {
217 viewTitle = html` using view <a href="${this.view.url}">${this.view.label()}</a>`; 217 viewTitle = html` using view <a href="${this.view.url}">${this.view.label()}</a>`;
218 } 218 }
219 const typesToShow = this.view.typesToShow(typesPresent);
219 return html` 220 return html`
220 <section> 221 <section>
221 <h2> 222 <h2>
222 Current graph (<a href="${this.url}">${this.url}</a>)${viewTitle} 223 Current graph (<a href="${this.url}">${this.url}</a>)${viewTitle}
223 </h2> 224 </h2>
224 <div> 225 <div>
225 <!-- todo: graphs and provenance. 226 <!-- todo: graphs and provenance.
226 These statements are all in the 227 These statements are all in the
227 <span data-bind="html: $root.createCurie(graphUri())">...</span> graph.--> 228 <span data-bind="html: $root.createCurie(graphUri())">...</span> graph.-->
228 </div> 229 </div>
229 ${typedSubjs.map((t: NamedNode) => 230 ${typesToShow.map((t: NamedNode) =>
230 this._multiSubjsTypeBlock(byType, t) 231 this._multiSubjsTypeBlock(byType, t)
231 )} 232 )}
232 <div class="spoGrid"> 233 <div class="spoGrid">
233 ${untypedSubjs.map(this._subjPredObjsBlock.bind(this))} 234 ${untypedSubjs.map(this._subjPredObjsBlock.bind(this))}
234 </div> 235 </div>