feat: hextuple parser and serializer now supports anonymous graph names by edmondchuc · Pull Request #2815 · RDFLib/rdflib (original) (raw)

Summary of changes

Add support for the handling of anonymous graph names in the hextuple parser and serializer.

The previous behaviour always treated the sixth value in the tuple as the IRI of the graph name. However, as per the hextuples spec,

If the graph is a blank node (i.e. anonymous), use an underscore as the URI scheme: _:myNode. (ontola/hextuples#2). Parsers SHOULD interpret these as blank graphs, but MAY discard these if they have no support for them.

This new behaviour now inspects the start of the value and, if it sees _:, it will treat it as a blank node.

Tests have been added and updated to adjust for this change, including the testing of roundtripping the hextuple format.

Checklist