When using the toRDF method, the jsonld.js library does not return RDFJS spec compliant quads as the quads to not contain an equals() function as required by the spec.
Hotfixed this using the DataFactory class from the N3.js library as follows:
addEqualsMethodToQuad (quad) {
quad.equals = DataFactory.internal.Quad.prototype.equals;
if (quad.subject.termType === 'NamedNode')
quad.subject.equals = DataFactory.internal.NamedNode.prototype.equals;
if (quad.subject.termType === 'BlankNode')
quad.subject.equals = DataFactory.internal.BlankNode.prototype.equals;
if (quad.predicate.termType === 'NamedNode')
quad.predicate.equals = DataFactory.internal.NamedNode.prototype.equals;
if (quad.predicate.termType === 'BlankNode')
quad.predicate.equals = DataFactory.internal.BlankNode.prototype.equals;
if (quad.object.termType === 'NamedNode')
quad.object.equals = DataFactory.internal.NamedNode.prototype.equals;
if (quad.object.termType === 'BlankNode')
quad.object.equals = DataFactory.internal.BlankNode.prototype.equals;
if (quad.object.termType === 'Literal')
quad.object.equals = DataFactory.internal.Literal.prototype.equals;
if (quad.graph.termType === 'NamedNode')
quad.graph.equals = DataFactory.internal.NamedNode.prototype.equals;
if (quad.graph.termType === 'BlankNode')
quad.graph.equals = DataFactory.internal.BlankNode.prototype.equals;
return quad;
}
Fixing this into this library may allow for the N3.js library compatibility and the compatibility to the entire RDF-Ext family.
When using the toRDF method, the jsonld.js library does not return RDFJS spec compliant quads as the quads to not contain an
equals()
function as required by the spec.Hotfixed this using the DataFactory class from the N3.js library as follows:
Fixing this into this library may allow for the N3.js library compatibility and the compatibility to the entire RDF-Ext family.