Mercurial > code > home > repos > streamed-graph
diff src/layout/Layout.ts @ 139:cf642d395be4
new simpler Patch class; fancier 'hide' view config support
author | drewp@bigasterisk.com |
---|---|
date | Mon, 08 May 2023 13:05:20 -0700 |
parents | 5a1a79f54779 |
children |
line wrap: on
line diff
--- a/src/layout/Layout.ts Sat May 06 15:35:11 2023 -0700 +++ b/src/layout/Layout.ts Mon May 08 13:05:20 2023 -0700 @@ -220,10 +220,13 @@ return out; } -function freeStatmentsSection(viewConfig: ViewConfig, stmts: Quad[]): FreeStatements { +function freeStatmentsSection( + viewConfig: ViewConfig, + stmts: Quad[] +): FreeStatements { const subjs: NamedNode[] = []; stmts.forEach((q) => { - if (viewConfig.freeStatementsHidePred.has(q.predicate)) { + if (viewConfig.hidePredFrees.has(q.predicate)) { return; } subjs.push(q.subject as NamedNode); @@ -233,7 +236,10 @@ const preds: NamedNode[] = []; let po = Immutable.Map<NamedNode, Term[]>(); stmts.forEach((q) => { - if (q.subject.equals(subj) && !viewConfig.freeStatementsHidePred.has(q.predicate)) { + if ( + q.subject.equals(subj) && + !viewConfig.hidePredFrees.has(q.predicate) + ) { const p = q.predicate as NamedNode; preds.push(p); po = addToValues(po, p, q.object as NamedNode); @@ -260,6 +266,10 @@ ) { graph.forEach( (q: Quad) => { + if (this.viewConfig.hideGraphEverywhere.has(q.graph)) { + return; + } + const tables = tablesWantingSubject.get(q.subject as NamedNode); if (tables && tables.length) { @@ -301,6 +311,12 @@ const tablesWantingSubject = subjectsToTablesMap(graph, tableBuilders); const ungrouped: Quad[] = []; this.groupAllStatements(graph, tablesWantingSubject, ungrouped); - return { sections: this.generateSections(this.viewConfig, tableBuilders, ungrouped) }; + return { + sections: this.generateSections( + this.viewConfig, + tableBuilders, + ungrouped + ), + }; } }