changeset 109:cbcd82d21356

cleanup
author drewp@bigasterisk.com
date Fri, 18 Mar 2022 12:00:33 -0700
parents 5e6840229a05
children 3cdbbd913f1d
files src/layout/Layout.test.ts src/layout/rdf_value.ts src/render/GraphView.ts src/render/StreamedGraph.ts
diffstat 4 files changed, 26 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/src/layout/Layout.test.ts	Fri Mar 18 11:57:38 2022 -0700
+++ b/src/layout/Layout.test.ts	Fri Mar 18 12:00:33 2022 -0700
@@ -48,8 +48,14 @@
       sections: [
         {
           subjRows: [
-            { subj: EX("a0"), predRows: [{ pred: EX("b0"), objs: [EX("c0")] }] },
-            { subj: EX("d0"), predRows: [{ pred: EX("e0"), objs: [EX("f0")] }] },
+            {
+              subj: EX("a0"),
+              predRows: [{ pred: EX("b0"), objs: [EX("c0")] }],
+            },
+            {
+              subj: EX("d0"),
+              predRows: [{ pred: EX("e0"), objs: [EX("f0")] }],
+            },
           ],
         },
       ],
--- a/src/layout/rdf_value.ts	Fri Mar 18 11:57:38 2022 -0700
+++ b/src/layout/rdf_value.ts	Fri Mar 18 12:00:33 2022 -0700
@@ -1,4 +1,4 @@
-import { Store, Term, NamedNode } from "n3";
+import { NamedNode, Store, Term } from "n3";
 import { RDFS } from "./namespaces";
 
 function _singleValue(g: Store, s: Term, p: Term): Term {
@@ -45,7 +45,9 @@
   return ret;
 }
 
-export function uniqueSortedTerms<T extends NamedNode | Term>(terms: Iterable<T>): T[] {
+export function uniqueSortedTerms<T extends NamedNode | Term>(
+  terms: Iterable<T>
+): T[] {
   const uniques: T[] = [];
   const seen = new Set();
   for (let o of terms) {
@@ -54,6 +56,8 @@
       uniques.push(o);
     }
   }
-  uniques.sort((a,b)=>{return a.id.localeCompare(b.id)});
+  uniques.sort((a, b) => {
+    return a.id.localeCompare(b.id);
+  });
   return uniques;
 }
--- a/src/render/GraphView.ts	Fri Mar 18 11:57:38 2022 -0700
+++ b/src/render/GraphView.ts	Fri Mar 18 12:00:33 2022 -0700
@@ -1,23 +1,13 @@
 import Immutable from "immutable";
 import { html, TemplateResult } from "lit";
-import { DataFactory, Literal, NamedNode, Quad, Store, Term } from "n3";
-import { NodeDisplay } from "./NodeDisplay";
-import { SuffixLabels } from "../layout/suffixLabels";
+import { NamedNode, Quad, Store, Term } from "n3";
 import { AlignedTable, FreeStatements, Layout, PredRow, SubjRow } from "../layout/Layout";
-import { TableDesc, ViewConfig } from "../layout/ViewConfig";
-import { uniqueSortedTerms } from "../layout/rdf_value";
-
-const { namedNode } = DataFactory;
+import { SuffixLabels } from "../layout/suffixLabels";
+import { ViewConfig } from "../layout/ViewConfig";
+import { NodeDisplay } from "./NodeDisplay";
 
 type UriSet = Immutable.Set<NamedNode>;
-const emptyUriSet = Immutable.Set<NamedNode>();
-// https://github.com/rdfjs/N3.js/issues/265
-if ((Literal.prototype as any).hashCode === undefined) {
-  (Literal.prototype as any).hashCode = () => 0;
-}
-if ((NamedNode.prototype as any).hashCode === undefined) {
-  (NamedNode.prototype as any).hashCode = () => 0;
-}
+
 export class GraphView {
   nodeDisplay!: NodeDisplay;
   constructor(
--- a/src/render/StreamedGraph.ts	Fri Mar 18 11:57:38 2022 -0700
+++ b/src/render/StreamedGraph.ts	Fri Mar 18 12:00:33 2022 -0700
@@ -1,14 +1,10 @@
-import { LitElement, html, render, TemplateResult } from "lit";
+import { html, LitElement, render, TemplateResult } from "lit";
 import { customElement, property } from "lit/decorators.js";
-
 import { Store } from "n3";
-
+import { StreamedGraphClient } from "../layout/StreamedGraphClient";
+import { ViewConfig } from "../layout/ViewConfig";
 import { GraphView } from "./GraphView";
-import { StreamedGraphClient } from "../layout/StreamedGraphClient";
-import { style, addFontToRootPage } from "./style";
-import { ViewConfig } from "../layout/ViewConfig";
-
-// export * from "./graph_queries";
+import { addFontToRootPage, style } from "./style";
 
 export interface VersionedGraph {
   version: number;
@@ -72,7 +68,7 @@
 
   redrawGraph() {
     this.graphViewDirty = true;
-    const rl: ()=>Promise<void> = this._redrawLater.bind(this)
+    const rl: () => Promise<void> = this._redrawLater.bind(this);
     requestAnimationFrame(rl);
   }
 
@@ -108,8 +104,7 @@
     if (!this.graphViewDirty) return;
 
     if ((this.graph as VersionedGraph).store && this.graph.store) {
-
-      const vc = new ViewConfig()
+      const vc = new ViewConfig();
 
       await this._graphAreaShowGraph(
         new GraphView([this.url], this.graph.store, vc)