Skip to content

Commit 90ddeb7

Browse files
committed
Automated cleanup and bump dependencies
Signed-off-by: Peter Ansell <p_ansell@yahoo.com>
1 parent b1b2ea6 commit 90ddeb7

File tree

6 files changed

+56
-51
lines changed

6 files changed

+56
-51
lines changed

README.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ From Maven
1616
<dependency>
1717
<groupId>com.github.jsonld-java</groupId>
1818
<artifactId>jsonld-java</artifactId>
19-
<version>0.12.0</version>
19+
<version>0.12.1</version>
2020
</dependency>
2121

2222
Code example
2323
------------
24+
2425
```java
2526
// Open a valid json(-ld) input file
2627
InputStream inputStream = new FileInputStream("input.json");
@@ -38,12 +39,12 @@ Object compact = JsonLdProcessor.compact(jsonObject, context, options);
3839
// Print out the result (or don't, it's your call!)
3940
System.out.println(JsonUtils.toPrettyString(compact));
4041
```
42+
4143
Processor options
4244
-----------------
4345

4446
The Options specified by the [JSON-LD API Specification](https://json-ld.org/spec/latest/json-ld-api/#the-jsonldoptions-type) are accessible via the `com.github.jsonldjava.core.JsonLdOptions` class, and each `JsonLdProcessor.*` function has an optional input to take an instance of this class.
4547

46-
4748
Controlling network traffic
4849
---------------------------
4950

@@ -59,7 +60,6 @@ The default HTTP Client is wrapped with a
5960
[CachingHttpClient](https://hc.apache.org/httpcomponents-client-ga/httpclient-cache/apidocs/org/apache/http/impl/client/cache/CachingHttpClient.html) to provide a
6061
small memory-based cache (1000 objects, max 128 kB each) of regularly accessed contexts.
6162

62-
6363
### Loading contexts from classpath
6464

6565
Your application might be parsing JSONLD documents which always use the same
@@ -321,9 +321,9 @@ Here is the basic outline for what your module's pom.xml should look like
321321
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
322322

323323
<parent>
324-
<artifactId>jsonld-java-integration</artifactId>
325-
<groupId>com.github.jsonld-java-parent</groupId>
326-
<version>0.11.0-SNAPSHOT</version>
324+
<groupId>com.github.jsonld-java</groupId>
325+
<artifactId>jsonld-java-parent</artifactId>
326+
<version>0.12.1-SNAPSHOT</version>
327327
</parent>
328328
<modelVersion>4.0.0</modelVersion>
329329
<artifactId>jsonld-java-{your module}</artifactId>
@@ -449,10 +449,11 @@ Alternatively, we can also host your repository in the jsonld-java organisation
449449
CHANGELOG
450450
=========
451451

452-
### 2018-07-07
453-
* make pruneBlankNodeIdentifiers false by default in 1.0 mode and always true in 1.1 mode
454-
* fix issue with blank node identifier pruning when @id is aliased
455-
* allow wildcard {} for @id in framing
452+
### 2018-09-05
453+
* Release 0.12.1
454+
* Make pruneBlankNodeIdentifiers false by default in 1.0 mode and always true in 1.1 mode (Patch by @eroux)
455+
* Fix issue with blank node identifier pruning when @id is aliased (Patch by @eroux)
456+
* Allow wildcard {} for @id in framing (Patch by @eroux)
456457

457458
### 2018-07-07
458459
* Fix tests setup for schema.org with HttpURLConnection that break because of the inability of HttpURLConnection to redirect from HTTP to HTTPS

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

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ public Object compact(Context activeCtx, String activeProperty, Object element,
271271
}
272272
if (value instanceof List) {
273273
((List<Object>) result.get(property))
274-
.addAll((List<Object>) value);
274+
.addAll((List<Object>) value);
275275
} else {
276276
((List<Object>) result.get(property)).add(value);
277277
}
@@ -373,7 +373,7 @@ else if (JsonLdConsts.INDEX.equals(expandedProperty)
373373
// true
374374
activeCtx.compactIri(JsonLdConsts.INDEX, true),
375375
((Map<String, Object>) expandedItem)
376-
.get(JsonLdConsts.INDEX));
376+
.get(JsonLdConsts.INDEX));
377377
}
378378
}
379379
// 7.6.4.3)
@@ -398,7 +398,7 @@ else if (result.containsKey(itemActiveProperty)) {
398398
// 7.6.5.2)
399399
if (JsonLdConsts.LANGUAGE.equals(container) && (compactedItem instanceof Map
400400
&& ((Map<String, Object>) compactedItem)
401-
.containsKey(JsonLdConsts.VALUE))) {
401+
.containsKey(JsonLdConsts.VALUE))) {
402402
compactedItem = ((Map<String, Object>) compactedItem)
403403
.get(JsonLdConsts.VALUE);
404404
}
@@ -443,7 +443,7 @@ else if (result.containsKey(itemActiveProperty)) {
443443
}
444444
if (compactedItem instanceof List) {
445445
((List<Object>) result.get(itemActiveProperty))
446-
.addAll((List<Object>) compactedItem);
446+
.addAll((List<Object>) compactedItem);
447447
} else {
448448
((List<Object>) result.get(itemActiveProperty)).add(compactedItem);
449449
}
@@ -721,7 +721,7 @@ else if (JsonLdConsts.REVERSE.equals(expandedProperty)) {
721721
// 7.4.11.2.2)
722722
if (item instanceof List) {
723723
((List<Object>) result.get(property))
724-
.addAll((List<Object>) item);
724+
.addAll((List<Object>) item);
725725
} else {
726726
((List<Object>) result.get(property)).add(item);
727727
}
@@ -752,7 +752,7 @@ else if (JsonLdConsts.REVERSE.equals(expandedProperty)) {
752752
if (item instanceof Map && (((Map<String, Object>) item)
753753
.containsKey(JsonLdConsts.VALUE)
754754
|| ((Map<String, Object>) item)
755-
.containsKey(JsonLdConsts.LIST))) {
755+
.containsKey(JsonLdConsts.LIST))) {
756756
throw new JsonLdError(Error.INVALID_REVERSE_PROPERTY_VALUE);
757757
}
758758
// 7.4.11.3.3.1.2)
@@ -893,7 +893,7 @@ else if (JsonLdConsts.INDEX.equals(activeCtx.getContainer(key))
893893
// 7.10.4.3)
894894
if (item instanceof List) {
895895
((List<Object>) reverseMap.get(expandedProperty))
896-
.addAll((List<Object>) item);
896+
.addAll((List<Object>) item);
897897
} else {
898898
((List<Object>) reverseMap.get(expandedProperty)).add(item);
899899
}
@@ -908,7 +908,7 @@ else if (JsonLdConsts.INDEX.equals(activeCtx.getContainer(key))
908908
// 7.11.2)
909909
if (expandedValue instanceof List) {
910910
((List<Object>) result.get(expandedProperty))
911-
.addAll((List<Object>) expandedValue);
911+
.addAll((List<Object>) expandedValue);
912912
} else {
913913
((List<Object>) result.get(expandedProperty)).add(expandedValue);
914914
}
@@ -1044,7 +1044,7 @@ void generateNodeMap(Object element, Map<String, Object> nodeMap, String activeG
10441044

10451045
void generateNodeMap(Object element, Map<String, Object> nodeMap, String activeGraph,
10461046
Object activeSubject, String activeProperty, Map<String, Object> list)
1047-
throws JsonLdError {
1047+
throws JsonLdError {
10481048
// 1)
10491049
if (element instanceof List) {
10501050
// 1.1)
@@ -1720,7 +1720,8 @@ private boolean filterNode(FramingContext state, Map<String, Object> node,
17201720
if (JsonLdUtils.deepCompare(nodeId, frameIds)) {
17211721
return true;
17221722
}
1723-
} else if (frameIds instanceof LinkedHashMap && ((LinkedHashMap) frameIds).size() == 0) {
1723+
} else if (frameIds instanceof LinkedHashMap
1724+
&& ((LinkedHashMap) frameIds).size() == 0) {
17241725
if (node.containsKey(JsonLdConsts.ID)) {
17251726
return true;
17261727
}
@@ -2006,7 +2007,7 @@ public List<Object> fromRDF(final RDFDataset dataset, boolean noDuplicatesInData
20062007
if (object.isBlankNode() || object.isIRI()) {
20072008
// 3.5.8.1-3)
20082009
nodeMap.get(object.getValue()).usages
2009-
.add(new UsagesNode(node, predicate, value));
2010+
.add(new UsagesNode(node, predicate, value));
20102011
}
20112012
}
20122013
}
@@ -2206,7 +2207,7 @@ public Object normalize(Map<String, Object> dataset) throws JsonLdError {
22062207
});
22072208
}
22082209
((List<Object>) ((Map<String, Object>) bnodes.get(id)).get("quads"))
2209-
.add(quad);
2210+
.add(quad);
22102211
}
22112212
}
22122213
}

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

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,7 @@ public static boolean isRelativeIri(String value) {
184184
}
185185

186186
/**
187-
* Removes the @preserve keywords as the last
188-
* step of the framing algorithm.
187+
* Removes the @preserve keywords as the last step of the framing algorithm.
189188
*
190189
* @param ctx
191190
* the active context used to compact the input.
@@ -225,15 +224,14 @@ static Object removePreserve(Context ctx, Object input, JsonLdOptions opts) thro
225224

226225
// recurse through @lists
227226
if (isList(input)) {
228-
((Map<String, Object>) input).put("@list", removePreserve(ctx,
229-
((Map<String, Object>) input).get("@list"), opts));
227+
((Map<String, Object>) input).put("@list",
228+
removePreserve(ctx, ((Map<String, Object>) input).get("@list"), opts));
230229
return input;
231230
}
232231

233232
// recurse through properties
234233
for (final String prop : ((Map<String, Object>) input).keySet()) {
235-
Object result = removePreserve(ctx, ((Map<String, Object>) input).get(prop),
236-
opts);
234+
Object result = removePreserve(ctx, ((Map<String, Object>) input).get(prop), opts);
237235
final String container = ctx.getContainer(prop);
238236
if (opts.getCompactArrays() && isArray(result)
239237
&& ((List<Object>) result).size() == 1 && container == null) {
@@ -246,21 +244,22 @@ static Object removePreserve(Context ctx, Object input, JsonLdOptions opts) thro
246244
}
247245

248246
/**
249-
* Removes the @id member of each node object where the member value
250-
* is a blank node identifier which appears only once in any property
251-
* value within input.
247+
* Removes the @id member of each node object where the member value is a
248+
* blank node identifier which appears only once in any property value
249+
* within input.
252250
*
253251
* @param input
254252
* the framed output before compaction
255253
*/
256254

257255
static void pruneBlankNodes(final Object input) {
258-
final Map<String,Object> toPrune = new HashMap<>();
256+
final Map<String, Object> toPrune = new HashMap<>();
259257
fillNodesToPrune(input, toPrune);
260258
for (final String id : toPrune.keySet()) {
261259
final Object node = toPrune.get(id);
262-
if (node == null)
260+
if (node == null) {
263261
continue;
262+
}
264263
((Map<String, Object>) node).remove(JsonLdConsts.ID);
265264
}
266265
}
@@ -273,7 +272,7 @@ static void pruneBlankNodes(final Object input) {
273272
* @param toPrune
274273
* the resulting object.
275274
*/
276-
static void fillNodesToPrune(Object input, final Map<String,Object> toPrune) {
275+
static void fillNodesToPrune(Object input, final Map<String, Object> toPrune) {
277276
// recurse through arrays
278277
if (isArray(input)) {
279278
for (final Object i : (List<Object>) input) {
@@ -294,7 +293,8 @@ static void fillNodesToPrune(Object input, final Map<String,Object> toPrune) {
294293
if (prop.equals(JsonLdConsts.ID)) {
295294
final String id = (String) ((Map<String, Object>) input).get(JsonLdConsts.ID);
296295
if (id.startsWith("_:")) {
297-
// if toPrune contains the id already, it was already present somewhere else,
296+
// if toPrune contains the id already, it was already
297+
// present somewhere else,
298298
// so we just null the value
299299
if (toPrune.containsKey(id)) {
300300
toPrune.put(id, null);
@@ -308,11 +308,14 @@ static void fillNodesToPrune(Object input, final Map<String,Object> toPrune) {
308308
}
309309
}
310310
} else if (input instanceof String) {
311-
// this is an id, as non-id values will have been discarded by the isValue() above
311+
// this is an id, as non-id values will have been discarded by the
312+
// isValue() above
312313
final String p = (String) input;
313314
if (p.startsWith("_:")) {
314-
// the id is outside of the context of an @id property, if we're in that case,
315-
// then we're referencing a blank node id so this id should not be removed
315+
// the id is outside of the context of an @id property, if we're
316+
// in that case,
317+
// then we're referencing a blank node id so this id should not
318+
// be removed
316319
toPrune.put(p, null);
317320
}
318321
}
@@ -372,7 +375,7 @@ static boolean compareValues(Object v1, Object v2) {
372375
if ((v1 instanceof Map && ((Map<String, Object>) v1).containsKey("@id"))
373376
&& (v2 instanceof Map && ((Map<String, Object>) v2).containsKey("@id"))
374377
&& ((Map<String, Object>) v1).get("@id")
375-
.equals(((Map<String, Object>) v2).get("@id"))) {
378+
.equals(((Map<String, Object>) v2).get("@id"))) {
376379
return true;
377380
}
378381

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -140,17 +140,17 @@ public void testFrame0008() throws IOException, JsonLdError {
140140

141141
@Test
142142
public void testFramep050() throws IOException, JsonLdError {
143-
final Object frame = JsonUtils
144-
.fromInputStream(getClass().getResourceAsStream("/json-ld.org/frame-p050-frame.jsonld"));
145-
final Object in = JsonUtils
146-
.fromInputStream(getClass().getResourceAsStream("/json-ld.org/frame-p050-in.jsonld"));
143+
final Object frame = JsonUtils.fromInputStream(
144+
getClass().getResourceAsStream("/json-ld.org/frame-p050-frame.jsonld"));
145+
final Object in = JsonUtils.fromInputStream(
146+
getClass().getResourceAsStream("/json-ld.org/frame-p050-in.jsonld"));
147147

148148
final JsonLdOptions opts = new JsonLdOptions();
149149
opts.setProcessingMode("json-ld-1.1");
150150
final Map<String, Object> frame2 = JsonLdProcessor.frame(in, frame, opts);
151151

152-
final Object out = JsonUtils
153-
.fromInputStream(getClass().getResourceAsStream("/json-ld.org/frame-p050-out.jsonld"));
152+
final Object out = JsonUtils.fromInputStream(
153+
getClass().getResourceAsStream("/json-ld.org/frame-p050-out.jsonld"));
154154
assertEquals(out, frame2);
155155
}
156156

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ public void runTest() throws URISyntaxException, IOException, JsonLdError {
552552
{
553553
put("@id",
554554
"http://json-ld.org/test-suite/tests/error-expand-manifest.jsonld"
555-
.equals(manifest) ? "earl:semiAuto" : "earl:automatic");
555+
.equals(manifest) ? "earl:semiAuto" : "earl:automatic");
556556
}
557557
});
558558
}

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
4040
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
4141

42-
<httpclient.version>4.5.5</httpclient.version>
42+
<httpclient.version>4.5.6</httpclient.version>
4343
<httpcore.version>4.4.10</httpcore.version>
4444
<jackson.version>2.9.6</jackson.version>
4545
<junit.version>4.12</junit.version>
@@ -197,7 +197,7 @@
197197
<dependency>
198198
<groupId>org.mockito</groupId>
199199
<artifactId>mockito-core</artifactId>
200-
<version>2.19.0</version>
200+
<version>2.21.0</version>
201201
</dependency>
202202
<dependency>
203203
<groupId>commons-io</groupId>
@@ -209,7 +209,7 @@
209209
<dependency>
210210
<groupId>com.google.guava</groupId>
211211
<artifactId>guava</artifactId>
212-
<version>25.1-jre</version>
212+
<version>26.0-jre</version>
213213
</dependency>
214214
</dependencies>
215215
</dependencyManagement>
@@ -400,7 +400,7 @@
400400
<plugin>
401401
<groupId>com.github.siom79.japicmp</groupId>
402402
<artifactId>japicmp-maven-plugin</artifactId>
403-
<version>0.12.0</version>
403+
<version>0.13.0</version>
404404
<configuration>
405405
<oldVersion>
406406
<dependency>
@@ -436,7 +436,7 @@
436436
<plugin>
437437
<groupId>org.apache.felix</groupId>
438438
<artifactId>maven-bundle-plugin</artifactId>
439-
<version>3.5.0</version>
439+
<version>3.5.1</version>
440440
</plugin>
441441
<!-- Create code coverage reports and submit them to coveralls.io. -->
442442
<plugin>

0 commit comments

Comments
 (0)