The parser uses the wrong blank nodes or blank node identifiers if explicit blank nodes with node identifiers and implicit blank nodes are mixed and combined with a custom data factory. Below is a full example with JSON-LD data, the current output and the expected output. The expected output was validated with jsonld.js.
example.js:
import { createReadStream } from 'node:fs'
import toNT from '@rdfjs/to-ntriples'
import { JsonLdParser } from 'jsonld-streaming-parser'
import rdf from 'rdf-ext'
async function main () {
const input = createReadStream('data.json')
const parser = new JsonLdParser({ dataFactory: rdf })
input.pipe(parser)
.on('data', q => console.log(toNT(q)))
.on('error', console.error)
}
main()
data.json:
{
"@context": {
"sh": "http://www.w3.org/ns/shacl#"
},
"sh:result": [
{
"sh:focusNode": {
"@id": "ex:Alice"
},
"sh:sourceShape": {
"@id": "_:b1"
}
}
]
}
current.ttl:
_:b1 <http://www.w3.org/ns/shacl#focusNode> <ex:Alice> .
_:b1 <http://www.w3.org/ns/shacl#sourceShape> _:b1 .
_:b2 <http://www.w3.org/ns/shacl#result> _:b1 .
expected.ttl:
_:b0 <http://www.w3.org/ns/shacl#result> _:b1 .
_:b1 <http://www.w3.org/ns/shacl#focusNode> <ex:Alice> .
_:b1 <http://www.w3.org/ns/shacl#sourceShape> _:b2 .
The parser uses the wrong blank nodes or blank node identifiers if explicit blank nodes with node identifiers and implicit blank nodes are mixed and combined with a custom data factory. Below is a full example with JSON-LD data, the current output and the expected output. The expected output was validated with
jsonld.js.example.js:
data.json:
{ "@context": { "sh": "http://www.w3.org/ns/shacl#" }, "sh:result": [ { "sh:focusNode": { "@id": "ex:Alice" }, "sh:sourceShape": { "@id": "_:b1" } } ] }current.ttl:
expected.ttl: