Skip to main content

W3C Web Annotation Data Model

Overview

The W3C Web Annotation Data Model is the standard for annotating web resources. It defines a target-body-motivation architecture where annotations select parts of resources (targets) and associate them with descriptive content (bodies). The model defines a rich vocabulary of selectors for pinpointing regions within resources. The at.margin (Semble/Cosmik) ATProto lexicons implement this model on ATProto.

Core Architecture Mapping

Annotation Structure

W3C ConceptLayers EquivalentNotes
Annotationpub.layers.annotation#annotationA single annotation. W3C's id → annotation UUID / AT-URI.
Targetannotation.anchorWhat the annotation is about — the selected region of a resource.
Bodyannotation.label, annotation.value, annotation.features, annotation.argumentsThe content of the annotation. Layers distributes body content across typed fields rather than using a generic body object.
MotivationannotationLayer.kind + annotationLayer.subkindWhy the annotation was created. W3C motivations (commenting, highlighting, tagging, describing, etc.) map to Layers kind/subkind discriminators.
Creatorpub.layers.defs#annotationMetadata.tool + ATProto DIDThe annotation creator. In ATProto, the record's DID identifies the creator.
Created/ModifiedannotationMetadata.timestamp + createdAtTimestamps.

W3C Motivations → Layers Kind/Subkind

W3C MotivationLayers MappingNotes
oa:commentingkind="span", subkind="comment"Free-text commentary.
oa:highlightingkind="span", subkind="highlight"Visual highlighting.
oa:taggingkind="token-tag" or kind="span"Label assignment.
oa:describingkind="span" with annotation.valueDescriptive annotation.
oa:classifyingkind="span" with annotation.ontologyTypeRefOntology-based classification.
oa:identifyingkind="span", subkind="entity-mention" with knowledgeRefsEntity identification/linking.
oa:linkingpub.layers.graph#graphEdgeLinking to related resources.
oa:bookmarkingkind="span", subkind="bookmark"Bookmarking.
oa:editingkind="span", subkind="correction"Suggested edits.
oa:questioningkind="span" with custom subkindQuestioning content.
oa:replyingNot a core Layers annotation type; handled via ATProto social graph (reply records)Replies are social interactions, not linguistic annotations.
oa:moderatingAppview-level functionalityContent moderation.
oa:assessingpub.layers.judgmentQuality/acceptability assessment.

Selector Types

Layers includes W3C-compatible selectors in pub.layers.defs:

W3C SelectorLayers EquivalentNotes
TextQuoteSelectorpub.layers.defs#textQuoteSelectorSelect by quoting text. exact → exact match; prefix/suffix → context. Direct mapping.
TextPositionSelectorpub.layers.defs#textPositionSelectorSelect by character offsets. start/end → same fields. Direct mapping.
FragmentSelectorpub.layers.defs#fragmentSelectorSelect by URI fragment. value → fragment identifier; conformsTo → fragment spec URI. Direct mapping.
CssSelectorpub.layers.defs#externalTarget.selector (via features)CSS selector string. Stored in externalTarget features when annotating web resources.
XPathSelectorpub.layers.defs#externalTarget.selector (via features)XPath expression. Stored in features.
DataPositionSelectorpub.layers.defs#spanByte/character offset selection.
SvgSelectorpub.layers.defs#boundingBox or featuresSVG-based spatial selection. Layers uses boundingBox for rectangular regions; arbitrary SVG shapes go in features.
RangeSelectorComposite of two selectorsStart/end defined by two separate selectors. Representable by combining two anchor fields.
TimeSelector (Media Fragments)pub.layers.defs#temporalSpanMedia fragment time selection. start/end in seconds → temporalSpan.start/temporalSpan.ending in milliseconds.

Target Types

W3C TargetLayers EquivalentNotes
External resource (URL)pub.layers.defs#externalTargetAnnotation of a web resource. source → URL; selector → W3C selector.
Specific resource (URL + selector)externalTarget + textQuoteSelector/textPositionSelector/fragmentSelectorPinpointed region of a web resource.
Internal resourceannotation.anchor (textSpan, tokenRef, etc.)Annotation of Layers-managed content.
Composite targetMultiple anchor fields in the polymorphic anchor objectAnnotations with multiple target components.

Body Types

W3C BodyLayers EquivalentNotes
TextualBodyannotation.valuePlain text body.
SpecificResource (embedded content)annotation.featuresStructured body content.
Choice (alternative bodies)Multiple annotations with different valuesAlternative interpretations represented as separate annotations.
Tag bodyannotation.labelTag/label value.
External resource bodyannotation.knowledgeRefsLink to external resource as body content.

at.margin (Semble) Interoperability

The at.margin ATProto lexicons implement W3C Web Annotation on ATProto. Layers's W3C selector types are structurally compatible:

at.margin RecordLayers EquivalentIntegration Pattern
at.margin.annotationpub.layers.annotation#annotationLayerLayers expressions with sourceUrl co-locate with at.margin annotations on the same URL.
at.margin.highlightannotationLayer(kind="span", subkind="highlight")Highlighting.
at.margin.bookmarkannotationLayer(kind="span", subkind="bookmark")Bookmarking.
at.margin.collectionpub.layers.corpusCollections of annotations.
at.margin.replyATProto social graphNot a Layers annotation type.
at.margin.likeATProto social graphNot a Layers annotation type.

The lairs.pub appview discovers at.margin annotations by consuming the ATProto firehose and indexing records that share sourceUrl values with Layers expressions. No bridge records are needed — this follows standard ATProto cross-app discovery patterns.