Skip to content

Commit

Permalink
Add tests for expanding and compacting named graphs where term defini…
Browse files Browse the repository at this point in the history
…tion includes `@graphid`.
  • Loading branch information
gkellogg committed Nov 19, 2017
1 parent 8c9882e commit 29d9902
Show file tree
Hide file tree
Showing 14 changed files with 126 additions and 9 deletions.
4 changes: 2 additions & 2 deletions test-suite/tests/compact-0080-in.jsonld
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[{
"http://example.org/input": [{
"@id": "http://example.org/gid",
"@graph": [{
"http://example.org/value": [{"@value": "x"}]
}],
"@id": "http://example.org/id"
}]
}]
}]
6 changes: 2 additions & 4 deletions test-suite/tests/compact-0080-out.jsonld
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
{
"@context": {
"@vocab": "http://example.org/",
"input": {
"@container": "@graph"
}
"input": {"@container": "@graph"}
},
"input": {
"@id": "http://example.org/id",
"@id": "http://example.org/gid",
"@graph": [
{
"value": "x"
Expand Down
6 changes: 6 additions & 0 deletions test-suite/tests/compact-0081-context.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"@context": {
"@vocab": "http://example.org/",
"input": {"@container": "@graph", "@graphId": "gid"}
}
}
8 changes: 8 additions & 0 deletions test-suite/tests/compact-0081-in.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[{
"http://example.org/input": [{
"@id": "http://example.org/gid",
"@graph": [{
"http://example.org/value": [{"@value": "x"}]
}]
}]
}]
9 changes: 9 additions & 0 deletions test-suite/tests/compact-0081-out.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"@context": {
"@vocab": "http://example.org/",
"input": {"@container": "@graph", "@graphId": "gid"}
},
"input": {
"value": "x"
}
}
6 changes: 6 additions & 0 deletions test-suite/tests/compact-0082-context.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"@context": {
"@vocab": "http://example.org/",
"input": {"@container": "@graph", "@graphId": "nomatch"}
}
}
8 changes: 8 additions & 0 deletions test-suite/tests/compact-0082-in.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[{
"http://example.org/input": [{
"@id": "http://example.org/gid",
"@graph": [{
"http://example.org/value": [{"@value": "x"}]
}]
}]
}]
14 changes: 14 additions & 0 deletions test-suite/tests/compact-0082-out.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"@context": {
"@vocab": "http://example.org/",
"input": {"@container": "@graph", "@graphId": "nomatch"}
},
"input": {
"@id": "http://example.org/gid",
"@graph": [
{
"value": "x"
}
]
}
}
22 changes: 20 additions & 2 deletions test-suite/tests/compact-manifest.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -658,12 +658,30 @@
}, {
"@id": "#t0080",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
"name": "Do not compact a graph having @id with a term having an @graph container",
"purpose": "Graph compaction works only on simple graphs",
"name": "Does not compact graph with @id without @graphId",
"purpose": "Graph compaction works only on graphs with matching identifier",
"input": "compact-0080-in.jsonld",
"context": "compact-0080-context.jsonld",
"expect": "compact-0080-out.jsonld",
"option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}
}, {
"@id": "#t0081",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
"name": "Compacts named graph",
"purpose": "Graph compaction works if term @graphId matches graph @id",
"input": "compact-0081-in.jsonld",
"context": "compact-0081-context.jsonld",
"expect": "compact-0081-out.jsonld",
"option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}
}, {
"@id": "#t0082",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
"name": "Does not compacts graph with @id without matching @graphId",
"purpose": "Graph compaction works only on graphs with matching identifier",
"input": "compact-0082-in.jsonld",
"context": "compact-0082-context.jsonld",
"expect": "compact-0082-out.jsonld",
"option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}
}, {
"@id": "#tc001",
"@type": ["jld:PositiveEvaluationTest", "jld:CompactTest"],
Expand Down
9 changes: 9 additions & 0 deletions test-suite/tests/expand-0082-in.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"@context": {
"@vocab": "http://example.org/",
"input": {"@container": "@graph", "@graphId": "gid"}
},
"input": {
"value": "x"
}
}
8 changes: 8 additions & 0 deletions test-suite/tests/expand-0082-out.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[{
"http://example.org/input": [{
"@id": "http://example.org/gid",
"@graph": [{
"http://example.org/value": [{"@value": "x"}]
}]
}]
}]
9 changes: 9 additions & 0 deletions test-suite/tests/expand-0083-in.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"@context": {
"@vocab": "http://example.org/",
"input": {"@container": "@graph", "@graphId": "_:gid"}
},
"input": {
"value": "x"
}
}
8 changes: 8 additions & 0 deletions test-suite/tests/expand-0083-out.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[{
"http://example.org/input": [{
"@id": "_:gid",
"@graph": [{
"http://example.org/value": [{"@value": "x"}]
}]
}]
}]
18 changes: 17 additions & 1 deletion test-suite/tests/expand-manifest.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -578,10 +578,26 @@
"@id": "#t0081",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
"name": "Does not create an @graph container if value is a graph",
"purpose": "Use of [@graph, @set] containers where value is already a graph",
"purpose": "Don't double-expand an already expanded graph",
"input": "expand-0081-in.jsonld",
"expect": "expand-0081-out.jsonld",
"option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}
}, {
"@id": "#t0082",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
"name": "Creates a @graph container with an @graphId",
"purpose": "Compaction of named graphs",
"input": "expand-0082-in.jsonld",
"expect": "expand-0082-out.jsonld",
"option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}
}, {
"@id": "#t0083",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
"name": "Creates a @graph container with an blank @graphId",
"purpose": "Creates a @graph container with an @graphId which is a blank node",
"input": "expand-0083-in.jsonld",
"expect": "expand-0083-out.jsonld",
"option": {"processingMode": "json-ld-1.1", "specVersion": "json-ld-1.1"}
}, {
"@id": "#tc001",
"@type": ["jld:PositiveEvaluationTest", "jld:ExpandTest"],
Expand Down

0 comments on commit 29d9902

Please sign in to comment.