InMemoryEntityResolver

Entity resolver that remembers entities it's been asked to resolve and tries to reuse them. Useful for deduplicating entities within a single session.

Uses name matching including:

  • Label compatibility checking

  • Case-insensitive exact matching

  • Name normalization (removing titles/suffixes)

  • Partial name matching (e.g., "Holmes" matches "Sherlock Holmes")

  • Levenshtein distance for fuzzy matching

Not thread-safe: it keeps a plain mutable map of remembered entities, so a single instance must not be shared across concurrent callers. This is by design — PropositionPipeline.process builds a fresh resolver per run and only calls it from the serial resolution stage, so the memory stays scoped to one run and never sees concurrent access.

Parameters

config

Configuration for matching thresholds

Constructors

Link copied to clipboard
constructor(config: InMemoryEntityResolver.Config = Config())

Types

Link copied to clipboard
data class Config(val maxDistanceRatio: Double = 0.2, val minLengthForFuzzy: Int = 4, val minPartLength: Int = 4)

Functions

Link copied to clipboard
fun clear()

Clear all resolved entities from memory.

Link copied to clipboard
open override fun resolve(suggestedEntities: SuggestedEntities, schema: <Error class: unknown class>): Resolutions<SuggestedEntityResolution>

For each of the given entities, resolve them to either an existing entity or a new entity.

Link copied to clipboard
fun size(): Int

Get the number of resolved entities in memory.