Skip to content

Commit 7c0cbaf

Browse files
committed
Addressed feedback
1 parent 99f8ae0 commit 7c0cbaf

File tree

4 files changed

+2
-36
lines changed

4 files changed

+2
-36
lines changed

core/src/main/java/com/github/jsonldjava/core/JsonLdProcessor.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,9 @@
22

33
import static com.github.jsonldjava.utils.Obj.newMap;
44

5-
import java.util.Arrays;
65
import java.util.ArrayList;
76
import java.util.Collections;
87
import java.util.LinkedHashMap;
9-
import java.util.LinkedList;
108
import java.util.List;
119
import java.util.Map;
1210

@@ -328,7 +326,7 @@ public static Map<String, Object> frame(Object input, Object frame, JsonLdOption
328326
final Map<String, Object> rval = newMap();
329327
final Object returnedContext = returnedContext(context, opts);
330328
if(returnedContext != null) {
331-
rval.put(JsonLdConsts.CONTEXT, context);
329+
rval.put(JsonLdConsts.CONTEXT, returnedContext);
332330
}
333331
final boolean addGraph = ((!(compacted instanceof List)) && !opts.getOmitGraph());
334332
if (addGraph && !(compacted instanceof List)) {

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

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414

1515
public class ContextCompactionTest {
1616

17-
// @Ignore("Disable until schema.org is fixed")
1817
@Test
19-
public void testCompaction() throws Exception {
18+
public void testCompaction() {
2019

2120
final Map<String, Object> contextAbbrevs = new HashMap<String, Object>();
2221
contextAbbrevs.put("so", "http://schema.org/");
@@ -36,16 +35,10 @@ public void testCompaction() throws Exception {
3635
options.setBase("http://schema.org/");
3736
options.setCompactArrays(true);
3837

39-
// System.out.println("Before compact");
40-
// System.out.println(JsonUtils.toPrettyString(json));
41-
4238
final List<String> newContexts = new LinkedList<String>();
4339
newContexts.add("http://schema.org/");
4440
final Map<String, Object> compacted = JsonLdProcessor.compact(json, newContexts, options);
4541

46-
// System.out.println("\n\nAfter compact:");
47-
// System.out.println(JsonUtils.toPrettyString(compacted));
48-
4942
assertTrue("Compaction removed the context", compacted.containsKey("@context"));
5043
assertFalse("Compaction of context should be a string, not a list",
5144
compacted.get("@context") instanceof List);
@@ -63,9 +56,6 @@ public void testCompactionSingleRemoteContext() throws Exception {
6356

6457
final Map<String, Object> compacted = JsonLdProcessor.compact(json, ctx, options);
6558

66-
// System.out.println("\n\nAfter compact:");
67-
// System.out.println(JsonUtils.toPrettyString(compacted));
68-
6959
assertEquals("Wrong returned context", "http://schema.org/", compacted.get("@context"));
7060
assertEquals("Wrong type", "Person", compacted.get("type"));
7161
assertEquals("Wrong number of Json entries",2, compacted.size());

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

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,11 @@ public void testFlatenning() throws Exception {
3535
options.setCompactArrays(true);
3636
options.setOmitGraph(true);
3737

38-
// System.out.println("Before flattening");
39-
// System.out.println(JsonUtils.toPrettyString(json));
40-
4138
final String flattenStr = "{\"@id\": \"http://schema.org/myid\", \"@context\": \"http://schema.org/\"}";
4239
final Object flatten = JsonUtils.fromString(flattenStr);
4340

4441
final Map<String, Object> flattened = ((Map<String, Object>)JsonLdProcessor.flatten(json, flatten, options));
4542

46-
// System.out.println("\n\nAfter flattening:");
47-
// System.out.println(JsonUtils.toPrettyString(flattened));
48-
4943
assertTrue("Flattening removed the context", flattened.containsKey("@context"));
5044
assertFalse("Flattening of context should be a string, not a list",
5145
flattened.get("@context") instanceof List);
@@ -60,17 +54,11 @@ public void testFlatteningRemoteContext() throws Exception {
6054
final Object json = JsonUtils.fromString(jsonString);
6155
final Object flatten = JsonUtils.fromString(flattenStr);
6256

63-
// System.out.println("Before flattening");
64-
// System.out.println(JsonUtils.toPrettyString(json));
65-
6657
final JsonLdOptions options = new JsonLdOptions();
6758
options.setOmitGraph(true);
6859

6960
final Map<String, Object> flattened = ((Map<String, Object>)JsonLdProcessor.flatten(json, flatten, options));
7061

71-
// System.out.println("\n\nAfter flattened:");
72-
// System.out.println(JsonUtils.toPrettyString(flattened));
73-
7462
assertEquals("Wrong returned context", "http://schema.org/", flattened.get("@context"));
7563
assertEquals("Wrong number of Json entries",2, flattened.size());
7664
}

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

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313

1414
public class ContextFramingTest {
1515

16-
// @Ignore("Disable until schema.org is fixed")
1716
@Test
1817
public void testFraming() throws Exception {
1918

@@ -36,17 +35,11 @@ public void testFraming() throws Exception {
3635
options.setCompactArrays(true);
3736
options.setOmitGraph(true);
3837

39-
// System.out.println("Before framing");
40-
// System.out.println(JsonUtils.toPrettyString(json));
41-
4238
final String frameStr = "{\"@id\": \"http://schema.org/myid\", \"@context\": \"http://schema.org/\"}";
4339
final Object frame = JsonUtils.fromString(frameStr);
4440

4541
final Map<String, Object> framed = JsonLdProcessor.frame(json, frame, options);
4642

47-
// System.out.println("\n\nAfter framing:");
48-
// System.out.println(JsonUtils.toPrettyString(framed));
49-
5043
assertTrue("Framing removed the context", framed.containsKey("@context"));
5144
assertFalse("Framing of context should be a string, not a list",
5245
framed.get("@context") instanceof List);
@@ -65,9 +58,6 @@ public void testFramingRemoteContext() throws Exception {
6558

6659
final Map<String, Object> framed = JsonLdProcessor.frame(json, frame, options);
6760

68-
// System.out.println("\n\nAfter framing:");
69-
// System.out.println(JsonUtils.toPrettyString(framed));
70-
7161
assertEquals("Wrong returned context", "http://schema.org/", framed.get("@context"));
7262
assertEquals("Wrong id", "schema:myid", framed.get("id"));
7363
assertEquals("Wrong type", "Person", framed.get("type"));

0 commit comments

Comments
 (0)