Mercurial > code > home > repos > streamed-graph
diff src/json_ld_quads.ts @ 15:7ca4ff2088c3
managed to use a newer ts or something, so this includes a bunch of type fixes too
author | drewp@bigasterisk.com |
---|---|
date | Sun, 08 Dec 2019 23:32:12 -0800 |
parents | b9f451791f3a |
children | 9ec3cbc8791a |
line wrap: on
line diff
--- a/src/json_ld_quads.ts Fri Dec 06 20:34:01 2019 -0800 +++ b/src/json_ld_quads.ts Sun Dec 08 23:32:12 2019 -0800 @@ -12,7 +12,7 @@ function _emitQuad( onQuad: (q: Quad) => void, subjNode: NamedNode, - pred: string | { '@id': string }, + pred: string, subj: any, graphNode: NamedNode) { let predNode: NamedNode; @@ -20,7 +20,7 @@ predNode = namedNode(rdf.type); } else { - predNode = namedNode(pred['@id']); + predNode = namedNode(pred); } subj[pred as string].forEach(function (obj: any) { const objNode = (obj['@id'] ? namedNode(obj['@id']) : @@ -41,12 +41,14 @@ (expanded as [object]).forEach(function (g) { var graph = g['@id']; var graphNode = namedNode(graph); - g['@graph'].forEach(function (subj) { + g['@graph'].forEach(function (subj: { [predOrId: string]: any; }) { + console.log('process subj', subj) const subjNode = namedNode(subj['@id']); for (let pred in subj) { if (pred === '@id') { continue; - } 2 + } + console.log('emit with', pred); _emitQuad(onQuad, subjNode, pred, subj, graphNode); } });