Skip to content

Commit fb6d594

Browse files
committed
Add compaction to @type map when the compacted item is not already a map.
From ruby-rdf/json-ld#62.
1 parent 45d172b commit fb6d594

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

tests/compact-manifest.jsonld

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1800,6 +1800,15 @@
18001800
"context": "compact/m022-context.jsonld",
18011801
"expect": "compact/m022-out.jsonld",
18021802
"option": {"specVersion": "json-ld-1.1"}
1803+
}, {
1804+
"@id": "#tm023",
1805+
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
1806+
"name": "compact IRI with container: @type",
1807+
"purpose": "Uses @none when compacted item is an IRI string",
1808+
"input": "compact/m023-in.jsonld",
1809+
"context": "compact/m023-context.jsonld",
1810+
"expect": "compact/m023-out.jsonld",
1811+
"option": {"specVersion": "json-ld-1.1"}
18031812
}, {
18041813
"@id": "#tn001",
18051814
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],

tests/compact/m023-context.jsonld

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"@context": {
3+
"@vocab": "http://schema.org/",
4+
"location": {
5+
"@type": "@id",
6+
"@container": "@type"
7+
}
8+
}
9+
}

tests/compact/m023-in.jsonld

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"@context": {
3+
"@vocab": "http://schema.org/"
4+
},
5+
"@type": "Event",
6+
"location": {
7+
"@id": "http://kg.artsdata.ca/resource/K11-200"
8+
}
9+
}

tests/compact/m023-out.jsonld

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"@context": {
3+
"@vocab": "http://schema.org/",
4+
"location": {
5+
"@type": "@id",
6+
"@container": "@type"
7+
}
8+
},
9+
"@type": "Event",
10+
"location": {
11+
"@none": "http://kg.artsdata.ca/resource/K11-200"
12+
}
13+
}

0 commit comments

Comments
 (0)