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.).
kindUriat-uriAT-URI of the expression kind definition node. Community-expandable via knowledge graph.
kindstringExpression kind slug (fallback when kindUri unavailable). 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.
mediaRefat-uriReference to an associated media record (audio, video, image).
mediaBlobblobOptional inline media blob.
languagestringBCP-47 language tag for the primary language.
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).
eprintRefat-uriReference to an eprint record that this expression is associated with.
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
languagesarrayAdditional BCP-47 language tags for multilingual or code-switching expressions. Array of strings
createdAtdatetimeRecord creation timestamp.

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: The expression record object.

listExpressions

NSID: pub.layers.expression.listExpressions

List expression records in a repository with pagination.

ParameterTypeDescription
repodid (required)The DID of the repository.
limitintegerMaximum number of records to return (1-100, default 50).
cursorstringPagination cursor from previous response.

Output: { records: expression[], cursor?: string }