RE: Checking equality of graphs serialized in JSON-LD and Turtle

On 17 Okt 2014 at 15:35, ☮ elf Pavlik ☮ wrote:
> Any recommendations for quick way of comparing, for now just equality,
> graphs serialized in JSON-LD and Turtle?

It depends on whether you have blank nodes in the document or not. If you don't simply convert it to N-Triples, sort the triples and do a string comparison.

If you do have blank nodes, it becomes a bit more complex as you need to ensure that the bnodes get assigned the same bnode identifiers. We have been working on a graph normalization algorithm in the JSON-LD CG [1]. Luckily, jsonld.js implements this algorithm (also the JSON-LD playground supports it, just click on the normalize tab). After normalizing both graphs it is trivial to compare them.


HTH,
Markus


[1] http://json-ld.org/spec/latest/rdf-graph-normalization/


--
Markus Lanthaler
@markuslanthaler

Received on Friday, 17 October 2014 14:45:45 UTC