Mercurial > code > home > repos > streamed-graph
diff src/graph_view.ts @ 93:955cde1550c3
start the View work: parse view document
author | drewp@bigasterisk.com |
---|---|
date | Wed, 12 Jan 2022 20:26:57 -0800 |
parents | ac7ad087d474 |
children | a5f53d397526 |
line wrap: on
line diff
--- a/src/graph_view.ts Wed Jan 12 16:53:44 2022 -0800 +++ b/src/graph_view.ts Wed Jan 12 20:26:57 2022 -0800 @@ -7,6 +7,7 @@ predsForSubj, TypeToSubjs, } from "./tabulate"; +import { View } from "./view_loader"; const { namedNode } = DataFactory; @@ -72,10 +73,12 @@ export class GraphView { url: string; + view: View; graph: Store; nodeDisplay: NodeDisplay; - constructor(url: string, graph: Store) { + constructor(url: string, viewUrl: string, graph: Store) { this.url = url; + this.view = new View(viewUrl); this.graph = graph; const labels = new SuffixLabels(); @@ -206,12 +209,18 @@ `; } - makeTemplate(): TemplateResult { + async makeTemplate(): Promise<TemplateResult> { + await this.view.ready; const { byType, typedSubjs, untypedSubjs } = groupByRdfType(this.graph); - + let viewTitle = html` (no view)`; + if (this.view.url) { + viewTitle = html` using view <a href="${this.view.url}">${this.view.label()}</a>`; + } return html` <section> - <h2>Current graph (<a href="${this.url}">${this.url}</a>)</h2> + <h2> + Current graph (<a href="${this.url}">${this.url}</a>)${viewTitle} + </h2> <div> <!-- todo: graphs and provenance. These statements are all in the