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
Copy file name to clipboardExpand all lines: README.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -167,6 +167,7 @@ The following overriding constraints apply only for compatibility with RDF:
167
167
* The public identifier of keys *MUST* be able to be transformed into an IRI as follows:
168
168
* It it already an IRI by itself (no transformation necessary).
169
169
* It forms an IRI when appended to the public identifier of the annotation data set. If identifier of the annotation data set does not end in `/` or `#`, an extra `/`*SHOULD* be inserted as delimiter in the concatenation.
170
+
* An exception to this rule is if the intended output is JSON-LD. A dataset identifier *MAY* be explicitly exempted via a parameter and keys *SHOULD* then be propagated as-is (they may function as aliases) and it is up to the JSON-LD context to resolve them.
170
171
* There *SHOULD* be a public identifier for each `Annotation`
Copy file name to clipboardExpand all lines: extensions/stam-webannotations/README.md
+40-38Lines changed: 40 additions & 38 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -56,6 +56,8 @@ the JSON-LD file then correspond one-to-one to the STAM datakeys in the set.
56
56
This allows us to use much of the web annotation vocabulary from STAM without
57
57
any complicated mappings. We will refer to this as the w3anno set in this
58
58
documentation, simply to avoid having to mention the full URI every time.
59
+
The full mechanism that enables this behaviour is explained in the section on
60
+
referencing external resources and using JSON-LD contexts.
59
61
60
62
Let's illustrate this with an example. Consider the following STAM
61
63
Annotation in STAM JSON (partial excerpt) in which we express an annotation
@@ -400,7 +402,7 @@ A `MultiSelector` *MAY* also be mapped simply to multiple `target` elements in
400
402
the WebAnnotation output. Recall that this means that the annotation applies to
401
403
all of targets equally, individually and independently.
402
404
403
-
### Referencing external resources and interpreting JSON-LD contexts
405
+
### Referencing external resources and using JSON-LD contexts
404
406
405
407
A lot of the value in using linked data comes from the ability to actually
406
408
*link* to external resources, which may live anywhere and are identified by an
@@ -413,12 +415,32 @@ If we convert from STAM to Web Annotations, the distinction between
413
415
IRIs and string literals becomes important again. Fortunately, the JSON-LD
414
416
serialization solves this problem for us. JSON by itself does
415
417
not have the distinction either, but the JSON-LD context adds these semantics.
416
-
When converting from STAM to Web Annotations, users *SHOULD* be able to specify
417
-
additional JSON-LD contexts with are then added to the `@context` part of the
418
-
output. For this to work, the converter *SHOULD* parse the specified JSON-LD
419
-
contexts and use the aliases defined in it.
420
418
421
-
If this is to abstract, consider the following STAM JSON example (partial excerpt):
419
+
For this to work a STAM to Web Annotation converter *SHOULD* accept the following parameter:
420
+
421
+
* one or **JSON-LD Context URL**s: This will be propagated directly to the `@context` portion of the output.
422
+
The converter is *NOT REQUIRED* to actually parse and interpret the JSON-LD context.
423
+
424
+
The URL to a JSON-LD context doubles as STAM dataset identifier: Any STAM dataset
425
+
passed via this parameter *MUST* have its keys directly passed as-is, as if
426
+
they are aliases. There is one exception: this *MUST NOT* be applies to keys that are already full IRIs.
427
+
That means the standard rules for forming IRIs by concatenating the dataset ID (if an IRI)
428
+
and the key ID (if not an IRI) will be bypassed in this case.
429
+
430
+
The `http://www.w3.org/ns/anno.jsonld` context *MUST* be implied already by
431
+
the converter and does not need to be passed explicitly. Converters *MAY* implement
432
+
an additional parameter (opt-in or opt-out) to automatically detect whether there are any used dataset
433
+
IDs ending in `.json` or `.jsonld` and add them to this list. This simplifies things for the caller.
434
+
435
+
It is always the responsibility of the caller (not the converter) to ensure
436
+
that the keys from these datasets are indeed defined as aliases in the JSON-LD
437
+
context. If this is not the case, then the resulting JSON-LD output can contain
438
+
aliases that do not expand to IRIs and therefore are not valid RDF. It is also
439
+
the responsibility of the caller to ensure that keys from multiple such
440
+
datasets do not conflict, as this effectively strips the namespace function
441
+
datasets normally fulfill.
442
+
443
+
This can all sound rather abstract, so let's illustrate it with the following STAM JSON example (partial excerpt):
422
444
423
445
```json
424
446
{
@@ -427,7 +449,7 @@ If this is to abstract, consider the following STAM JSON example (partial excerp
427
449
"data": [
428
450
{
429
451
"@type": "AnnotationData",
430
-
"set": "https://example.org/my_vocab"
452
+
"set": "https://example.org/my_vocab.jsonld"
431
453
"key": "review",
432
454
"value": "https://example.org/my_review",
433
455
},
@@ -438,27 +460,25 @@ If this is to abstract, consider the following STAM JSON example (partial excerp
438
460
}
439
461
```
440
462
441
-
This translates to the following web annotation (partial excerpt) in JSON-LD:
463
+
This translates to the following web annotation (partial excerpt) in JSON-LD, provided that we explicitly pass `https://example.org/my_vocab.jsonld` as parameter to the converter, telling it to add it to the context:
0 commit comments