Prolog Projector
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 representationCreating 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:
Use GraphProjector to classify propositions into ProjectedRelationships
Use projectAll to convert relationships to Prolog facts
This avoids duplicating LLM classification logic across projectors.
Inheritors
Functions
Project a proposition directly to Prolog facts. Delegates relationship classification to an internal GraphProjector.
Project multiple relationships to a complete result with metadata.
Project a batch of propositions.
Project a classified relationship to a Prolog fact. Use this when you already have classified relationships from graph projection.