ruby-rdf/json-ld

JSON serialization fails on "can't add a new key into hash during iteration"

Closed this issue · 1 comments

Trying to convert the file at

http://raimond.me.uk/resources/jsonld-issue-test.ttl

from Turtle to JSON-LD using the command line

rdf serialize --output-format jsonld --input-format turtle http://raimond.me.uk/resources/jsonld-issue-test.ttl

Gives the following exception:

.gem/ruby/1.9.1/gems/json-ld-1.0.5/lib/json/ld/context.rb:514:in `[]=': can't add a new key into hash during iteration (RuntimeError)

Looking at the code, it seems to be marked as deprecated, so not sure why it is calling it. It is looking like term_definitions is being modified whilst being looped through.

@moustaki I fixed this on branch CR; I'm going to hold off on releasing until we've add more comprehensive tests to the JSON-LD test suite, in case something else comes up.