Mercurial > code > home > repos > streamed-graph
changeset 40:648bd89f9d47
sloppy fix for type imports
author | drewp@bigasterisk.com |
---|---|
date | Mon, 30 Dec 2019 15:29:23 -0800 |
parents | f551a089a98f |
children | 5eb29ce7a354 |
files | src/graph_view.ts |
diffstat | 1 files changed, 7 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/graph_view.ts Sun Dec 29 19:59:08 2019 -0800 +++ b/src/graph_view.ts Mon Dec 30 15:29:23 2019 -0800 @@ -1,16 +1,18 @@ import { html, TemplateResult } from 'lit-html'; -import { Quad, Term, NamedNode, N3Store } from 'n3'; +import { Quad, Term, N3Store } from 'n3'; import { DataFactory, Util } from 'n3'; const { namedNode } = DataFactory; +import * as RDF from "rdf-js"; +type NamedNode = RDF.NamedNode; import { SuffixLabels } from './suffixLabels'; // import ns from 'n3/src/IRIs'; // const { rdf } = ns; -const rdf = { type: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" }; +const rdf = { type: namedNode("http://www.w3.org/1999/02/22-rdf-syntax-ns#type")}; type TypeToSubjs = Map<NamedNode, Set<NamedNode>>; function groupByRdfType(graph: N3Store): { byType: TypeToSubjs, untyped: Set<NamedNode> } { - const rdfType = namedNode(rdf.type); + const rdfType = rdf.type; const byType: TypeToSubjs = new Map(); const untyped: Set<NamedNode> = new Set(); // subjs const internSubjs = new Map<string, NamedNode>(); @@ -52,7 +54,7 @@ constructor(labels: SuffixLabels) { this.labels = labels; } - getHtml(n: Term): TemplateResult { + getHtml(n: Term|NamedNode): TemplateResult { if (n.termType == "Literal") { let dtPart: any = ""; if (n.datatype) { @@ -184,7 +186,7 @@ }, subj, null, null, null); }); const predsList = Array.from(preds); - predsList.splice(predsList.indexOf(new NamedNode('http://www.w3.org/1999/02/22-rdf-syntax-ns#type')), 1); + predsList.splice(predsList.indexOf(rdf.type), 1); // also pull out label, which should be used on 1st column predsList.sort();