# HG changeset patch # User drewp@bigasterisk.com # Date 1644640022 28800 # Node ID 26c55d5d520293b16a72c6870251e1f397138f12 # Parent 4d19759d0d9ae65d06711b72e81e25defd948f6c WIP on views & joins diff -r 4d19759d0d9a -r 26c55d5d5202 demo/public/repos.n3 --- a/demo/public/repos.n3 Thu Jan 13 21:32:18 2022 -0800 +++ b/demo/public/repos.n3 Fri Feb 11 20:27:02 2022 -0800 @@ -5,4 +5,7 @@ <> a :View ; rdfs:label "repos" . <> :table demo:table1 . -demo:table1 :showsType :Repo . +demo:table1 + :primaryType :Repo; + :joinType :HgRepo; + :joinType :GithubRepo . diff -r 4d19759d0d9a -r 26c55d5d5202 src/graph_view.ts --- a/src/graph_view.ts Thu Jan 13 21:32:18 2022 -0800 +++ b/src/graph_view.ts Fri Feb 11 20:27:02 2022 -0800 @@ -1,5 +1,5 @@ import { html, TemplateResult } from "lit"; -import { DataFactory, Literal, NamedNode, Quad, Store, Term, Util } from "n3"; +import { DataFactory, Literal, NamedNode, Quad, Store, Term } from "n3"; import { NodeDisplay } from "./NodeDisplay"; import { SuffixLabels } from "./suffixLabels"; import { @@ -8,7 +8,7 @@ predsForSubj, TypeToSubjs, } from "./tabulate"; -import { View } from "./view_loader"; +import { TableDesc, View } from "./view_loader"; const { namedNode } = DataFactory; @@ -30,12 +30,18 @@ this.graph = graph; const labels = new SuffixLabels(); - this._addLabelsForAllTerms(labels); + this._addLabelsForAllTerms(this.graph, labels); + + if (this.view.graph) { + this._addLabelsForAllTerms(this.view.graph, labels); + } this.nodeDisplay = new NodeDisplay(labels); } - _addLabelsForAllTerms(labels: SuffixLabels) { - return this.graph.forEach( + _addLabelsForAllTerms(graph: Store, labels: SuffixLabels) { + console.log("_addLabelsForAllTerms"); + + graph.forEach( (q: Quad) => { if (q.subject.termType === "NamedNode") { labels.planDisplayForNode(q.subject); @@ -144,11 +150,20 @@ }; } - _multiSubjsTypeBlock(byType: TypeToSubjs, typeUri: NamedNode) { - const layout = new MultiSubjsTypeBlockLayout(this.graph, byType, typeUri); + _multiSubjsTypeBlock(byType: TypeToSubjs, table: TableDesc) { + const layout = new MultiSubjsTypeBlockLayout(this.graph, byType, table); + + let typeNames = [html`${this.nodeDisplay.render(table.primary)}`]; + if (table.joins) { + typeNames.push(html` joined with [`); + for (let j of table.joins) { + typeNames.push(html`${this.nodeDisplay.render(j)}`); + } + typeNames.push(html`]`); + } return html` -