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

I've had a little look around at your data and tests and I think the following might be happening:

Your tests read in JSON RDF and write JSON RDF which could miss a certain category of error.

If you read RDF XML using Sesame's built in RDFParser for RDF XMl, the blank nodes are stored in the Sesame Statement objects without the "_:" prefix, so when writing to JSON, they are not added as required.

I won't copy in the whole unit test, but basically, if you read the following RDF in:

and assert that the output is either:

{"http:\/\/www.bbc.co.uk\/things\/76369f3b-65a0-4e69-8c52-859adfdefa49#id":{"http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#type":[{"value":"http:\/\/www.bbc.co.uk\/ontologies\/sport\/Person","type":"uri"}],"http:\/\/www.bbc.co.uk\/ontologies\/sport\/discipline":[{"value":"_:arcc05cb1","type":"bnode"}]},"_:arcc05cb1":{"http:\/\/purl.org\/vocab\/participation\/schema#role_at":[{"value":"http:\/\/www.bbc.co.uk\/things\/76369f3b-65a0-4e69-8c52-859adfdefa49#id","type":"uri"}],"http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#type":[{"value":"http:\/\/www.bbc.co.uk\/ontologies\/sport\/CompetesForRole","type":"uri"}],"http:\/\/purl.org\/vocab\/participation\/schema#holder":[{"value":"http:\/\/www.bbc.co.uk\/things\/75f90667-0306-e847-966e-085a11a8f195#id","type":"uri"}]}}

or...

{"_:arcc05cb1":{"http:\/\/purl.org\/vocab\/participation\/schema#role_at":[{"value":"http:\/\/www.bbc.co.uk\/things\/76369f3b-65a0-4e69-8c52-859adfdefa49#id","type":"uri"}],"http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#type":[{"value":"http:\/\/www.bbc.co.uk\/ontologies\/sport\/CompetesForRole","type":"uri"}],"http:\/\/purl.org\/vocab\/participation\/schema#holder":[{"value":"http:\/\/www.bbc.co.uk\/things\/75f90667-0306-e847-966e-085a11a8f195#id","type":"uri"}]},"http:\/\/www.bbc.co.uk\/things\/76369f3b-65a0-4e69-8c52-859adfdefa49#id":{"http:\/\/www.w3.org\/1999\/02\/22-rdf-syntax-ns#type":[{"value":"http:\/\/www.bbc.co.uk\/ontologies\/sport\/Person","type":"uri"}],"http:\/\/www.bbc.co.uk\/ontologies\/sport\/discipline":[{"value":"_:arcc05cb1","type":"bnode"}]}}

(Two versions are needed because the serialisation is not deterministic)

Then the test fails, as the bnodes are not '_:arcc05cb1' but 'arcc05cb1'.

Apologies if I've got this wrong, but this looks like the problem after a brief analysis.

Cheers,

Dave.