Skip to content

Commit 84d0b10

Browse files
committed
drop explicitly ignored @id: None subjects
1 parent 5e98de0 commit 84d0b10

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
- Invalid IRI base values within lists are now skipped when serializing to RDF. Fixes [toRdf#tli12](https://w3c.github.io/json-ld-api/tests/toRdf-manifest#tli12) and [toRdf#tli14](https://w3c.github.io/json-ld-api/tests/toRdf-manifest#tli14).
2727
- Literals with invalid `@language` no longer output triples. Fixes [toRdf#twf05](https://w3c.github.io/json-ld-api/tests/toRdf-manifest#twf05).
2828
- IRI validation now detects multiple # fragments so these IRI's are skipped during toRDF. Fixes [toRdf#te111](https://w3c.github.io/json-ld-api/tests/toRdf-manifest#te111) and [toRdf#te112](https://w3c.github.io/json-ld-api/tests/toRdf-manifest#te112).
29+
- In `_create_node_map()`, ignored `@id: None` subjects are now dropped before they enter the node map to prevent `_graph_to_rdf()` from crashing when sorting mixed `None` and string keys. Fixes [toRdf#te122](https://w3c.github.io/json-ld-api/tests/toRdf-manifest#te122).
2930

3031
### Changed
3132
- **BREAKING**: Migrated `jsonld.to_rdf()`, `jsonld.from_rdf()`, and N-Quads parsing/serialization to use `rdflib.Dataset` and RDFLib terms directly.

lib/pyld/jsonld.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4241,6 +4241,10 @@ def _create_node_map(
42414241
id_ = input_.get('@id')
42424242
if _is_bnode(input_):
42434243
id_ = issuer.get_id(id_)
4244+
# drop explicitly ignored @id: None subjects before they enter the node map,
4245+
# while leaving normal blank nodes without @id alone.
4246+
elif id_ is None and '@id' in input_:
4247+
return
42444248

42454249
# create new subject or merge into existing one
42464250
node = graph_map.setdefault(active_graph, {}).setdefault(id_, {'@id': id_})

tests/runtests.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,6 @@ def write(self, filename):
10161016
'idRegex': [
10171017
# blank node property
10181018
'.*toRdf-manifest#te075$',
1019-
'.*toRdf-manifest#te122$',
10201019
]
10211020
},
10221021
'skip': {

0 commit comments

Comments
 (0)