semantica.conflicts detects and resolves contradictions when multiple sources disagree on the same fact:
  • Five conflict types: value, type, temporal, logical, and relationship
  • Seven resolution strategies: voting, credibility-weighted, most-recent, first-seen, highest-confidence, manual review, expert review
  • InvestigationGuideGenerator produces step-by-step investigation instructions for manual resolution
  • SourceTracker maps each property value to its contributing source for full attribution
  • Conflicts are surfaced explicitly: never silently corrupting the knowledge graph

Why Detect Conflicts?

When you ingest data from multiple sources, contradictions are inevitable. One annual report says Apple’s revenue was 391B;afinancialnewswiresays391B; a financial newswire says 383B. Without conflict detection, both values land in your graph and queries silently return inconsistent answers. Semantica’s conflict detection makes disagreements explicit and actionable:
  • Value conflicts: SEC says revenue is 391B;Reuterssays391B; Reuters says 383B
  • Type conflicts: “Python” is a ProgrammingLanguage in one source, a Snake species in another
  • Temporal conflicts: a CEO had two different employers during overlapping date ranges
  • Logical conflicts: an entity simultaneously holds two mutually exclusive properties
  • Relationship conflicts: the same relationship has inconsistent cardinality or properties across sources

Exported Classes

What You Get

  • ConflictDetector — Value, type, and relationship conflict detection across entity and relationship lists.
  • ConflictResolver — 7 resolution strategies including voting, credibility-weighted, and temporal preference.
  • SourceTracker — Track which source each conflicting fact came from, with per-source credibility scores.
  • ConflictAnalyzer — Pattern analysis, severity grouping, source-level statistics, and trend identification.
  • InvestigationGuideGenerator — Auto-generate step-by-step investigation checklists for human and expert review.
  • Convenience Functionsdetect_conflicts() and resolve_conflicts() for one-call workflows.

Quick Start

1

Set credibility scores before ingestion

2

Detect conflicts after building the graph

3

Triage by severity

4

Auto-resolve low-severity, escalate critical

Detect before you merge, not after. Run conflict detection on raw entity data before deduplication and graph construction. Detecting conflicts in a live graph that already contains merged entities is harder: you lose the original source attribution.

ConflictDetector

Detection Types

TEMPORAL and LOGICAL conflict detection is not implemented on ConflictDetector directly. The ConflictType enum includes these types for use in custom pipelines, but the detector class only implements detect_value_conflicts, detect_type_conflicts, detect_relationship_conflicts, and detect_entity_conflicts.
Run targeted detection by type:

ConflictDetector Methods

ConflictResolver

Don’t auto-resolve everything. Use MANUAL_REVIEW for conflicts with severity == "critical" or severity == "high": high severity means the disagreement is large and the stakes of getting it wrong are high.

Choosing a Resolution Strategy

Use the convenience aliases for shorter code:

SourceTracker

Key behaviours:
  • Credibility scores default to 0.50 for any source not explicitly set
  • SourceTracker stores property-level provenance: so you can trace exactly which source contributed each value
Always set credibility scores. The default credibility is 0.50 for all sources. Without explicit scores, CREDIBILITY_WEIGHTED behaves identically to VOTING. The power of this strategy is in the differentiation.
Combine with provenance. The SourceTracker feeds directly into the Provenance module’s audit trail. If you need to explain how a resolved value was chosen, provenance records give you the full chain.

ConflictAnalyzer

Key behaviours:
  • analyze_conflicts()["patterns"] returns a list of ConflictPattern objects: use pattern.pattern_type and pattern.frequency to find systemic data quality issues
  • analyze_conflicts()["by_source"] includes counts and top_sources: sources appearing in many conflicts may have upstream data quality problems
  • analyze_trends() returns a list of per-period dicts (period, conflict_count, trend, trend_direction): trend is "increasing", "decreasing", or "stable"
Use analyze_conflicts()["by_source"]["top_sources"] to identify bad data feeds. A single source appearing in many conflicts is a data quality problem upstream, not a conflict to resolve record by record. Flag it and investigate the source pipeline.
Severity is a string label, not a score. ConflictDetector assigns "critical", "high", or "medium" based on property importance and value differences. Critical fields (id, name, type, revenue) always yield "critical". Domain context determines what to prioritize.

InvestigationGuideGenerator

Auto-generate human-readable investigation checklists for conflicts requiring manual or expert review:

Schemas

  • Deduplication — Resolve duplicate entities before conflict detection.
  • Ontology — Logical conflicts use SHACL shapes and ontology axioms.
  • Provenance — Track which source each conflicting fact came from.
  • Knowledge Graph — The graph being checked for conflicts.