Skip to content

API Reference parrot.knowledge.ontology.discovery

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.knowledge.ontology.discovery

View source

Relation discovery engine for automatic edge creation.

Discovers relationships between entities using configurable strategies: exact field matching, fuzzy string matching, AI-assisted resolution, and composite multi-field scoring.

Class DiscoveryResult

Result of a relation discovery operation.

Fields:

Field Type Default Description
confirmed list[dict[str, Any]]
review_queue list[dict[str, Any]]
stats DiscoveryStats

Alias DiscoveryRule

Re-exported from parrot.knowledge.ontology.schema.DiscoveryRule.

Class DiscoveryStats

Statistics for a discovery run.

Fields:

Field Type Default Description
total_source int 0
total_target int 0
edges_created int 0
needs_review int 0

Alias RelationDef

Re-exported from parrot.knowledge.ontology.schema.RelationDef.

Class RelationDiscovery

Discover and create relationships between entities in the graph.

Parameter Type Default Description
llm_client Any None Optional LLM client for AI-assisted strategy.
review_dir Path | str | None None Directory for review queue JSON files. If None, review entries are returned but not written to disk.

Method RelationDiscovery.discover

Discover edges between source and target entities.

Iterates over all discovery rules in the relation definition, applies each matching strategy, merges and deduplicates results.

discover(ctx: TenantContext, relation_def: RelationDef, source_data: list[dict[str, Any]], target_data: list[dict[str, Any]]) -> DiscoveryResult

Parameter Type Default Description
ctx TenantContext Tenant context.
relation_def RelationDef Relation definition with discovery rules.
source_data list[dict[str, Any]] Source entity records.
target_data list[dict[str, Any]] Target entity records.

Returns: DiscoveryResult — DiscoveryResult with confirmed edges and review queue.

Alias TenantContext

Re-exported from parrot.knowledge.ontology.schema.TenantContext.

Attribute logger

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally