Skip to content

Graph-Native Infrastructure for Context and Accountable AI Systems

refactor: standardize conflicts module with comprehensive documentation

KaifAhmad1b29f9771feeb
diff --git a/semantica/conflicts/__init__.py b/semantica/conflicts/__init__.py
index ef9c7ff3..1edb88b3 100644
--- a/semantica/conflicts/__init__.py
+++ b/semantica/conflicts/__init__.py
@@ -1,8 +1,36 @@
"""
Conflict Detection Module
-This module identifies conflicts from multiple sources and
-provides investigation guides for discrepancies.
+This module provides comprehensive conflict detection and resolution capabilities
+for the Semantica framework, identifying conflicts from multiple sources and
+providing investigation guides for discrepancies. It enables source tracking,
+conflict analysis, and automated resolution strategies.
+
+Key Features:
+ - Multi-source conflict detection (value, type, relationship, temporal)
+ - Source tracking and provenance management
+ - Conflict analysis and pattern identification
+ - Multiple resolution strategies (voting, credibility-weighted, recency)
+ - Investigation guide generation
+ - Source credibility scoring
+ - Conflict reporting and statistics
+
+Main Classes:
+ - ConflictDetector: Detects conflicts from multiple sources
+ - ConflictResolver: Resolves conflicts using various strategies
+ - ConflictAnalyzer: Analyzes conflict patterns and trends
+ - SourceTracker: Tracks source information and provenance
+ - InvestigationGuideGenerator: Generates investigation guides
+
+Example Usage:
+ >>> from semantica.conflicts import ConflictDetector, ConflictResolver
+ >>> detector = ConflictDetector()
+ >>> conflicts = detector.detect_value_conflicts(entities, "name")
+ >>> resolver = ConflictResolver()
+ >>> results = resolver.resolve_conflicts(conflicts)
+
+Author: Semantica Contributors
+License: MIT
"""
from .conflict_detector import ConflictDetector, Conflict, ConflictType
diff --git a/semantica/conflicts/conflict_analyzer.py b/semantica/conflicts/conflict_analyzer.py
index e4a58f81..68b4df23 100644
--- a/semantica/conflicts/conflict_analyzer.py
+++ b/semantica/conflicts/conflict_analyzer.py
@@ -1,8 +1,32 @@
"""
-Conflict Analyzer for Semantica framework.
+Conflict Analyzer
-Analyzes patterns in conflicts, identifies conflict types, and
-provides insights into conflict sources and trends.
+This module provides comprehensive conflict analysis capabilities for the
+Semantica framework, analyzing patterns in conflicts, identifying conflict types,
+and providing insights into conflict sources and trends.
+
+Key Features:
+ - Analyzes conflict patterns and trends
+ - Classifies conflict types
+ - Identifies high-conflict areas
+ - Generates conflict statistics
+ - Provides conflict insights and recommendations
+ - Supports conflict prevention strategies
+ - Pattern-based conflict identification
+ - Severity-based analysis
+
+Main Classes:
+ - ConflictPattern: Conflict pattern data structure
+ - ConflictAnalyzer: Conflict analyzer for pattern identification
+
+Example Usage:
+ >>> from semantica.conflicts import ConflictAnalyzer
+ >>> analyzer = ConflictAnalyzer()
+ >>> analysis = analyzer.analyze_conflicts(conflicts)
+ >>> report = analyzer.generate_insights_report(conflicts)
+
+Author: Semantica Contributors
+License: MIT
"""
from typing import Any, Dict, List, Optional
diff --git a/semantica/conflicts/conflict_detector.py b/semantica/conflicts/conflict_detector.py
index 84659bc8..15ff33c8 100644
--- a/semantica/conflicts/conflict_detector.py
+++ b/semantica/conflicts/conflict_detector.py
@@ -1,8 +1,33 @@
"""
-Conflict Detector for Semantica framework.
+Conflict Detector
-Detects conflicts from multiple sources and tracks source
-disagreements for compliance and investigation.
+This module provides comprehensive conflict detection capabilities for the
+Semantica framework, detecting conflicts from multiple sources and tracking
+source disagreements for compliance and investigation.
+
+Key Features:
+ - Detects property value conflicts
+ - Identifies relationship conflicts
+ - Tracks source disagreements
+ - Generates conflict reports
+ - Provides investigation guides
+ - Multiple conflict types (value, type, relationship, temporal, logical)
+ - Severity calculation
+ - Confidence scoring
+
+Main Classes:
+ - ConflictType: Conflict type enumeration
+ - Conflict: Conflict information data structure
+ - ConflictDetector: Conflict detector for multi-source conflict identification
+
+Example Usage:
+ >>> from semantica.conflicts import ConflictDetector
+ >>> detector = ConflictDetector()
+ >>> conflicts = detector.detect_value_conflicts(entities, "name")
+ >>> report = detector.get_conflict_report()
+
+Author: Semantica Contributors
+License: MIT
"""
from typing import Any, Dict, List, Optional, Set
diff --git a/semantica/conflicts/conflict_resolver.py b/semantica/conflicts/conflict_resolver.py
index 13b49a27..3c5ed674 100644
--- a/semantica/conflicts/conflict_resolver.py
+++ b/semantica/conflicts/conflict_resolver.py
@@ -1,8 +1,32 @@
"""
-Conflict Resolver for Semantica framework.
+Conflict Resolver
-Provides strategies for resolving detected conflicts including
-voting mechanisms, credibility-based resolution, and expert review.
+This module provides comprehensive conflict resolution capabilities for the
+Semantica framework, offering multiple strategies for resolving detected conflicts
+including voting mechanisms, credibility-based resolution, and expert review.
+
+Key Features:
+ - Automatic conflict resolution strategies
+ - Voting-based resolution from multiple sources
+ - Credibility-weighted conflict resolution
+ - Manual conflict resolution workflow
+ - Resolution rule configuration
+ - Conflict resolution history tracking
+ - Multiple resolution strategies (voting, credibility, recency, confidence)
+
+Main Classes:
+ - ResolutionStrategy: Conflict resolution strategy enumeration
+ - ResolutionResult: Conflict resolution result data structure
+ - ConflictResolver: Conflict resolver with multiple resolution strategies
+
+Example Usage:
+ >>> from semantica.conflicts import ConflictResolver, ResolutionStrategy
+ >>> resolver = ConflictResolver()
+ >>> result = resolver.resolve_conflict(conflict, ResolutionStrategy.VOTING)
+ >>> results = resolver.resolve_conflicts(conflicts)
+
+Author: Semantica Contributors
+License: MIT
"""
from typing import Any, Dict, List, Optional, Callable
diff --git a/semantica/conflicts/investigation_guide.py b/semantica/conflicts/investigation_guide.py
index f70d5c72..64d1c17b 100644
--- a/semantica/conflicts/investigation_guide.py
+++ b/semantica/conflicts/investigation_guide.py
@@ -1,8 +1,33 @@
"""
Investigation Guide Generator
-Generates investigation guides for detected conflicts to help
-domain experts investigate and resolve discrepancies.
+This module provides comprehensive investigation guide generation capabilities
+for the Semantica framework, generating investigation guides for detected
+conflicts to help domain experts investigate and resolve discrepancies.
+
+Key Features:
+ - Generates conflict investigation checklists
+ - Identifies conflicting source documents
+ - Provides conflict context and history
+ - Suggests investigation steps
+ - Generates conflict summary reports
+ - Supports compliance audit workflows
+ - Export formats (text, markdown)
+ - Severity-based recommendations
+
+Main Classes:
+ - InvestigationStep: Investigation step data structure
+ - InvestigationGuide: Investigation guide data structure
+ - InvestigationGuideGenerator: Investigation guide generator for conflicts
+
+Example Usage:
+ >>> from semantica.conflicts import InvestigationGuideGenerator
+ >>> generator = InvestigationGuideGenerator()
+ >>> guide = generator.generate_guide(conflict)
+ >>> checklist = generator.export_investigation_checklist(guide, format="markdown")
+
+Author: Semantica Contributors
+License: MIT
"""
from typing import Any, Dict, List, Optional
diff --git a/semantica/conflicts/source_tracker.py b/semantica/conflicts/source_tracker.py
index 332913b4..f853a9c0 100644
--- a/semantica/conflicts/source_tracker.py
+++ b/semantica/conflicts/source_tracker.py
@@ -1,8 +1,34 @@
"""
Source Tracker for Conflict Detection
-Tracks source information for entities and properties to enable
+This module provides comprehensive source tracking capabilities for the Semantica
+framework, tracking source information for entities and properties to enable
conflict investigation and source disagreement analysis.
+
+Key Features:
+ - Tracks source documents for each property value
+ - Maintains source provenance for entities
+ - Tracks source disagreements and conflicts
+ - Generates source analysis reports
+ - Supports source credibility scoring
+ - Enables traceability for conflict resolution
+ - Relationship source tracking
+ - Traceability chain generation
+
+Main Classes:
+ - SourceReference: Source reference data structure
+ - PropertySource: Property source information data structure
+ - SourceTracker: Source tracker for conflict detection
+
+Example Usage:
+ >>> from semantica.conflicts import SourceTracker, SourceReference
+ >>> tracker = SourceTracker()
+ >>> source = SourceReference(document="doc1", page=1, confidence=0.9)
+ >>> tracker.track_property_source("entity_1", "name", "Python", source)
+ >>> sources = tracker.get_property_sources("entity_1", "name")
+
+Author: Semantica Contributors
+License: MIT
"""
from typing import Any, Dict, List, Optional, Set