Mercurial > code > home > repos > streamed-graph
diff src/json_ld_quads.ts @ 18:4bf74032e2e8
merge
author | drewp@bigasterisk.com |
---|---|
date | Thu, 12 Dec 2019 22:57:14 -0800 |
parents | 7ca4ff2088c3 |
children | 9ec3cbc8791a |
line wrap: on
line diff
--- a/src/json_ld_quads.ts Thu Dec 12 22:52:57 2019 -0800 +++ b/src/json_ld_quads.ts Thu Dec 12 22:57:14 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); } });