ChunkPropositionResult

The outcome of processing a single chunk through the proposition pipeline.

A chunk either succeeds (Success, with propositions and entity resolutions) or fails (Failed, with a typed serializable error). Modelling failure inline preserves the chunkResults.size == chunks.size invariant — a failed chunk surfaces as a Failed slot rather than aborting the run or being silently dropped.

All flat-access members (propositions, revisionResults, persist, newEntities, etc.) are available on this interface, so call sites work without smart-casting. The Success-only fields (suggestedPropositions, entityResolutions) live on Success and require a smart-cast to access.

Inheritors

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class Failed(val chunkId: String, val error: String, val cause: Throwable? = null) : ChunkPropositionResult

A chunk that failed to process. Carries the chunkId, a serialization-friendly error message, and the optional raw cause for in-process inspection. Contributes nothing to any proposition or entity aggregate.

Link copied to clipboard
data class Success(val chunkId: String, val suggestedPropositions: SuggestedPropositions, val entityResolutions: Resolutions<SuggestedEntityResolution>, val propositions: List<Proposition>, val revisionResults: List<RevisionResult> = emptyList()) : ChunkPropositionResult

A chunk that was processed successfully.

Properties

Link copied to clipboard
abstract val chunkId: String

Id of the chunk this result originated from.

Link copied to clipboard

Statistics about entity extraction outcomes

Link copied to clipboard

Whether revision was enabled

Link copied to clipboard

Statistics about revision outcomes

Link copied to clipboard

All propositions extracted (before any revision).

Link copied to clipboard

All propositions that need to be persisted after revision. Includes both new propositions and updates to existing ones:

Link copied to clipboard

All revision results

Functions

Link copied to clipboard
open fun entitiesToPersist(): List<<Error class: unknown class>>

All entities that need to be persisted (new + updated). Does not include reference-only entities.

Link copied to clipboard
abstract fun newEntities(): List<<Error class: unknown class>>

Entities that are new (not matched to any existing entity). These should be saved to the entity repository.

Link copied to clipboard
open fun persist(propositionRepository: PropositionRepository, namedEntityDataRepository: <Error class: unknown class>)

Persist extracted entities and propositions to their respective repositories. Also creates structural relationships:

Link copied to clipboard
open fun persistCanonicalPropositions(propositionRepository: PropositionRepository, namedEntityDataRepository: <Error class: unknown class>): PropositionPersistenceResult

The first half of persistReturningCanonical: entities and propositions are saved, and nothing else happens. Saved means committed only when no transaction wraps the call; inside an ambient transaction the claims land with the caller's commit, not here.

Link copied to clipboard
open fun persistReturningCanonical(propositionRepository: PropositionRepository, namedEntityDataRepository: <Error class: unknown class>): PropositionPersistenceResult

Persist the same things persist does, and report which stored proposition each extracted one landed on.

Link copied to clipboard
Link copied to clipboard
open fun referenceOnlyEntities(): List<<Error class: unknown class>>

Entities that were matched to known entities that should not be updated. These are typically entities managed by external services (e.g., the current user). They are referenced in propositions but not persisted during extraction.

Link copied to clipboard
abstract fun updatedEntities(): List<<Error class: unknown class>>

Entities that were matched to existing entities and may have updated information. These should be updated in the entity repository.

Link copied to clipboard
open fun wireStructuralRelationships(persisted: PropositionPersistenceResult, namedEntityDataRepository: <Error class: unknown class>)

The second half of persistReturningCanonical: the chunk, proposition and entity edges, wired against the propositions the repository returned so every edge lands on a node the store actually holds.