Skip to content

Commit e5af222

Browse files
committed
Provide a test for frames using @embed:@Always
This complements 4fe56fd and shows that #150 is indeed resolved.
1 parent 8b39230 commit e5af222

File tree

4 files changed

+64
-0
lines changed

4 files changed

+64
-0
lines changed

core/src/test/java/com/github/jsonldjava/core/JsonLdFramingTest.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,4 +123,21 @@ public void testFrame0007() throws IOException, JsonLdError {
123123
.fromInputStream(getClass().getResourceAsStream("/custom/frame-0007-out.jsonld"));
124124
assertEquals(out, frame2);
125125
}
126+
127+
@Test
128+
public void testFrame0008() throws IOException, JsonLdError {
129+
final Object frame = JsonUtils
130+
.fromInputStream(getClass().getResourceAsStream("/custom/frame-0008-frame.jsonld"));
131+
final Object in = JsonUtils
132+
.fromInputStream(getClass().getResourceAsStream("/custom/frame-0008-in.jsonld"));
133+
134+
JsonLdOptions opts = new JsonLdOptions();
135+
opts.setEmbed("@always");
136+
final Map<String, Object> frame2 = JsonLdProcessor.frame(in, frame, opts);
137+
138+
final Object out = JsonUtils
139+
.fromInputStream(getClass().getResourceAsStream("/custom/frame-0008-out.jsonld"));
140+
assertEquals(out, frame2);
141+
}
126142
}
143+
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"@context": {
3+
"dct": "http://purl.org/dc/terms/",
4+
"ex": "http://example.org/vocab#"
5+
},
6+
"@type": "ex:Biography"
7+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"@context": {
3+
"dct": "http://purl.org/dc/terms/",
4+
"ex": "http://example.org/vocab#"
5+
},
6+
"@graph": [
7+
{
8+
"@id": "http://lobid.org/resources/HT019277879",
9+
"@type": "ex:Biography",
10+
"dct:creator": {
11+
"@id" : "https://www.wikidata.org/entity/Q115211",
12+
"ex:name": "Harry Rowohlt"
13+
},
14+
"dct:subject": {
15+
"@id" : "https://www.wikidata.org/entity/Q115211",
16+
"ex:name": "Harry Rowohlt"
17+
}
18+
}
19+
]
20+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"@context": {
3+
"dct": "http://purl.org/dc/terms/",
4+
"ex": "http://example.org/vocab#"
5+
},
6+
"@graph": [
7+
{
8+
"@id": "http://lobid.org/resources/HT019277879",
9+
"@type": "ex:Biography",
10+
"dct:creator": {
11+
"@id" : "https://www.wikidata.org/entity/Q115211",
12+
"ex:name": "Harry Rowohlt"
13+
},
14+
"dct:subject": {
15+
"@id" : "https://www.wikidata.org/entity/Q115211",
16+
"ex:name": "Harry Rowohlt"
17+
}
18+
}
19+
]
20+
}

0 commit comments

Comments
 (0)