Skip to content

Commit 18f2ea1

Browse files
committed
Ensure that annotations are preserved if not compacted to an annotation map
This addresses #196.
1 parent e21cca4 commit 18f2ea1

File tree

4 files changed

+215
-0
lines changed

4 files changed

+215
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"@context": {
3+
"property": "http://example.com/property",
4+
"annotContainer": { "@id": "http://example.com/container", "@container": "@annotation" }
5+
}
6+
}
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
[
2+
{
3+
"@id": "http://example.org/annotationsTest",
4+
"http://example.com/container": [
5+
{
6+
"@id": "http://example.org/nodeWithoutAnnotationA",
7+
"@annotation": "A"
8+
},
9+
{
10+
"@id": "http://example.org/nodeWithAnnotationA",
11+
"@annotation": "this overrides the 'A' annotation from the container"
12+
},
13+
{
14+
"@value": 1,
15+
"@annotation": "A"
16+
},
17+
{
18+
"@value": true,
19+
"@annotation": "A"
20+
},
21+
{
22+
"@value": false,
23+
"@annotation": "A"
24+
},
25+
{
26+
"@value": "simple string A",
27+
"@annotation": "A"
28+
},
29+
{
30+
"@value": "typed literal A",
31+
"@type": "http://example.org/type",
32+
"@annotation": "A"
33+
},
34+
{
35+
"@value": "language-tagged string A",
36+
"@language": "en",
37+
"@annotation": "A"
38+
},
39+
{
40+
"@value": "simple string B",
41+
"@annotation": "B"
42+
},
43+
{
44+
"@id": "http://example.org/nodeWithoutAnnotationC",
45+
"@annotation": "C"
46+
},
47+
{
48+
"@id": "http://example.org/nodeWithAnnotationC",
49+
"@annotation": "this overrides the 'C' annotation from the container"
50+
},
51+
{
52+
"@value": 3,
53+
"@annotation": "C"
54+
},
55+
{
56+
"@value": true,
57+
"@annotation": "C"
58+
},
59+
{
60+
"@value": false,
61+
"@annotation": "C"
62+
},
63+
{
64+
"@value": "simple string C",
65+
"@annotation": "C"
66+
},
67+
{
68+
"@value": "typed literal C",
69+
"@type": "http://example.org/type",
70+
"@annotation": "C"
71+
},
72+
{
73+
"@value": "language-tagged string C",
74+
"@language": "en",
75+
"@annotation": "C"
76+
}
77+
],
78+
"http://example.com/property": [
79+
{
80+
"@id": "http://example.org/nodeWithoutAnnotationProp"
81+
},
82+
{
83+
"@id": "http://example.org/nodeWithAnnotationProp",
84+
"@annotation": "prop"
85+
},
86+
{
87+
"@value": 3,
88+
"@annotation": "prop"
89+
},
90+
{
91+
"@value": true,
92+
"@annotation": "prop"
93+
},
94+
{
95+
"@value": false,
96+
"@annotation": "prop"
97+
},
98+
{
99+
"@value": "simple string no annotation"
100+
},
101+
{
102+
"@value": "typed literal Prop",
103+
"@type": "http://example.org/type",
104+
"@annotation": "prop"
105+
},
106+
{
107+
"@value": "language-tagged string Prop",
108+
"@language": "en",
109+
"@annotation": "prop"
110+
},
111+
{
112+
"@value": "annotation using an array with just one element (automatic recovery)",
113+
"@annotation": "prop"
114+
}
115+
]
116+
}
117+
]
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
{
2+
"@context": {
3+
"property": "http://example.com/property",
4+
"annotContainer": { "@id": "http://example.com/container", "@container": "@annotation" }
5+
},
6+
"@id": "http://example.org/annotationsTest",
7+
"annotContainer": {
8+
"A": [
9+
{
10+
"@id": "http://example.org/nodeWithoutAnnotationA"
11+
},
12+
1,
13+
true,
14+
false,
15+
"simple string A",
16+
{
17+
"@value": "typed literal A",
18+
"@type": "http://example.org/type"
19+
},
20+
{
21+
"@value": "language-tagged string A",
22+
"@language": "en"
23+
}
24+
],
25+
"this overrides the 'A' annotation from the container": {
26+
"@id": "http://example.org/nodeWithAnnotationA"
27+
},
28+
"B": "simple string B",
29+
"C": [
30+
{
31+
"@id": "http://example.org/nodeWithoutAnnotationC"
32+
},
33+
3,
34+
true,
35+
false,
36+
"simple string C",
37+
{
38+
"@value": "typed literal C",
39+
"@type": "http://example.org/type"
40+
},
41+
{
42+
"@value": "language-tagged string C",
43+
"@language": "en"
44+
}
45+
],
46+
"this overrides the 'C' annotation from the container": {
47+
"@id": "http://example.org/nodeWithAnnotationC"
48+
}
49+
},
50+
"property": [
51+
{
52+
"@id": "http://example.org/nodeWithoutAnnotationProp"
53+
},
54+
{
55+
"@id": "http://example.org/nodeWithAnnotationProp",
56+
"@annotation": "prop"
57+
},
58+
{
59+
"@value": 3,
60+
"@annotation": "prop"
61+
},
62+
{
63+
"@value": true,
64+
"@annotation": "prop"
65+
},
66+
{
67+
"@value": false,
68+
"@annotation": "prop"
69+
},
70+
"simple string no annotation",
71+
{
72+
"@value": "typed literal Prop",
73+
"@type": "http://example.org/type",
74+
"@annotation": "prop"
75+
},
76+
{
77+
"@value": "language-tagged string Prop",
78+
"@language": "en",
79+
"@annotation": "prop"
80+
},
81+
{
82+
"@value": "annotation using an array with just one element (automatic recovery)",
83+
"@annotation": "prop"
84+
}
85+
]
86+
}

test-suite/tests/compact-manifest.jsonld

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,5 +180,11 @@
180180
"input": "compact-0029-in.jsonld",
181181
"context": "compact-0029-context.jsonld",
182182
"expect": "compact-0029-out.jsonld"
183+
}, {
184+
"@type": ["test:TestCase", "jld:CompactTest"],
185+
"name": "Preserve @annotation tags if not compacted to an annotation map",
186+
"input": "compact-0030-in.jsonld",
187+
"context": "compact-0030-context.jsonld",
188+
"expect": "compact-0030-out.jsonld"
183189
}]
184190
}

0 commit comments

Comments
 (0)