You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// GK: Note, the context needs to be resolved against the location of the file containing the reference, not the base association from the context. The spec defines a `context base` for this purpose.
191
196
uri = JsonLdUrl.resolve(uri, (String) context);
192
197
// 3.2.2
193
198
if (remoteContexts.contains(uri)) {
@@ -273,6 +278,8 @@ else if (context instanceof String) {
273
278
}
274
279
}
275
280
281
+
// GK: There are more keys to be checked: `@import`, `@direction`, `@propagate` and `@version`.
282
+
// GK: You'll want some `processingMode` method to use when doing conditional checks; default value is `json-ld-1.1`, but can be overridden using an API option.
276
283
// 3.7
277
284
finalMap<String, Boolean> defined = newLinkedHashMap<String, Boolean>();
278
285
for (finalStringkey : ((Map<String, Object>) context).keySet()) {
// GK: Note, `@type` can also contain `@protected` in addition to `@container`. If `@container` is there, its value can only be `@set` (or `['@set']`).
// GK: Note, you'll need to retain any previous definition to make sure, if protected, that any new definition is compatible with it before ending this method.
// GK: Note, there are some required checks to be sure that if the associated term expands to an IRI, it is compatible with `@id` and some other checks.
418
428
if (val.get(JsonLdConsts.ID) != null && !term.equals(val.get(JsonLdConsts.ID))) {
419
429
if (!(val.get(JsonLdConsts.ID) instanceofString)) {
420
430
thrownewJsonLdError(Error.INVALID_IRI_MAPPING,
@@ -458,6 +468,7 @@ else if (term.indexOf(":") >= 0) {
458
468
}
459
469
460
470
// 16)
471
+
// GK: Note, `@container` can take on many more values, and be an array. Best always cast to an array and check to see if the container includes any useful value. There are also some checks to make sure that the content of `@context` is consistent.
if (!JsonLdConsts.LIST.equals(container) && !JsonLdConsts.SET.equals(container)
@@ -485,6 +496,8 @@ else if (term.indexOf(":") >= 0) {
485
496
}
486
497
}
487
498
499
+
// GK: Note, other keys to check for are `@index`, `@context` (which requires a recursive call to Context.parse to make sure it's valid), `@direction`, `@nest`, and `@prefix`.
500
+
// GK: Note, this is where to check if the previous definition exists and is protected, and we're not overriding protected, that the two definitions are essentially compatible.
// This would be the place to revert the active context from any previous type-scoped context if the active context has a `previousContext` entry (with some exceptions when called from a map, or if it's a value object or a subject reference).
551
+
// GK: If we found a `propertyScopedContext` above, we can parse it to create a new activeCtx using the `override protected` option
// GK: This is the place to check for a type-scoped context by checking any key that expands to `@type` to see the current context has a term that equals that key where the term definition includes `@context`, updating the activeCtx as you go (but using termScopedContext when checking the keys).
562
+
// GK: 1.1 made the following loop somewhat recursive, due to nesting, so might want to extract into a method.
557
563
for (finalStringkey : keys) {
558
564
finalObjectvalue = elem.get(key);
559
565
// 7.1)
@@ -766,6 +772,7 @@ else if (JsonLdConsts.REVERSE.equals(expandedProperty)) {
766
772
}
767
773
}
768
774
}
775
+
// GK: Also, `@included`, `@graph`, and `@direction`
769
776
// 7.4.11.4)
770
777
continue;
771
778
}
@@ -815,9 +822,12 @@ else if (JsonLdConsts.LANGUAGE.equals(activeCtx.getContainer(key))
815
822
}
816
823
}
817
824
// 7.6)
825
+
// GK: Also a place to see if key is `@json` for JSON literals.
0 commit comments