GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Handle `@version` context entries · jsonld-java/jsonld-java@0f439dc

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • core/src/main/java/com/github/jsonldjava/core
    • Context.java
    • JsonLdConsts.java
    • JsonLdError.java
    • JsonLdOptions.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎core/src/main/java/com/github/jsonldjava/core/Context.java‎

Copy file name to clipboardExpand all lines: core/src/main/java/com/github/jsonldjava/core/Context.java
+13-1Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,18 @@ else if (context instanceof String) {
215215
// 3.3
216216
throw new JsonLdError(Error.INVALID_LOCAL_CONTEXT, context);
217217
}
218+
// 5.5 in 1.1 (https://w3c.github.io/json-ld-api/#context-processing-algorithm)
219+
if (((Map<String, Object>) context).containsKey(JsonLdConsts.VERSION)) {
220+
final Object version = ((Map<String, Object>) context).get(JsonLdConsts.VERSION);
221+
// 5.5.1
222+
if(!version.equals(Double.valueOf(1.1))) {
223+
throw new JsonLdError(Error.INVALID_VERSION_VALUE, context);
224+
}
225+
// 5.5.2
226+
if(options.getProcessingMode().equals(JsonLdOptions.JSON_LD_1_0)) {
227+
throw new JsonLdError(Error.PROCESSING_MODE_CONFLICT, context);
228+
}
229+
}
218230
checkEmptyKey((Map<String, Object>) context);
219231
// 3.4
220232
if (!parsingARemoteContext
@@ -277,7 +289,7 @@ else if (context instanceof String) {
277289
final Map<String, Boolean> defined = new LinkedHashMap<String, Boolean>();
278290
for (final String key : ((Map<String, Object>) context).keySet()) {
279291
if (JsonLdConsts.BASE.equals(key) || JsonLdConsts.VOCAB.equals(key)
280-
|| JsonLdConsts.LANGUAGE.equals(key)) {
292+
|| JsonLdConsts.LANGUAGE.equals(key) || JsonLdConsts.VERSION.equals(key)) {
281293
continue;
282294
}
283295
result.createTermDefinition((Map<String, Object>) context, key, defined);
Collapse file

‎core/src/main/java/com/github/jsonldjava/core/JsonLdConsts.java‎

Copy file name to clipboardExpand all lines: core/src/main/java/com/github/jsonldjava/core/JsonLdConsts.java
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public final class JsonLdConsts {
5858
public static final String VOCAB = "@vocab";
5959
public static final String BASE = "@base";
6060
public static final String REQUIRE_ALL = "@requireAll";
61+
public static final String VERSION = "@version";
6162

6263
public enum Embed {
6364
ALWAYS, NEVER, LAST, LINK;
Collapse file

‎core/src/main/java/com/github/jsonldjava/core/JsonLdError.java‎

Copy file name to clipboardExpand all lines: core/src/main/java/com/github/jsonldjava/core/JsonLdError.java
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ public enum Error {
102102

103103
INVALID_EMBED_VALUE("invalid @embed value"),
104104

105+
INVALID_VERSION_VALUE("invalid @version value"),
106+
107+
PROCESSING_MODE_CONFLICT("processing mode conflict"),
108+
105109
// non spec related errors
106110
SYNTAX_ERROR("syntax error"),
107111

Collapse file

‎core/src/main/java/com/github/jsonldjava/core/JsonLdOptions.java‎

Copy file name to clipboardExpand all lines: core/src/main/java/com/github/jsonldjava/core/JsonLdOptions.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public JsonLdOptions copy() {
8686
/**
8787
* http://www.w3.org/TR/json-ld-api/#widl-JsonLdOptions-processingMode
8888
*/
89-
private String processingMode = JSON_LD_1_0;
89+
private String processingMode = JSON_LD_1_1;
9090
/**
9191
* http://www.w3.org/TR/json-ld-api/#widl-JsonLdOptions-documentLoader
9292
*/

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.