Skip to content

Commit 95e1c89

Browse files
committed
Add annotation map round-tripping test based on Drupal's content deployment use case
This addresses #196.
1 parent 2ff40d4 commit 95e1c89

File tree

4 files changed

+166
-0
lines changed

4 files changed

+166
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"@context": {
3+
"site": "http://example.com/",
4+
"site-cd": "site:site-schema/content-deployment/",
5+
"title": {
6+
"@id": "site-cd:node/article/title",
7+
"@container": "@annotation"
8+
},
9+
"body": {
10+
"@id": "site-cd:node/article/body",
11+
"@container": "@annotation"
12+
},
13+
"field_tags": {
14+
"@id": "site-cd:node/article/field_tags",
15+
"@container": "@annotation"
16+
}
17+
}
18+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
{
2+
"@context": {
3+
"site": "http://example.com/",
4+
"site-cd": "site:site-schema/content-deployment/",
5+
"title": {
6+
"@id": "site-cd:node/article/title",
7+
"@container": "@annotation"
8+
},
9+
"body": {
10+
"@id": "site-cd:node/article/body",
11+
"@container": "@annotation"
12+
},
13+
"field_tags": {
14+
"@id": "site-cd:node/article/field_tags",
15+
"@container": "@annotation"
16+
}
17+
},
18+
"@id": "site:node/1",
19+
"@type": "site-cd:node/article",
20+
"title": {
21+
"en": [
22+
{
23+
"@context": {
24+
"value": "site-cd:node/article/title/value"
25+
},
26+
"@type": "site-cd:field-types/title_field",
27+
"value": "This is the English title"
28+
}
29+
],
30+
"es": [
31+
{
32+
"@context": {
33+
"value": "site-cd:node/article/title/value"
34+
},
35+
"@type": "site-cd:field-types/title_field",
36+
"value": "Este es el t’tulo espa–ol"
37+
}
38+
]
39+
},
40+
"body": {
41+
"en": [
42+
{
43+
"@context": {
44+
"value": "site-cd:node/article/body/value",
45+
"summary": "site-cd:node/article/body/summary",
46+
"format": "site-cd:node/article/body/format"
47+
},
48+
"@type": "site-cd:field-types/text_with_summary",
49+
"value": "This is the English body. There is no Spanish body, so this will be displayed for both the English and Spanish versions.",
50+
"summary": "This is the teaser for the body.",
51+
"format": "full_html"
52+
}
53+
]
54+
},
55+
"field_tags": {
56+
"en": [
57+
{
58+
"@context": {
59+
"uuid": "site-cd:taxonomy/term/uuid"
60+
},
61+
"@type": "site-cd:taxonomy/term",
62+
"@id": "site:taxonomy/term/1",
63+
"uuid": "e34b982c-98ac-4862-9b00-fa771a388010"
64+
}
65+
],
66+
"es": [
67+
{
68+
"@context": {
69+
"uuid": "site-cd:taxonomy/term/uuid"
70+
},
71+
"@type": "site-cd:taxonomy/term",
72+
"@id": "site:taxonomy/term/1",
73+
"uuid": "e34b982c-98ac-4862-9b00-fa771a388010"
74+
},
75+
{
76+
"@context": {
77+
"uuid": "site-cd:taxonomy/term/uuid"
78+
},
79+
"@type": "site-cd:taxonomy/term",
80+
"@id": "site:taxonomy/term/2",
81+
"uuid": "a55b982c-58ac-4862-9b00-aa221a388010"
82+
}
83+
]
84+
}
85+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
{
2+
"@context": {
3+
"site": "http://example.com/",
4+
"site-cd": "site:site-schema/content-deployment/",
5+
"title": {
6+
"@id": "site-cd:node/article/title",
7+
"@container": "@annotation"
8+
},
9+
"body": {
10+
"@id": "site-cd:node/article/body",
11+
"@container": "@annotation"
12+
},
13+
"field_tags": {
14+
"@id": "site-cd:node/article/field_tags",
15+
"@container": "@annotation"
16+
}
17+
},
18+
"@id": "site:node/1",
19+
"@type": "site-cd:node/article",
20+
"title": {
21+
"en": {
22+
"@type": "site-cd:field-types/title_field",
23+
"title:/value": "This is the English title"
24+
},
25+
"es": {
26+
"@type": "site-cd:field-types/title_field",
27+
"title:/value": "Este es el t’tulo espa–ol"
28+
}
29+
},
30+
"body": {
31+
"en": {
32+
"@type": "site-cd:field-types/text_with_summary",
33+
"body:/value": "This is the English body. There is no Spanish body, so this will be displayed for both the English and Spanish versions.",
34+
"body:/summary": "This is the teaser for the body.",
35+
"body:/format": "full_html"
36+
}
37+
},
38+
"field_tags": {
39+
"en": {
40+
"@type": "site-cd:taxonomy/term",
41+
"@id": "site:taxonomy/term/1",
42+
"site-cd:taxonomy/term/uuid": "e34b982c-98ac-4862-9b00-fa771a388010"
43+
},
44+
"es": [
45+
{
46+
"@type": "site-cd:taxonomy/term",
47+
"@id": "site:taxonomy/term/1",
48+
"site-cd:taxonomy/term/uuid": "e34b982c-98ac-4862-9b00-fa771a388010"
49+
},
50+
{
51+
"@type": "site-cd:taxonomy/term",
52+
"@id": "site:taxonomy/term/2",
53+
"site-cd:taxonomy/term/uuid": "a55b982c-58ac-4862-9b00-aa221a388010"
54+
}
55+
]
56+
}
57+
}

test-suite/tests/compact-manifest.jsonld

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -228,5 +228,11 @@
228228
"input": "compact-0037-in.jsonld",
229229
"context": "compact-0037-context.jsonld",
230230
"expect": "compact-0037-out.jsonld"
231+
}, {
232+
"@type": ["test:TestCase", "jld:CompactTest"],
233+
"name": "Annotation map round-tripping (Drupal content deployment)",
234+
"input": "compact-0038-in.jsonld",
235+
"context": "compact-0038-context.jsonld",
236+
"expect": "compact-0038-out.jsonld"
231237
}]
232238
}

0 commit comments

Comments
 (0)