Skip to main content

pub.layers.expression

An Expression is any linguistic unit in Layers, from a single morpheme to a full document. Expressions are recursive: a word is part of a phrase, which is part of a sentence, which is part of a paragraph, which is part of a document. Top-level expressions (documents, recordings) have no parent; all other expressions reference their containing expression via parentRef. Segmentation records define how a parent expression is broken into child expressions.

Types

expression

NSID: pub.layers.expression.expression Type: Record

An expression record representing any linguistic unit, from a full document to a single morpheme, with optional recursive nesting.

FieldTypeDescription
idstringA corpus-level unique identifier (headline, URL, document ID, etc.). (required, max 1024)
kindUriat-uriAT-URI of the expression kind definition node. Community-expandable via knowledge graph.
kindstringExpression kind slug (fallback when kindUri unavailable). (required) Known values: document, transcript, dialogue, social-media, email, article, recording, video, multimodal, code, section, paragraph, chapter, turn, utterance, heading, list, sentence, clause, phrase, word, morpheme, character, other
textstringThe full raw text of the expression. All byte-offset spans reference this string. (max 10000000)
mediaRefat-uriReference to an associated media record (audio, video, image).
mediaBlobblobOptional inline media blob. Accepts audio/*, video/*, image/* (max size 52428800).
metadatarefRef: pub.layers.defs#annotationMetadata
featuresrefArbitrary document-level features and metadata. Ref: pub.layers.defs#featureMap
sourceUrluriURL of the external web resource this expression was derived from or annotates.
sourceRefat-uriAT-URI of an external ATProto record this expression is derived from or annotates (e.g., a standard.site Leaflet post, a com.whtwnd blog entry, an app.bsky.feed.post, an at.margin.bookmark).
eprintRefsarrayEprint records (papers/preprints) describing or associated with this expression. Array of at-uri (max 64)
knowledgeRefsarrayReferences to knowledge base entries relevant to this expression. Array of ref: pub.layers.defs#knowledgeRef
parentRefat-uriReference to the parent expression this one is nested within. Absent for top-level expressions (documents, recordings, etc.).
anchorrefHow this expression attaches to its parent (character span, temporal span, etc.). Ref: pub.layers.defs#anchor
languagesarrayBCP-47 language tags this record covers. Empty when language is unspecified or unknown. Array of strings (max 128)
createdAtdatetimeRecord creation timestamp. (required)

XRPC Queries

getExpression

NSID: pub.layers.expression.getExpression

Retrieve a single expression record by AT-URI.

ParameterTypeDescription
uriat-uri (required)The AT-URI of the expression record.

Output: { uri: at-uri, cid: cid, value: expression } where value is the expression record.

listExpressions

NSID: pub.layers.expression.listExpressions

List expression records in a repository with pagination.

ParameterTypeDescription
repoat-identifier (required)The handle or DID of the repository.
kindstringFilter by expression kind slug.
parentRefat-uriFilter to expressions nested within this parent.
limitintegerMaximum number of records to return (1-100, default 50).
cursorstringPagination cursor from previous response.
languagesarrayFilter to records covering any of these BCP-47 language tags. Array of strings

Output: { records: { uri: at-uri, cid: cid, value: expression }[], cursor?: string } (each record is a recordView wrapping the expression in value).