Skip to content

Commit 8c9882e

Browse files
committed
A couple of more graph expansion and compaction tests for corner cases.
1 parent 5ea3e71 commit 8c9882e

10 files changed

+99
-2
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"@context": {
3+
"@vocab": "http://example.org/",
4+
"input": {"@container": "@graph"}
5+
}
6+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[{
2+
"http://example.org/input": [{
3+
"@graph": [{
4+
"http://example.org/value": [{"@value": "x"}]
5+
}],
6+
"@index": "ndx"
7+
}]
8+
}]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"@context": {
3+
"@vocab": "http://example.org/",
4+
"input": {"@container": "@graph"}
5+
},
6+
"input": {
7+
"value": "x"
8+
}
9+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"@context": {
3+
"@vocab": "http://example.org/",
4+
"input": {"@container": "@graph"}
5+
}
6+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[{
2+
"http://example.org/input": [{
3+
"@graph": [{
4+
"http://example.org/value": [{"@value": "x"}]
5+
}],
6+
"@id": "http://example.org/id"
7+
}]
8+
}]
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"@context": {
3+
"@vocab": "http://example.org/",
4+
"input": {
5+
"@container": "@graph"
6+
}
7+
},
8+
"input": {
9+
"@id": "http://example.org/id",
10+
"@graph": [
11+
{
12+
"value": "x"
13+
}
14+
]
15+
}
16+
}

test-suite/tests/compact-manifest.jsonld

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@
632632
"@id": "#t0077",
633633
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
634634
"name": "Compact a @graph container",
635-
"purpose": "Expand and compact a @graph container",
635+
"purpose": "Compact a @graph container",
636636
"input": "compact-0077-in.jsonld",
637637
"context": "compact-0077-context.jsonld",
638638
"expect": "compact-0077-out.jsonld",
@@ -641,11 +641,29 @@
641641
"@id": "#t0078",
642642
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
643643
"name": "Compact a [@graph, @set] container",
644-
"purpose": "Expand a @graph container and compact with [@graph, @set]",
644+
"purpose": "Compact with [@graph, @set]",
645645
"input": "compact-0078-in.jsonld",
646646
"context": "compact-0078-context.jsonld",
647647
"expect": "compact-0078-out.jsonld",
648648
"option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}
649+
}, {
650+
"@id": "#t0079",
651+
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
652+
"name": "Compact a @graph container having @index",
653+
"purpose": "Verify that having both @graph and @index allows @graph container compaction",
654+
"input": "compact-0079-in.jsonld",
655+
"context": "compact-0079-context.jsonld",
656+
"expect": "compact-0079-out.jsonld",
657+
"option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}
658+
}, {
659+
"@id": "#t0080",
660+
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
661+
"name": "Do not compact a graph having @id with a term having an @graph container",
662+
"purpose": "Graph compaction works only on simple graphs",
663+
"input": "compact-0080-in.jsonld",
664+
"context": "compact-0080-context.jsonld",
665+
"expect": "compact-0080-out.jsonld",
666+
"option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}
649667
}, {
650668
"@id": "#tc001",
651669
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"@context": {
3+
"@vocab": "http://example.org/",
4+
"input": {"@container": "@graph"}
5+
},
6+
"input": {
7+
"@graph": {
8+
"value": "x"
9+
}
10+
}
11+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[{
2+
"http://example.org/input": [{
3+
"@graph": [{
4+
"http://example.org/value": [{"@value": "x"}]
5+
}]
6+
}]
7+
}]

test-suite/tests/expand-manifest.jsonld

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,14 @@
574574
"input": "expand-0080-in.jsonld",
575575
"expect": "expand-0080-out.jsonld",
576576
"option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}
577+
}, {
578+
"@id": "#t0081",
579+
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
580+
"name": "Does not create an @graph container if value is a graph",
581+
"purpose": "Use of [@graph, @set] containers where value is already a graph",
582+
"input": "expand-0081-in.jsonld",
583+
"expect": "expand-0081-out.jsonld",
584+
"option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}
577585
}, {
578586
"@id": "#tc001",
579587
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],

0 commit comments

Comments
 (0)