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

On 10/18/2014 11:59 AM, bergi wrote:
> Am 17.10.2014 um 15:35 schrieb ☮ elf Pavlik ☮:
>> Howdy,
>>
>> I work on automated tests for examples in draft of ActivityStreams 2.0
>> spec[1]
>>
>> So far I use jsonld.js to get N-Quads from JSON-LD examples in spec +
>> latest context document. For now I modified those N-Quads by hand to
>> make it more human readable Turtle so we can review and define expected
>> RDF as fixtures.
>>
>> I still don't have clear strategy how to compare graphs serialized in
>> both JSON-LD and Turtle. I plan to use N3.js to parse turtle, also in
>> LevelGraph extensions[2][3] we already have code which converts both
>> serializations to array of plain triples for persisting them. It may
>> require some carefulness with blank nodes...
>>
>> I remember us having conversation about common js format which we could
>> use as common base for converting all the other serializations. I think
>> we considered expanded JSON-LD as main candidate.
>>
>> Any recommendations for quick way of comparing, for now just equality,
>> graphs serialized in JSON-LD and Turtle?
> 
> I have created the module rdf-test-utils[1] for my RDF-Ext tests[2]. The
> module contains a compareGraph method to compare two RDF-Interfaces
> graph objects. The jsonld.normalize function is used to generate
> canonical N-Triples. You could use the RDF-Ext parsers to get
> RDF-Interfaces graph objects. Internal RDF-Ext also uses the JSON-LD and
> N3.js library.
> 
> bergi
> 
> [1] https://www.npmjs.org/package/rdf-test-utils
> [2] https://github.com/bergos/rdf-ext/blob/master/test/test.js

SOLVED!
https://github.com/jasnell/w3c-socialwg-activitystreams/pull/32

big thanks to bergi for providing handy library and fixing two bugs in
it, which i stumbled upon, in close to no time :)

* https://github.com/bergos/rdf-ext/issues/3
* https://github.com/bergos/rdf-ext/issues/4

please just remember to release second fix to npm...

Received on Sunday, 19 October 2014 20:13:41 UTC