PrologProjector

Projects propositions to Prolog facts for logical inference.

Propositions as Source of Truth

In the DICE architecture, Propositions are the canonical representation of knowledge. All other representations (graph relationships, Prolog facts, vector embeddings) are projections derived from propositions. This ensures:

  • Single source of truth with full provenance

  • Multiple views optimized for different query patterns

  • Consistent grounding back to original sources

Projection Architecture

Projectors transform propositions into specialized representations:

Propositions (source of truth)

├──► GraphProjector ──► Neo4j relationships

├──► PrologProjector ──► Prolog facts (logical inference)

└──► [Your Projector] ──► Custom representation

Creating Custom Projectors

To create a new projector, implement Projector:

data class MyProjection(
val data: String,
override val sourcePropositionIds: List<String>,
) : Projected

class MyProjector : Projector<MyProjection> {
override fun project(
proposition: Proposition,
schema: DataDictionary,
): ProjectionResult<MyProjection> {
// Transform proposition to your representation
val projection = MyProjection(
data = proposition.text,
sourcePropositionIds = listOf(proposition.id),
)
return ProjectionSuccess(proposition, projection)
}
}

Then use with the pipeline results:

val pipeline = PropositionPipeline.withExtractor(extractor)
val result = pipeline.process(chunks, context)
val facts = myProjector.projectAll(result.allPropositions, schema)

Recommended Flow for Prolog

Since relationship classification requires LLM inference, this projector composes with GraphProjector for the classification step:

  1. Use GraphProjector to classify propositions into ProjectedRelationships

  2. Use projectAll to convert relationships to Prolog facts

This avoids duplicating LLM classification logic across projectors.

Inheritors

Functions

Link copied to clipboard
abstract override fun project(proposition: Proposition, schema: <Error class: unknown class>): ProjectionResult<PrologFact>

Project a proposition directly to Prolog facts. Delegates relationship classification to an internal GraphProjector.

Link copied to clipboard

Project multiple relationships to a complete result with metadata.

open fun projectAll(propositions: List<Proposition>, schema: <Error class: unknown class>): ProjectionResults<PrologFact>

Project a batch of propositions.

Link copied to clipboard

Project a classified relationship to a Prolog fact. Use this when you already have classified relationships from graph projection.