Skip to content

Commit

Permalink
Fix anonymous bnodes in nested predicate inside graph being voided
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Oct 14, 2020
1 parent dd8022e commit 2302014
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
3 changes: 0 additions & 3 deletions lib/entryhandler/EntryHandlerPredicate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,6 @@ export class EntryHandlerPredicate implements IEntryHandler<boolean> {
await EntryHandlerPredicate.handlePredicateObject(parsingContext, util, keys, depth,
predicate, object, reverse);
}
} else {
// An invalid value was encountered, so we ignore it higher in the stack.
parsingContext.emittedStack[depth] = false;
}
}
}
Expand Down
21 changes: 21 additions & 0 deletions test/JsonLdParser-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4428,6 +4428,27 @@ describe('JsonLdParser', () => {
});
});

describe('arrays in a graph', () => {
it('with a predicate in predicate with anonymous bnode in array', async () => {
const stream = streamifyString(`
{
"@graph": [
{
"@id": "ex:s",
"ex:p1": {
"ex:p2": [{}]
}
}
]
}
`);
return expect(await arrayifyStream(stream.pipe(parser))).toBeRdfIsomorphic([
DF.quad(DF.namedNode('ex:s'), DF.namedNode('ex:p1'), DF.blankNode('b0')),
DF.quad(DF.blankNode('b0'), DF.namedNode('ex:p2'), DF.blankNode('b1')),
]);
});
});

describe('a top-level context', () => {
it('without other triples', async () => {
const stream = streamifyString(`
Expand Down

0 comments on commit 2302014

Please sign in to comment.