comparison src/graph_view.ts @ 22:e90d9021c6a0

add back s-g code; this breaks the build a little. WIP
author drewp@bigasterisk.com
date Fri, 13 Dec 2019 01:39:29 -0800
parents 9ec3cbc8791a
children c751380b70c5
comparison
equal deleted inserted replaced
21:f143ebe0acdb 22:e90d9021c6a0
4 const { namedNode } = DataFactory; 4 const { namedNode } = DataFactory;
5 5
6 import { SuffixLabels } from './suffixLabels'; 6 import { SuffixLabels } from './suffixLabels';
7 // import ns from 'n3/src/IRIs'; 7 // import ns from 'n3/src/IRIs';
8 // const { rdf } = ns; 8 // const { rdf } = ns;
9 const rdf = { type: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" };
9 10
10 type TypeToSubjs = Map<NamedNode, Set<NamedNode>>; 11 type TypeToSubjs = Map<NamedNode, Set<NamedNode>>;
11 function groupByRdfType(graph: N3Store): { byType: TypeToSubjs, untyped: Set<NamedNode> } { 12 function groupByRdfType(graph: N3Store): { byType: TypeToSubjs, untyped: Set<NamedNode> } {
12 const rdfType = namedNode('rdf:type'); 13 const rdfType = namedNode(rdf.type);
13 const byType: TypeToSubjs = new Map(); // type : subjs 14 const byType: TypeToSubjs = new Map(); // type : subjs
14 const untyped: Set<NamedNode> = new Set(); // subjs 15 const untyped: Set<NamedNode> = new Set(); // subjs
15 graph.forEach((q) => { 16 graph.forEach((q) => {
16 let subjType: NamedNode | null = null; 17 let subjType: NamedNode | null = null;
17 18