joshsh/sesametools — comment on commit 2ba993f66a832914e1a5eed664764258cd809866
File:  line 0
By ansell:

I removed the RDFJSON.graphToRdfJson method so that people don't get confused by it, as it is not used anymore and was very inefficient.

I had forgotten that JSON was not ordered by nature, so it is not necessary to determine the order. It is not a good idea to use string matching in JSON serialisation tests as your example shows, so the new unit test for RDFJSON does not attempt to do this. In addition, Blank Node identifiers in the RDF 1.0 specification are not required to be long lived, so a parser can modify the blank node identifiers that you gave to any other node. If you want stable long lived identifiers, use URIs!

The unit test for RDFJSON verifies the blank node "_:" prefixes, without relying on the order of the elements in the JSON string. I am not sure why the RDF/JSON specification relies on the Turtle/N3/NTriples hack for blank nodes, as it has type="bnode" to identify them. Turtle/etc., only use the _: hack because they lack the file format support that JSON (type="bnode") and RDF (rdf:nodeID) provide.

I think you should have included your whole unit test in your initial comment, as it would have made it clearer which method you were using and we could have identified the reason earlier.