Skip to content

Commit 29d9902

Browse files
committed
Add tests for expanding and compacting named graphs where term definition includes @graphid.
1 parent 8c9882e commit 29d9902

14 files changed

+126
-9
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[{
22
"http://example.org/input": [{
3+
"@id": "http://example.org/gid",
34
"@graph": [{
45
"http://example.org/value": [{"@value": "x"}]
5-
}],
6-
"@id": "http://example.org/id"
6+
}]
77
}]
88
}]

test-suite/tests/compact-0080-out.jsonld

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
{
22
"@context": {
33
"@vocab": "http://example.org/",
4-
"input": {
5-
"@container": "@graph"
6-
}
4+
"input": {"@container": "@graph"}
75
},
86
"input": {
9-
"@id": "http://example.org/id",
7+
"@id": "http://example.org/gid",
108
"@graph": [
119
{
1210
"value": "x"
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", "@graphId": "gid"}
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+
"@id": "http://example.org/gid",
4+
"@graph": [{
5+
"http://example.org/value": [{"@value": "x"}]
6+
}]
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", "@graphId": "gid"}
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", "@graphId": "nomatch"}
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+
"@id": "http://example.org/gid",
4+
"@graph": [{
5+
"http://example.org/value": [{"@value": "x"}]
6+
}]
7+
}]
8+
}]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"@context": {
3+
"@vocab": "http://example.org/",
4+
"input": {"@container": "@graph", "@graphId": "nomatch"}
5+
},
6+
"input": {
7+
"@id": "http://example.org/gid",
8+
"@graph": [
9+
{
10+
"value": "x"
11+
}
12+
]
13+
}
14+
}

test-suite/tests/compact-manifest.jsonld

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,12 +658,30 @@
658658
}, {
659659
"@id": "#t0080",
660660
"@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",
661+
"name": "Does not compact graph with @id without @graphId",
662+
"purpose": "Graph compaction works only on graphs with matching identifier",
663663
"input": "compact-0080-in.jsonld",
664664
"context": "compact-0080-context.jsonld",
665665
"expect": "compact-0080-out.jsonld",
666666
"option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}
667+
}, {
668+
"@id": "#t0081",
669+
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
670+
"name": "Compacts named graph",
671+
"purpose": "Graph compaction works if term @graphId matches graph @id",
672+
"input": "compact-0081-in.jsonld",
673+
"context": "compact-0081-context.jsonld",
674+
"expect": "compact-0081-out.jsonld",
675+
"option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}
676+
}, {
677+
"@id": "#t0082",
678+
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
679+
"name": "Does not compacts graph with @id without matching @graphId",
680+
"purpose": "Graph compaction works only on graphs with matching identifier",
681+
"input": "compact-0082-in.jsonld",
682+
"context": "compact-0082-context.jsonld",
683+
"expect": "compact-0082-out.jsonld",
684+
"option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}
667685
}, {
668686
"@id": "#tc001",
669687
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
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", "@graphId": "gid"}
5+
},
6+
"input": {
7+
"value": "x"
8+
}
9+
}
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+
"@id": "http://example.org/gid",
4+
"@graph": [{
5+
"http://example.org/value": [{"@value": "x"}]
6+
}]
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", "@graphId": "_:gid"}
5+
},
6+
"input": {
7+
"value": "x"
8+
}
9+
}
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+
"@id": "_:gid",
4+
"@graph": [{
5+
"http://example.org/value": [{"@value": "x"}]
6+
}]
7+
}]
8+
}]

test-suite/tests/expand-manifest.jsonld

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -578,10 +578,26 @@
578578
"@id": "#t0081",
579579
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
580580
"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",
581+
"purpose": "Don't double-expand an already expanded graph",
582582
"input": "expand-0081-in.jsonld",
583583
"expect": "expand-0081-out.jsonld",
584584
"option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}
585+
}, {
586+
"@id": "#t0082",
587+
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
588+
"name": "Creates a @graph container with an @graphId",
589+
"purpose": "Compaction of named graphs",
590+
"input": "expand-0082-in.jsonld",
591+
"expect": "expand-0082-out.jsonld",
592+
"option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}
593+
}, {
594+
"@id": "#t0083",
595+
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
596+
"name": "Creates a @graph container with an blank @graphId",
597+
"purpose": "Creates a @graph container with an @graphId which is a blank node",
598+
"input": "expand-0083-in.jsonld",
599+
"expect": "expand-0083-out.jsonld",
600+
"option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}
585601
}, {
586602
"@id": "#tc001",
587603
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],

0 commit comments

Comments
 (0)