Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

- Preserved RDF literal lexical forms when converting through RDFLib, including canonical double output, large numeric values, and compound literal handling.
- Fixed the active context clone dropping the default base direction: `@direction` now survives context layers like `@language`. Fixes [issue #337](https://github.com/digitalbazaar/pyld/issues/337).
- Fixed `@embed: @never` being ignored for reverse-framed properties because of a misspelled `embedded` framing state key. Fixes [issue #378](https://github.com/digitalbazaar/pyld/issues/378).
- Fixed `KeyError` when a context sets `@direction: null` and no default base direction is in effect.
- Fixed `iri_resolver.unresolve()` query/fragment reconstruction while cleaning up the resolver docstring.
- 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).
Expand Down
2 changes: 1 addition & 1 deletion lib/pyld/jsonld.py
Original file line number Diff line number Diff line change
Expand Up @@ -4660,7 +4660,7 @@ def _match_frame(self, state, subjects, frame, parent, property):
{'propertyIsArray': True},
)
self._match_frame(
{**state, 'embeded': True},
{**state, 'embedded': True},
[subject],
subframe,
output['@reverse'][reverse_prop],
Expand Down
35 changes: 35 additions & 0 deletions tests/jsonld/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,41 @@ def test_frame_uses_identifier_issuer_option():
]
}

def test_frame_reverse_embed_never_is_respected():
# Issue 378: a misspelled state key ignored @embed: @never in @reverse frames
ctx = {
"schema": "http://schema.org/",
"name": "schema:name",
"works_for": {"@id": "schema:worksFor", "@type": "@id"},
"employees": {"@reverse": "schema:worksFor"},
}
doc = {
"@context": ctx,
"@graph": [
{"@id": "ex:org1", "@type": "schema:Organization", "name": "Acme"},
{
"@id": "ex:p1",
"@type": "schema:Person",
"name": "Ada",
"works_for": "ex:org1",
},
],
}
nquads = jsonld.to_rdf(doc, {"format": "application/n-quads"})
back = jsonld.from_rdf(nquads, {"format": "application/n-quads"})

result = jsonld.frame(
back,
{
"@context": ctx,
"@embed": "@once",
"@type": "schema:Organization",
"@reverse": {"schema:worksFor": {"@embed": "@never"}},
},
)

assert result["employees"] == {"@id": "ex:p1"}

# PR: https://github.com/digitalbazaar/pyld/pull/31

FRAME_0001_IN = {
Expand Down
Loading