fix: issue with trig reference counting across graphs by aucampia · Pull Request #2085 · RDFLib/rdflib (original) (raw)
Summary of changes
The TriG serializer was only considering BNode references inside a single
graph and not counting the BNodes subjects as references when considering if a
BNode should be serialized as unlabeled blank nodes (i.e. [ ]
), and as a
result it was serializing BNodes as unlabeled if they were in fact referencing
BNodes in other graphs.
One caveat of this change is that some RDF Datasets may be serialized
less sussinctly in that it would not use unlabeled blank nodes where it is
technically possible. This can be trivially fixed, but a trivial fix
increases the compuational complexity of serialization significantly.
Other changes:
- Removed the roundtrip xfail that this change fixed.
- Added another roundtrip test which has various combinations of BNode
references across graphs in a dataset, this test fails for JSON-LD
however, so while this change removes one xfail it also now adds
another. - Set the default indent_size and style in .editorconfig as to avoid
relying on undefined system defaults.
Checklist
- Checked that there aren't other open pull requests for
the same change. - Added tests for any changes that have a runtime impact.
- Checked that all tests and type checking passes.
- For changes that have a potential impact on users of this project:
- Considered updating our changelog (
CHANGELOG.md
).
- Considered updating our changelog (
- Considered granting push permissions to the PR branch,
so maintainers can fix minor issues and keep your PR up to date.