Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug when processing blank nodes with reverse properties #304

Merged
merged 1 commit into from
Oct 22, 2013

Conversation

lanthaler
Copy link
Member

This fixes a bug when creating a node map for blank nodes with reverse properties. See http://lists.w3.org/Archives/Public/public-linked-json/2013Oct/0046.html for the original bug report.

I've also added two new tests (toRdf-0118 and flatten-0044) which test the fix and the EARL report for my implementation. None of the existing tests has been invalidated.

@gkellogg
Copy link
Member

+1

@dlongley
Copy link
Member

I solved this a little differently. When processing the items in the reverse map, I check to see if the item is a blank node, and if so, I generate the new blank node identifier for it. Then, I recurse before merging the reference node into the node in the node map related to the item. It seems to work and passes the test. This avoids any need to pass somewhat hacky parameters.

@dlongley
Copy link
Member

So, 6.8.3.1.1 becomes a check to see if "value" is a blank node, and if so, a new blank node identifier is generated. 6.8.3.1.2 is the same but also passes the new identifier. Then 6.8.3.1.3 is the old 6.8.3.1.1 except the change is made to the entry in the node map, not "value".

@dlongley
Copy link
Member

Well, looking at the rest of the node map generation algorithm, it seems like it has deviated a bit from how I originally wrote mine. So while my change works with my existing code, it may not work properly with the rest of the algorithm as it stands in the spec. My code always passes generated blank node IDs as a parameter so they don't get regenerated; it looks like the spec algorithm always generates them.

lanthaler added a commit that referenced this pull request Oct 22, 2013
Fix bug when processing blank nodes with reverse properties
@lanthaler lanthaler merged commit 2346834 into json-ld:master Oct 22, 2013
@lanthaler
Copy link
Member Author

Since the time is critical right now, I'm going ahead and merge this changes directly instead of trying to improve the algorithm further.

@lanthaler lanthaler deleted the bnode-reverse-bugfix branch October 22, 2013 07:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants