Skip to content

Commit

Permalink
Add compaction to @type map when the compacted item is not already a …
Browse files Browse the repository at this point in the history
…map.

From ruby-rdf/json-ld#62.
  • Loading branch information
gkellogg committed Jul 29, 2024
1 parent 45d172b commit fb6d594
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/compact-manifest.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -1800,6 +1800,15 @@
"context": "compact/m022-context.jsonld",
"expect": "compact/m022-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#tm023",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
"name": "compact IRI with container: @type",
"purpose": "Uses @none when compacted item is an IRI string",
"input": "compact/m023-in.jsonld",
"context": "compact/m023-context.jsonld",
"expect": "compact/m023-out.jsonld",
"option": {"specVersion": "json-ld-1.1"}
}, {
"@id": "#tn001",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
Expand Down
9 changes: 9 additions & 0 deletions tests/compact/m023-context.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"@context": {
"@vocab": "http://schema.org/",
"location": {
"@type": "@id",
"@container": "@type"
}
}
}
9 changes: 9 additions & 0 deletions tests/compact/m023-in.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"@context": {
"@vocab": "http://schema.org/"
},
"@type": "Event",
"location": {
"@id": "http://kg.artsdata.ca/resource/K11-200"
}
}
13 changes: 13 additions & 0 deletions tests/compact/m023-out.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"@context": {
"@vocab": "http://schema.org/",
"location": {
"@type": "@id",
"@container": "@type"
}
},
"@type": "Event",
"location": {
"@none": "http://kg.artsdata.ca/resource/K11-200"
}
}

0 comments on commit fb6d594

Please sign in to comment.