Add Annotation/Note shape (W3C Web Annotation Vocabulary)#61
Add Annotation/Note shape (W3C Web Annotation Vocabulary)#61jeswr wants to merge 3 commits intosolid:mainfrom
Conversation
Adds a SHACL shape for oa:Annotation covering the common note, bookmark, comment, and highlight cases. Grounded in the W3C Web Annotation Vocabulary (Recommendation, 2017). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Drop sh:in restriction on oa:motivatedBy so the shape does not reject conforming oa:Annotation instances that use motivations outside the common note-taking subset (e.g., oa:tagging, oa:replying). - Permit dct:creator as either a WebID IRI or an embedded agent description, matching the W3C Web Annotation Data Model. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Note in oa:bodyValue and oa:hasBody descriptions that the Web Annotation Data Model (§3.2.4) says an annotation SHOULD NOT have both. The shape stays permissive (interoperability first) but flags the constraint to consumers. - Drop sh:maxCount 1 on dct:creator since the Web Annotation Data Model permits multiple creators (co-creation). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Adds a new SHACL domain file to validate W3C Web Annotation (oa:Annotation) data commonly produced by note-taking/bookmarking/highlighting apps in Solid Pods.
Changes:
- Introduces
annotation_shape:AnnotationShapetargetingoa:Annotation. - Adds property constraints for body (
oa:bodyValue/oa:hasBody), target (oa:hasTarget), motivation (oa:motivatedBy), creator (dct:creator), and timestamps (dct:created/dct:modified). - Includes shape metadata (created date, term status, sources/references) aligned with repository validation scripts.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| sh:path oa:bodyValue ; | ||
| sh:datatype xsd:string ; | ||
| sh:maxCount 1 ; | ||
| sh:name "Body Value" ; | ||
| sh:description "Textual content of the annotation body, used for plain-text comments or notes (Web Annotation Vocabulary, oa:bodyValue). SHOULD NOT be combined with oa:hasBody on the same annotation." ; | ||
| sh:codeIdentifier "bodyValue"; |
There was a problem hiding this comment.
oa:bodyValue is constrained to xsd:string, which will fail validation for language-tagged literals (datatype rdf:langString) that are common for user-generated annotation text. Consider allowing both xsd:string and rdf:langString (e.g., with sh:or), or relaxing the datatype constraint to improve interoperability with Web Annotation data in the wild.
| sh:path oa:motivatedBy ; | ||
| sh:nodeKind sh:IRI ; | ||
| sh:name "Motivation" ; | ||
| sh:description "Why the annotation was created (Web Annotation Vocabulary, oa:Motivation). Common note-taking values are oa:bookmarking, oa:commenting, and oa:highlighting." ; |
There was a problem hiding this comment.
The oa:motivatedBy property description cites oa:Motivation (the class) even though the constraint is on oa:motivatedBy (the property). Updating the description to reference the property (and optionally the expected range) would avoid confusion for shape consumers.
| sh:description "Why the annotation was created (Web Annotation Vocabulary, oa:Motivation). Common note-taking values are oa:bookmarking, oa:commenting, and oa:highlighting." ; | |
| sh:description "Why the annotation was created (Web Annotation Vocabulary, oa:motivatedBy). Values are typically motivation IRIs such as oa:bookmarking, oa:commenting, and oa:highlighting." ; |
Type of Change
Domain
Shape Details
Shape Change
Description:
Adds a SHACL shape for
oa:Annotationgrounded in the W3CWeb Annotation Vocabulary
(Recommendation, 2017) and the
Web Annotation Data Model.
Constraints cover:
rdf:type(must includeoa:Annotation)oa:bodyValue(xsd:string, max 1) for inline textual bodiesoa:hasBody(IRI or blank node) for embedded or referenced bodiesoa:hasTarget(IRI or blank node, min 1)oa:motivatedBy(IRI) – kept open per the Web Annotation Vocabularymotivation set; descriptions cite the common note-taking values
(
oa:bookmarking,oa:commenting,oa:highlighting).dct:creator(IRI or blank node) – permits a WebID or an inlineagent description; cardinality left open to allow co-creation
dct:created,dct:modified(xsd:dateTime, max 1 each)Mutual exclusion of
oa:bodyValueandoa:hasBody(Data Model§3.2.4 SHOULD NOT) is documented in the property descriptions but not
enforced, in line with the catalogue's "Interoperability First"
design principle.
Immutability Confirmation
(New file – no existing shapes were touched.)
Examples
Valid example
Invalid example
Compatibility
New domain file. No existing shape touched.
Validation
Tools used:
pyshacl, plus the repository'sscripts/validate-shacl-shapes-file.py,scripts/check-metadata-and-immutability-file.py, andscripts/check-namespaces-and-names-file.py.Reviewer Checklist