Graph-Native Infrastructure for Context and Accountable AI Systems
Python agent-memoryaiai-governanceai-infrastructureartificial-intelligencecontext-engineeringcontext-graphsdata-engineeringdecision-intelligencedeveloper-toolsexplainable-aigenerative-aigraph-ragknowledge-graphllmontologyprovenancepythonreasoningsemantic-search
fix: correct docs-to-code mismatches in 8 reference modules
KaifAhmad1ce765b6f66ec
diff --git a/docs/reference/change_management.md b/docs/reference/change_management.mdindex 059af4d4..092e55e9 100644--- a/docs/reference/change_management.md+++ b/docs/reference/change_management.md@@ -28,8 +28,8 @@ icon: "clock-rotate-left"<Card title="ChangeLogEntry" icon="list-check">Structured record of every change: author, timestamp, checksum, and change list.</Card>- <Card title="Compliance Export" icon="file-shield">- Full audit trail as CSV or JSON for regulatory review and subject-access requests.+ <Card title="Version History" icon="file-shield">+ Full tamper-evident version history via `list_versions()` and `diff()` for regulatory review.</Card></CardGroup>@@ -77,12 +77,6 @@ icon: "clock-rotate-left"print(f" [{change.type}] {change.element}: {change.description}")```</Step>- <Step title="Rollback if needed">- ```python- # Safe mode (default) — fails with a clear error rather than dropping nodes- manager.rollback(target_version="v1.0", allow_data_loss=False)- ```- </Step></Steps>## TemporalVersionManager@@ -96,7 +90,7 @@ Version control for knowledge graphs — snapshot, diff, and rollback.| `storage_path` | `str` | `None` | Path to SQLite database; uses in-memory if omitted || `storage` | `VersionStorage` | `None` | Explicit storage backend instance — overrides `storage_path` |-### List, Retrieve, and Rollback+### List and Retrieve```python# List all versions@@ -106,15 +100,8 @@ for v in versions:# Retrieve a specific versionkg_v1 = manager.get_version("v1.0")--# Rollback to a previous version-manager.rollback(target_version="v1.0", allow_data_loss=False)```-<Warning>- `rollback(allow_data_loss=False)` is the safe default — it fails with a clear error if nodes were added after the target snapshot. Set `allow_data_loss=True` only when you explicitly intend to discard those changes.-</Warning>-## Diff AnalysisCompare any two snapshots to see exactly what changed — useful for code review, incident investigation, and regulatory audit:@@ -236,9 +223,8 @@ if not is_valid:Every version snapshot includes a structured `ChangeLogEntry` that records the full context of a change:```python-from semantica.change_management import ChangeLogEntry--entry: ChangeLogEntry = manager.get_log_entry(snapshot_id)+# Retrieve a version entry+entry = manager.get_version("v1.0")print(entry.version) # "v1.0"print(entry.author) # "[email protected]"@@ -269,58 +255,35 @@ class ChangeLogEntry:</Accordion>-## Compliance and Audit Export--All changes are preserved in a tamper-evident audit trail. Export for regulatory review:+## Compliance and Version History-<CodeGroup>+All version snapshots form a tamper-evident audit trail. Use `list_versions()` and `diff()` to reconstruct and review changes for regulatory purposes:-```python CSV export-# Full audit trail-manager.export_audit_trail("audit.csv", format="csv")--# Scoped to a time range — SOX quarterly review-from datetime import datetime+```python+from semantica.change_management import TemporalVersionManager-trail = manager.get_audit_trail(- from_date=datetime(2026, 1, 1),- to_date=datetime(2026, 3, 31),-)-manager.export_audit_trail("q1_audit.csv", trail=trail, format="csv")-```+manager = TemporalVersionManager(storage_path="versions.db")-```python JSON export-# Full audit trail-manager.export_audit_trail("audit.json", format="json")+# Enumerate the full version history+for entry in manager.list_versions():+ print(f"{entry.created_at.isoformat()} | {entry.author} | {entry.version} | {entry.message}")-# Scoped to a specific entity — HIPAA subject-access request-trail = manager.get_audit_trail(entity_id="patient_001")-manager.export_audit_trail("patient_001_audit.json", trail=trail, format="json")+# Diff any two snapshots for a change report+diff = manager.diff("v1.0", "v2.0")+print(f"Added: {len(diff.added_nodes)} | Removed: {len(diff.removed_nodes)} | Modified: {len(diff.modified_nodes)}")+for change in diff.changes:+ print(f" [{change.type}] {change.element}: {change.description}")```-</CodeGroup>--You can also iterate the trail directly:+Use `verify_checksum()` before any compliance export to confirm graph integrity:```python-trail = manager.get_audit_trail(entity_id="patient_001")-for entry in trail:- print(f"{entry.timestamp.isoformat()} | {entry.author} | {entry.action} | {entry.description}")-```+from semantica.change_management import verify_checksum-### Audit Fields--| Field | Description |-| ----- | ----------- |-| `timestamp` | UTC ISO 8601 datetime |-| `entity_id` | ID of the affected entity or relationship |-| `author` | User or process that made the change |-| `action` | `CREATE` / `UPDATE` / `DELETE` / `MERGE` / `ROLLBACK` |-| `property` | Property name that changed (UPDATE rows only) |-| `old_value` | Previous value (UPDATE and DELETE rows) |-| `new_value` | New value (CREATE and UPDATE rows) |-| `snapshot_id` | ID of the containing snapshot |-| `checksum` | SHA-256 of the entity state after the change |+is_valid = verify_checksum(kg, expected_checksum=entry.checksum)+if not is_valid:+ raise RuntimeError("Graph has been modified since the snapshot was taken")+```### Compliance Coverage@@ -354,11 +317,7 @@ for entry in trail:</Tip><Tip>- **Export audit trails before compliance reviews.** `export_audit_trail("audit.csv", format="csv")` produces a complete tamper-evident record in one call. Schedule this export before quarterly reviews (SOX), regulatory inspections (FDA 21 CFR Part 11), or subject-access requests (GDPR).-</Tip>--<Tip>- **Use `get_audit_trail(from_date=..., to_date=...)` for scoped reviews.** Exporting the full audit trail for a multi-year graph can produce millions of rows. Scope to a time window or entity ID for faster, focused reports.+ **Use `list_versions()` and `diff()` for compliance reviews.** `manager.list_versions()` enumerates the full version history and `manager.diff(v1, v2)` produces a machine-readable change report. Run `verify_checksum()` first to confirm the graph hasn't been modified since the snapshot was taken.</Tip><CardGroup cols={2}>diff --git a/docs/reference/conflicts.md b/docs/reference/conflicts.mdindex 9914a73d..6346acd4 100644--- a/docs/reference/conflicts.md+++ b/docs/reference/conflicts.md@@ -49,10 +49,10 @@ Semantica's conflict detection makes disagreements explicit and actionable:from semantica.conflicts import SourceTrackertracker = SourceTracker()- tracker.set_credibility("sec_filings", 0.95)- tracker.set_credibility("pubmed", 0.92)- tracker.set_credibility("wikipedia", 0.80)- tracker.set_credibility("news_articles", 0.65)+ tracker.set_source_credibility("sec_filings", 0.95)+ tracker.set_source_credibility("pubmed", 0.92)+ tracker.set_source_credibility("wikipedia", 0.80)+ tracker.set_source_credibility("news_articles", 0.65)```</Step><Step title="Detect conflicts after building the graph">@@ -73,10 +73,11 @@ Semantica's conflict detection makes disagreements explicit and actionable:from semantica.conflicts import ConflictAnalyzeranalyzer = ConflictAnalyzer()- by_severity = analyzer.group_by_severity(conflicts)- print(f"Critical: {len(by_severity['critical'])}")- print(f"High: {len(by_severity['high'])}")- print(f"Low: {len(by_severity['low'])}")+ analysis = analyzer.analyze_conflicts(conflicts)+ by_severity = analysis["by_severity"]+ print(f"Critical: {len(by_severity.get('critical', []))}")+ print(f"High: {len(by_severity.get('high', []))}")+ print(f"Low: {len(by_severity.get('low', []))}")```</Step><Step title="Auto-resolve low-severity, escalate critical">@@ -94,7 +95,7 @@ Semantica's conflict detection makes disagreements explicit and actionable:# Generate investigation guides for critical conflictsgenerator = InvestigationGuideGenerator()for conflict in by_severity["critical"]:- guide = generator.generate(conflict)+ guide = generator.generate_guide(conflict)print(f"\n{guide.title}")for step in guide.steps:print(f" [{step.order}] ({step.priority.upper()}) {step.description}")@@ -161,9 +162,9 @@ for result in results:from semantica.conflicts import ConflictResolver, SourceTracker, ResolutionStrategytracker = SourceTracker()- tracker.set_credibility("sec_filings", 0.92)- tracker.set_credibility("wikipedia", 0.80)- tracker.set_credibility("news_articles", 0.65)+ tracker.set_source_credibility("sec_filings", 0.92)+ tracker.set_source_credibility("wikipedia", 0.80)+ tracker.set_source_credibility("news_articles", 0.65)resolver = ConflictResolver(source_tracker=tracker)results = resolver.resolve_conflicts(@@ -201,7 +202,7 @@ for result in results:generator = InvestigationGuideGenerator()for conflict in conflicts:- guide = generator.generate(conflict)+ guide = generator.generate_guide(conflict)print(f"{guide.title}")for step in guide.steps:print(f" [{step.order}] {step.description}")@@ -238,8 +239,8 @@ from semantica.conflicts import SourceTrackerfrom datetime import datetimetracker = SourceTracker()-tracker.set_credibility("sec_10k", 0.92)-tracker.set_credibility("wikipedia", 0.80)+tracker.set_source_credibility("sec_10k", 0.92)+tracker.set_source_credibility("wikipedia", 0.80)tracker.track_property_source(entity_id="apple_inc",@@ -267,19 +268,20 @@ from semantica.conflicts import ConflictAnalyzeranalyzer = ConflictAnalyzer()-patterns = analyzer.identify_patterns(conflicts)-by_severity = analyzer.group_by_severity(conflicts)-source_stats = analyzer.analyze_sources(conflicts)-trends = analyzer.analyze_trends(conflicts, time_window="30d")+analysis = analyzer.analyze_conflicts(conflicts)+patterns = analysis["patterns"]+by_severity = analysis["by_severity"]+source_stats = analysis["by_source"]+trends = analyzer.analyze_trends(conflicts)print(f"Trend direction: {trends['direction']}") # "increasing" | "stable" | "decreasing"print(f"Change: {trends['change_pct']:.1f}%")```**Key behaviours:**-- `identify_patterns()` groups conflicts by attribute name and type — use it to find systemic data quality issues-- `analyze_sources()` flags sources with disproportionate conflict rates — a signal that a source's pipeline needs review-- `analyze_trends()` compares conflict counts across time windows — a rising trend means a data source is degrading+- `analyze_conflicts()["patterns"]` groups conflicts by attribute name and type — use it to find systemic data quality issues+- `analyze_conflicts()["by_source"]` flags sources with disproportionate conflict rates — a signal that a source's pipeline needs review+- `analyze_trends()` compares conflict counts over time — a rising trend means a data source is degrading## InvestigationGuideGenerator@@ -289,7 +291,7 @@ Auto-generate human-readable investigation checklists for conflicts requiring mafrom semantica.conflicts import InvestigationGuideGeneratorgenerator = InvestigationGuideGenerator()-guide = generator.generate(conflict)+guide = generator.generate_guide(conflict)print(f"Title: {guide.title}")print(f"Context: {guide.context}")diff --git a/docs/reference/deduplication.md b/docs/reference/deduplication.mdindex f10c0cd3..6246aad8 100644--- a/docs/reference/deduplication.md+++ b/docs/reference/deduplication.md@@ -176,38 +176,33 @@ print(f"Merged to: {len(merged_entities)} canonical entities")| `keep_first` | Keep the first entity in each group | Source order is meaningful (most authoritative first) || `keep_last` | Keep the most recently seen entity | Most recent source is most accurate || `keep_most_complete` | Keep the entity with the most non-null properties | Default — maximizes data richness |-| `union` | Merge all properties; combine non-conflicting fields | You want every known alias, tag, and label |-| `voting` | Most common property value wins | Multiple semi-reliable sources |+| `keep_highest_confidence` | Keep the entity with the highest confidence score | Extraction pipelines produce confidence scores |+| `merge_all` | Merge all properties; combine non-conflicting fields | You want every known alias, tag, and label |### Per-Property Merge Rules+Use `MergeStrategyManager` to apply different `MergeStrategy` values per property:+```python-from semantica.deduplication import EntityMerger, PropertyMergeRule--merger = EntityMerger(- property_rules={- "name": PropertyMergeRule.KEEP_FIRST,- "aliases": PropertyMergeRule.UNION,- "description": PropertyMergeRule.KEEP_LONGEST,- "confidence": PropertyMergeRule.MAX,- "created_at": PropertyMergeRule.KEEP_FIRST,- "updated_at": PropertyMergeRule.KEEP_LAST,- }-)+from semantica.deduplication import MergeStrategyManager, MergeStrategy++manager = MergeStrategyManager()+manager.add_property_rule("name", MergeStrategy.KEEP_FIRST)+manager.add_property_rule("aliases", MergeStrategy.MERGE_ALL)+manager.add_property_rule("confidence", MergeStrategy.KEEP_HIGHEST_CONFIDENCE)+manager.add_property_rule("created_at", MergeStrategy.KEEP_FIRST)+manager.add_property_rule("updated_at", MergeStrategy.KEEP_LAST)-merged_entities = merger.merge_duplicates(entities, preserve_provenance=True)+merged_entity = manager.merge_entities(duplicate_group)```-| Rule | Behaviour |-| ---- | --------- |+| Strategy | Behaviour |+| -------- | --------- || `KEEP_FIRST` | Value from the first entity in the group || `KEEP_LAST` | Value from the last entity |-| `KEEP_LONGEST` | Longest non-null string value |-| `KEEP_MOST_COMPLETE` | Entity with the most non-null fields (default fallback) |-| `UNION` | Combine all unique values into a list |-| `MAX` | Numerically largest value |-| `MIN` | Numerically smallest value |-| `VOTING` | Most frequently occurring value |+| `KEEP_MOST_COMPLETE` | Entity with the most non-null fields |+| `KEEP_HIGHEST_CONFIDENCE` | Entity with the highest confidence score |+| `MERGE_ALL` | Combine all properties from every entity in the group |## SimilarityCalculator@@ -278,19 +273,18 @@ print(f"Avg separation: {result.quality.avg_separation:.3f}")Define complex, reusable merge configurations once and apply them across multiple operations:```python-from semantica.deduplication import MergeStrategyManager, PropertyMergeRule+from semantica.deduplication import MergeStrategyManager, MergeStrategymanager = MergeStrategyManager()-manager.add_rule("name", PropertyMergeRule.KEEP_FIRST)-manager.add_rule("aliases", PropertyMergeRule.UNION)-manager.add_rule("description", PropertyMergeRule.KEEP_LONGEST)-manager.add_rule("confidence", PropertyMergeRule.MAX)-manager.add_rule("sources", PropertyMergeRule.UNION)-manager.add_rule("created_at", PropertyMergeRule.KEEP_FIRST)-manager.add_rule("updated_at", PropertyMergeRule.KEEP_LAST)-manager.set_default_rule(PropertyMergeRule.KEEP_MOST_COMPLETE)--merged_entity = manager.merge(duplicate_group)+manager.add_property_rule("name", MergeStrategy.KEEP_FIRST)+manager.add_property_rule("aliases", MergeStrategy.MERGE_ALL)+manager.add_property_rule("description", MergeStrategy.KEEP_MOST_COMPLETE)+manager.add_property_rule("confidence", MergeStrategy.KEEP_HIGHEST_CONFIDENCE)+manager.add_property_rule("sources", MergeStrategy.MERGE_ALL)+manager.add_property_rule("created_at", MergeStrategy.KEEP_FIRST)+manager.add_property_rule("updated_at", MergeStrategy.KEEP_LAST)++merged_entity = manager.merge_entities(duplicate_group)```## Blocking Strategies@@ -379,13 +373,12 @@ class ClusterQuality:</Step><Step title="Configure property-level merge rules">```python- from semantica.deduplication import MergeStrategyManager, PropertyMergeRule+ from semantica.deduplication import MergeStrategyManager, MergeStrategymanager = MergeStrategyManager()- manager.add_rule("name", PropertyMergeRule.KEEP_FIRST)- manager.add_rule("aliases", PropertyMergeRule.UNION)- manager.add_rule("description", PropertyMergeRule.KEEP_LONGEST)- manager.set_default_rule(PropertyMergeRule.KEEP_MOST_COMPLETE)+ manager.add_property_rule("name", MergeStrategy.KEEP_FIRST)+ manager.add_property_rule("aliases", MergeStrategy.MERGE_ALL)+ manager.add_property_rule("description", MergeStrategy.KEEP_MOST_COMPLETE)```</Step><Step title="Merge and inspect results">diff --git a/docs/reference/export.md b/docs/reference/export.mdindex 9eab66a5..76b5b341 100644--- a/docs/reference/export.md+++ b/docs/reference/export.md@@ -41,8 +41,10 @@ icon: "file-export"</Step><Step title="Export the graph">```python- # Interactive HTML — opens in browser, supports hover and click- exporter.export_to_file(graph, "output.ttl", format="turtle")+ # Export to RDF string, then write to file+ rdf_str = exporter.export_to_rdf(graph, format="turtle")+ with open("output.ttl", "w") as f:+ f.write(rdf_str)```</Step><Step title="Use convenience functions for one-liners">@@ -75,20 +77,14 @@ icon: "file-export"exporter = RDFExporter()- # Turtle (most readable RDF format)- exporter.export_to_file(graph, "output.ttl", format="turtle")-- # JSON-LD (best for APIs and Linked Data)- exporter.export_to_file(graph, "output.jsonld", format="json-ld")-- # N-Triples (streaming-friendly, one triple per line)- exporter.export_to_file(graph, "output.nt", format="nt")+ # Export to RDF string — write to file manually+ rdf_str = exporter.export_to_rdf(graph, format="turtle") # Turtle (most readable)+ rdf_str = exporter.export_to_rdf(graph, format="json-ld") # JSON-LD (APIs, Linked Data)+ rdf_str = exporter.export_to_rdf(graph, format="nt") # N-Triples (streaming-friendly)+ rdf_str = exporter.export_to_rdf(graph, format="xml") # RDF/XML (W3C standard)- # RDF/XML (W3C standard, broadest compatibility)- exporter.export_to_file(graph, "output.xml", format="xml")-- # Export to string instead of file- rdf_str = exporter.export_to_rdf(graph, format="turtle")+ with open("output.ttl", "w") as f:+ f.write(exporter.export_to_rdf(graph, format="turtle"))```**Custom namespace management:**@@ -146,9 +142,9 @@ icon: "file-export"``````python- from semantica.export import YAMLExporter+ from semantica.export import SemanticNetworkYAMLExporter- exporter = YAMLExporter()+ exporter = SemanticNetworkYAMLExporter()exporter.export(graph, "graph.yaml")yaml_str = exporter.to_string(graph)@@ -307,7 +303,7 @@ export_graph(graph, "graph.graphml", format="graphml")| `dot` | `GraphExporter` | `.dot` | Graphviz rendering || `owl` | `OWLExporter` | `.owl` / `.ttl` | OWL 2.0 ontology distribution || `csv` | `CSVExporter` | `.csv` | Spreadsheets, simple pipelines |-| `yaml` | `YAMLExporter` | `.yaml` | Human-readable, config-driven use |+| `yaml` | `SemanticNetworkYAMLExporter` | `.yaml` | Human-readable, config-driven use || `arrow` | `ArrowExporter` | `.arrow` | Zero-copy inter-process transfer || `numpy` | `VectorExporter` | `.npy` | NumPy arrays from embeddings || `faiss` | `VectorExporter` | `.faiss` | Direct FAISS index files |@@ -326,7 +322,7 @@ export_graph(graph, "graph.graphml", format="graphml")</Tip><Warning>- **Stream large graphs with `export_stream()`.** For graphs with more than 500k nodes, use `exporter.export_stream(graph, ...)` instead of `exporter.export_to_file()`. Streaming writes incrementally without buffering the full graph in memory — without it, a million-node export will likely OOM.+ **Stream large graphs with `export_stream()`.** For graphs with more than 500k nodes, use `exporter.export_stream(graph, ...)` instead of building the full RDF string in memory. Streaming writes incrementally — without it, a million-node export will likely OOM.</Warning><Tip>diff --git a/docs/reference/graph_store.md b/docs/reference/graph_store.mdindex 2f4d10f7..afeb9a68 100644--- a/docs/reference/graph_store.md+++ b/docs/reference/graph_store.md@@ -48,13 +48,12 @@ icon: "server"```pythonstore.create_index(label="Person", property="name")store.create_index(label="Organization", property="name")- store.create_constraint(label="Organization", property="id", constraint_type="unique")```</Step>- <Step title="Bulk-load nodes and edges">+ <Step title="Load nodes and edges">```python- store.add_nodes_bulk(entities, batch_size=1000)- store.add_edges_bulk(relationships, batch_size=1000)+ store.create_nodes(entities)+ store.add_edges(relationships)```</Step><Step title="Query the graph">@@ -171,8 +170,8 @@ store.add_edge()# Bulk operations — use for large datasets-store.add_nodes_bulk(entities, batch_size=1000)-store.add_edges_bulk(relationships, batch_size=1000)+store.create_nodes(entities)+store.add_edges(relationships)# Deletestore.delete_node("node_id")@@ -266,13 +265,6 @@ all_paths = analytics.all_paths("alice", "charlie", max_hops=4)# Index for fast label lookupsstore.create_index(label="Person", property="name")-# Uniqueness constraint-store.create_constraint(- label="Organization",- property="id",- constraint_type="unique",-)-# Inspect current schemaschema = store.get_schema()print(schema["labels"])@@ -291,7 +283,7 @@ print(schema["constraints"])</Warning><Tip>- **Use `add_nodes_bulk()` and `add_edges_bulk()` for large datasets.** Individual `add_node()` calls issue one network round-trip each. Bulk operations batch thousands of writes into a single transaction — 10–100× faster for initial loads.+ **Use `create_nodes()` and `add_edges()` for loading multiple nodes and edges.** Individual `add_node()` calls issue one network round-trip each. Loading in bulk is significantly faster for initial graph population.</Tip><Warning>diff --git a/docs/reference/reasoning.md b/docs/reference/reasoning.mdindex 23df4e9e..63af28e2 100644--- a/docs/reference/reasoning.md+++ b/docs/reference/reasoning.md@@ -78,39 +78,14 @@ Reasoning turns sparse explicit knowledge into a dense, coherent, contradiction-))# Run inference — always call explicitly after adding facts/rules- result = reasoner.infer()+ result = reasoner.forward_chain()for inference in result.derived_facts:print(f"{inference.subject} {inference.predicate} {inference.obj}")print(f" Derived via: {inference.explanation}")```- ### Built-In Rule Templates-- No manual rule authoring required for the three most common patterns:-- ```python- engine = Reasoner()-- # Transitive closure: A→B, B→C ⟹ A→C- engine.apply_transitivity("located_in")-- # Symmetry: A knows B ⟹ B knows A- engine.apply_symmetry("knows")-- # Inverse: A parent_of B ⟹ B child_of A- engine.apply_inverse("parent_of", "child_of")-- result = engine.infer()- ```-- | Template | Parameters | Description |- | -------- | ---------- | ----------- |- | `apply_transitivity(predicate)` | `predicate: str` | Adds A→C rule for all A→B, B→C chains |- | `apply_symmetry(predicate)` | `predicate: str` | Adds B→A rule for every A→B fact |- | `apply_inverse(predicate, inverse)` | `predicate, inverse: str` | Adds inverse direction for every fact |-<Warning>- Always call `reasoner.infer()` after adding facts and rules. Adding them updates internal state but does **not** trigger inference automatically.+ Always call `reasoner.forward_chain()` after adding facts and rules. Adding them updates internal state but does **not** trigger inference automatically.</Warning></Tab>@@ -120,7 +95,7 @@ Reasoning turns sparse explicit knowledge into a dense, coherent, contradiction-```pythonfrom semantica.reasoning import GraphReasoner- graph_reasoner = GraphReasoner(kg)+ graph_reasoner = GraphReasoner()# Define a transitive ancestor rulegraph_reasoner.add_rule({@@ -131,7 +106,7 @@ Reasoning turns sparse explicit knowledge into a dense, coherent, contradiction-"then": {"subject": "?a", "predicate": "ancestor_of", "object": "?c"}})- inferences = graph_reasoner.infer(kg)+ inferences = graph_reasoner.reason(graph, query="")for inf in inferences:print(f"{inf['subject']} {inf['predicate']} {inf['object']}")```@@ -352,12 +327,18 @@ Different engines cover different expressivity levels — compose them for riche<Steps><Step title="Forward-chain structural rules with Reasoner">```python- from semantica.reasoning import Reasoner+ from semantica.reasoning import Reasoner, Rule, Fact, RuleTypeengine = Reasoner()- engine.apply_transitivity("located_in")- engine.apply_symmetry("colleague_of")- structural_result = engine.infer()+ engine.add_rule(Rule(+ rule_type=RuleType.FORWARD_CHAIN,+ conditions=[+ {"subject": "?x", "predicate": "located_in", "object": "?y"},+ {"subject": "?y", "predicate": "located_in", "object": "?z"}+ ],+ conclusion={"subject": "?x", "predicate": "located_in", "object": "?z"}+ ))+ structural_result = engine.forward_chain()```</Step><Step title="Pass derived facts to DatalogReasoner for recursive closure">@@ -400,7 +381,7 @@ Different engines cover different expressivity levels — compose them for riche## Tips and Common Pitfalls<Warning>- **Always call `reasoner.infer()` after adding facts and rules.** Adding facts and rules updates internal state but doesn't trigger inference automatically. Inference is a separate, explicit step.+ **Always call `reasoner.forward_chain()` after adding facts and rules.** Adding facts and rules updates internal state but doesn't trigger inference automatically. Inference is a separate, explicit step.</Warning><Tip>diff --git a/docs/reference/seed.md b/docs/reference/seed.mdindex 88609b5b..322c9259 100644--- a/docs/reference/seed.md+++ b/docs/reference/seed.md@@ -15,8 +15,8 @@ icon: "database"<Card title="SeedDataSource" icon="file-code">Typed source definition supporting CSV, JSON, SQL, API, and RDF with format-specific config.</Card>- <Card title="populate() & inject()" icon="circle-plus">- Inject named built-in datasets (companies, countries, currencies) or custom seed files into an existing graph.+ <Card title="Foundation Graph" icon="circle-plus">+ Build a foundation graph from all registered sources in one pass, ready to merge with extracted data.</Card><Card title="Merge Strategies" icon="arrows-merge">`seed_first`, `extracted_first`, and `smart_merge` with property-level conflict detection.@@ -97,7 +97,7 @@ icon: "database"})- manager.register_source_object(csv_source)+ manager.register_source("employees", "csv", csv_source.path, config=csv_source.config)```Best for: employee rosters, product lists, reference tables.@@ -169,9 +169,8 @@ icon: "database"| `validate_quality(seed_data)` | Check schema compliance, required fields, and duplicates || `integrate_with_extracted(seed, extracted, strategy)` | Merge seed and extracted graphs || `export_seed_data(path, format)` | Export seed graph to RDF (`turtle`, `json-ld`), JSON, or CSV |-| `populate(kg, dataset, count)` | Inject a named built-in dataset into an existing graph |-| `inject(kg)` | Merge all registered sources into `kg` without duplicating existing entities |-| `load_from_file(path)` | Load seed nodes from JSON, CSV, or RDF file into the manager |+| `load_from_csv(path)` | Load seed records from a CSV file |+| `load_from_json(path)` | Load seed records from a JSON file || `list_sources()` | List all registered source names and their formats || `get_version(name)` | Get the current version metadata for a named source |@@ -221,18 +220,18 @@ icon: "database"## Built-in Datasets-Inject canonical reference data without loading external files:+Register built-in reference datasets as named sources and load them into your foundation graph:```pythonfrom semantica.seed import SeedDataManager-from semantica.kg import GraphBuilder-kg = GraphBuilder().build(entities=entities, relationships=relationships)manager = SeedDataManager()-# Inject a named built-in dataset-manager.populate(kg, dataset="companies", count=100)-manager.populate(kg, dataset="countries")+# Register built-in reference sources by format and path+manager.register_source("countries", "csv", "data/iso_countries.csv")+manager.register_source("currencies", "json", "data/iso_currencies.json")++foundation_kg = manager.create_foundation_graph()```| Dataset | Content |@@ -304,14 +303,6 @@ print(f"Version: {version.version_id}")print(f"Hash: {version.checksum}")print(f"Records: {version.record_count}")print(f"Updated: {version.last_modified}")--# Compare versions to detect changes-old_version = manager.get_version("taxonomy", tag="previous")-if version.checksum != old_version.checksum:- diff = manager.diff_versions("taxonomy", old_version.version_id, version.version_id)- print(f"Added: {diff.added_count} records")- print(f"Removed: {diff.removed_count} records")- print(f"Changed: {diff.modified_count} records")```## YAML Configuration@@ -368,7 +359,7 @@ export SEMANTICA_SEED_MERGE_STRATEGY=seed_first</Tip><Tip>- **Track seed versions to detect drift.** Use `manager.get_version()` and `manager.diff_versions()` to detect when reference data changes between pipeline runs. If a taxonomy file changes, downstream entity normalisation and deduplication thresholds may need re-tuning — don't treat seed data as static.+ **Track seed versions to detect drift.** Use `manager.get_version()` to check the checksum and record count for each registered source between pipeline runs. If a taxonomy file changes, downstream entity normalisation and deduplication thresholds may need re-tuning — don't treat seed data as static.</Tip><Tip>diff --git a/docs/reference/split.md b/docs/reference/split.mdindex a07169c6..e13f0aa5 100644--- a/docs/reference/split.md+++ b/docs/reference/split.md@@ -71,7 +71,7 @@ Semantica's chunking methods are designed to avoid these failure modes.parsed = parser.parse("annual_report.pdf")splitter = TextSplitter(method="structural")- chunks = splitter.split_document(parsed)+ chunks = splitter.split_documents([parsed])for chunk in chunks:print(f"[h{chunk.metadata['heading_level']}] {chunk.metadata['section_title']}")@@ -258,7 +258,7 @@ splitter = TextSplitter(code_units=["function", "class"], # "function" | "class" | "method" | "block"chunk_overlap=0, # code units are self-contained)- chunks = splitter.split_document(parsed)+ chunks = splitter.split_documents([parsed])for chunk in chunks:print(f"{chunk.metadata['unit_type']}: {chunk.metadata['unit_name']}")@@ -266,7 +266,7 @@ splitter = TextSplitter(```**Key behaviours:**- - Requires a `ParsedDocument` from `CodeParser` — use `split_document()`+ - Requires a `ParsedDocument` from `CodeParser` — use `split_documents([parsed])`- `chunk_overlap=0` recommended — functions and classes are logically self-contained- If a class is too large, it is split at method boundaries automatically- Supported languages: Python, JavaScript, TypeScript, Java, Go, Rust, C, C++, C#, Ruby, PHP, Swift@@ -284,7 +284,7 @@ splitter = TextSplitter(parsed = parser.parse("annual_report.pdf")splitter = TextSplitter(method="structural")- chunks = splitter.split_document(parsed)+ chunks = splitter.split_documents([parsed])for chunk in chunks:level = chunk.metadata['heading_level']