Skip to content

Commit 13b009f

Browse files
committed
Test that compaction falls back to terms if no property generator matches
This addresses #142 and #160.
1 parent e8f0cfc commit 13b009f

File tree

4 files changed

+106
-0
lines changed

4 files changed

+106
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"@context": {
3+
"site": "http://example.com/",
4+
"doesntExist": "http://example.com/doesntExistInInputData",
5+
"schema": "http://schema.org/",
6+
"field_tags_term_set": { "@id": "site:vocab/field_tags", "@container": "@set" },
7+
"field_tags_set": { "@id": [ "site:vocab/field_tags", "http://schema.org/about", "doesntExist" ], "@container": "@set" },
8+
"field_tags_set_id": { "@id": [ "site:vocab/field_tags", "http://schema.org/about", "doesntExist" ], "@container": "@set", "@type": "@id" },
9+
"field_related_set": { "@id": [ "site:vocab/field_related", "http://schema.org/about", "doesntExist" ], "@container": "@set" },
10+
"field_related_term_list": { "@id": "site:vocab/field_related", "@container": "@list" },
11+
"field_related_list": { "@id": [ "site:vocab/field_related", "http://schema.org/about", "doesntExist" ], "@container": "@list" },
12+
"field_related_list_id": { "@id": [ "site:vocab/field_related", "http://schema.org/about", "doesntExist" ], "@container": "@list", "@type": "@id" },
13+
"field_related_list_lang": { "@id": [ "site:vocab/field_related", "http://schema.org/about", "doesntExist" ], "@container": "@list", "@language": "en" }
14+
}
15+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
[
2+
{
3+
"@id": "http://example.com/node/1",
4+
"http://example.com/vocab/field_related": [
5+
{
6+
"@list": [
7+
{
8+
"@id": "http://example.com/node/this-is-related-news"
9+
},
10+
{
11+
"@value": "This is a related string",
12+
"@language": "en"
13+
}
14+
]
15+
}
16+
],
17+
"http://schema.org/about": [
18+
{
19+
"@list": [
20+
{
21+
"@id": "http://example.com/node/this-is-related-news"
22+
},
23+
{
24+
"@value": "This is a related string",
25+
"@language": "en"
26+
}
27+
]
28+
},
29+
{
30+
"@id": "http://example.com/term/this-is-a-tag"
31+
}
32+
],
33+
"http://example.com/vocab/field_tags": [
34+
{
35+
"@id": "http://example.com/term/this-is-a-tag"
36+
}
37+
]
38+
}
39+
]
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
{
2+
"@context": {
3+
"site": "http://example.com/",
4+
"doesntExist": "http://example.com/doesntExistInInputData",
5+
"schema": "http://schema.org/",
6+
"field_tags_term_set": { "@id": "site:vocab/field_tags", "@container": "@set" },
7+
"field_tags_set": { "@id": [ "site:vocab/field_tags", "http://schema.org/about", "doesntExist" ], "@container": "@set" },
8+
"field_tags_set_id": { "@id": [ "site:vocab/field_tags", "http://schema.org/about", "doesntExist" ], "@container": "@set", "@type": "@id" },
9+
"field_related_set": { "@id": [ "site:vocab/field_related", "http://schema.org/about", "doesntExist" ], "@container": "@set" },
10+
"field_related_term_list": { "@id": "site:vocab/field_related", "@container": "@list" },
11+
"field_related_list": { "@id": [ "site:vocab/field_related", "http://schema.org/about", "doesntExist" ], "@container": "@list" },
12+
"field_related_list_id": { "@id": [ "site:vocab/field_related", "http://schema.org/about", "doesntExist" ], "@container": "@list", "@type": "@id" },
13+
"field_related_list_lang": { "@id": [ "site:vocab/field_related", "http://schema.org/about", "doesntExist" ], "@container": "@list", "@language": "en" }
14+
},
15+
"@id": "site:node/1",
16+
"field_tags_term_set": [
17+
{
18+
"@id": "site:term/this-is-a-tag"
19+
}
20+
],
21+
"field_related_term_list": [
22+
{
23+
"@id": "site:node/this-is-related-news"
24+
},
25+
{
26+
"@value": "This is a related string",
27+
"@language": "en"
28+
}
29+
],
30+
"schema:about": [
31+
{
32+
"@list": [
33+
{
34+
"@id": "site:node/this-is-related-news"
35+
},
36+
{
37+
"@value": "This is a related string",
38+
"@language": "en"
39+
}
40+
]
41+
},
42+
{
43+
"@id": "site:term/this-is-a-tag"
44+
}
45+
]
46+
}

test-suite/tests/compact-manifest.jsonld

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,5 +216,11 @@
216216
"input": "compact-0035-in.jsonld",
217217
"context": "compact-0035-context.jsonld",
218218
"expect": "compact-0035-out.jsonld"
219+
}, {
220+
"@type": ["test:TestCase", "jld:CompactTest"],
221+
"name": "Fall back to terms if no property generator matches",
222+
"input": "compact-0036-in.jsonld",
223+
"context": "compact-0036-context.jsonld",
224+
"expect": "compact-0036-out.jsonld"
219225
}]
220226
}

0 commit comments

Comments
 (0)