changeset 69:72ad92ebda7a

don't need forObjects typing workaround anymore
author drewp@bigasterisk.com
date Mon, 10 Feb 2020 16:57:22 -0800
parents f357cd36c26e
children 97903fa9b12f
files package.json src/graph_view.ts
diffstat 2 files changed, 6 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/package.json	Mon Feb 10 16:56:21 2020 -0800
+++ b/package.json	Mon Feb 10 16:57:22 2020 -0800
@@ -14,8 +14,8 @@
     "@polymer/decorators": "^3.0.0",
     "@polymer/polymer": "^3.3.1",
     "@types/jsonld": "^1.5.0",
-    "@types/n3": "^1.1.3",
-    "jsonld": "^2.0.1",
+    "@types/n3": "^1.1.5",
+    "jsonld": "^2.0.2",
     "lit-html": "^1.1.2",
     "n3": "^1.3.5",
     "rdf-js": "^1.0.2"
--- a/src/graph_view.ts	Mon Feb 10 16:56:21 2020 -0800
+++ b/src/graph_view.ts	Mon Feb 10 16:57:22 2020 -0800
@@ -1,9 +1,7 @@
 import { html, TemplateResult } from "lit-html";
-import { Quad, Term, N3Store, Literal } from "n3";
+import { Quad, Term, N3Store, Literal, Quad_Object, NamedNode } 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';
@@ -13,6 +11,7 @@
 };
 
 type TypeToSubjs = Map<NamedNode, Set<NamedNode>>;
+// When there are multiple types, an arbitrary one is used.
 function groupByRdfType(
   graph: N3Store
 ): { byType: TypeToSubjs; untyped: Set<NamedNode> } {
@@ -30,10 +29,8 @@
       let subjType: NamedNode | null = null;
 
       graph.forObjects(
-        (o: Quad) => {
-          if (Util.isNamedNode(o.object)) {
-            subjType = o.object as NamedNode;
-          }
+        (o: Quad_Object) => {
+            subjType = o as NamedNode;
         },
         subj,
         rdfType,