Mercurial > code > home > repos > streamed-graph
diff src/layout/ViewConfig.ts @ 122:2e8fa3fec0c8
support joining subjects into wider rows
author | drewp@bigasterisk.com |
---|---|
date | Sun, 20 Mar 2022 14:12:03 -0700 |
parents | 3cdbbd913f1d |
children | 5a1a79f54779 |
line wrap: on
line diff
--- a/src/layout/ViewConfig.ts Sun Mar 20 14:10:56 2022 -0700 +++ b/src/layout/ViewConfig.ts Sun Mar 20 14:12:03 2022 -0700 @@ -12,10 +12,16 @@ throw new Error("no elems"); } -export interface TableDesc { +export interface Link { + // If you display a subject u1 with a `pred` edge to u2, then treat u2 as an alias of u1. + pred: NamedNode; +} + +interface TableDesc { uri: NamedNode; primary: NamedNode; joins: NamedNode[]; + links: Link[]; } export class ViewConfig { @@ -54,10 +60,19 @@ joins.push(joinType as NamedNode); } joins.sort(); + + const links: Link[] = []; + for (let linkDesc of this.graph.getObjects(table, EX("link"), null)) { + links.push({ + pred: uriValue(this.graph, linkDesc, EX("predicate")), + }); + } + this.tables.push({ uri: table as NamedNode, primary: tableType, joins: joins, + links: links, }); } this.tables.sort();