-
Notifications
You must be signed in to change notification settings - Fork 555
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 nested list expansion in JSON-LD #2517
Conversation
pre-commit.ci autofix |
I'm not really that familiar with JSON-LD as I probably should be, as far as I understand the flattening is pursuant to JSON-LD 1.1: 9.14 Property Nesting |
@aucampia, yes, RDFLib does first-level and second-level flattening correctly, but fails when arrays are nested more deeply. For this JSON-LD playground example, this is what RDFLib outputs (note the incorrect
And, if
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@avillar thanks for fixing this, and apologies for only reviewing it now. There are some minor comments that I will address with some commits shortly, but the fix looks very good overall.
This is so it is easier to copy to a file and use with Jena's riot for example.
This makes it more compliant with PEP8.
I will merge this before 2023-08-14. |
Thank you, and thanks for all the fixes! |
Summary of changes
This PR fixes parsing of deeply nested arrays in JSON-LD:
[ [ [ 1, 2, 3] , [4, 5] ] ]
-->( "[1, 2, 3]", "[4, 5]" )
(list contents converted to string literals)[ [ [ 1, 2, 3] , [4, 5] ] ]
-->( 1 2 3 4 5 )
(array is properly flattened)@container
is set to@list
:[ [ [ 1, 2, 3] , [4, 5] ] ]
-->( "[1, 2, 3]", "[4, 5]" )
(list contents converted to string literals)[ [ [ 1, 2, 3] , [4, 5] ] ]
-->( ( ( 1 2 3 ) ( 4 5 ) ) )
(array nesting preserved)Checklist
the same change.
./examples
.so maintainers can fix minor issues and keep your PR up to date.