mirror of
https://github.com/semantica-agi/semantica.git
synced 2026-08-29 04:26:20 +00:00
- Migrate from mint.json to docs.json (Mintlify v4) - Theme: maple, emerald green + near-black dark / cream light palette (#059669 primary, #0A0A0A dark bg, #FAF7F0 light bg) - Typography: Lexend headings, Inter body - 5-tab navigation: Documentation, Quick Start, API Reference, Cookbook, FAQ - Homepage: removed badge stickers, redundant h2, added blockquote tagline, full 27-module reference table with semantica.mcp_server added - quickstart.md: CodeGroup per pipeline step, pattern vs LLM options, AccordionGroup for patterns and troubleshooting - faq.md: full AccordionGroup structure across 5 sections - reference/explorer.md: NEW — FastAPI explorer, Ontology Hub, Distance Intelligence, CLI reference, REST API endpoints - reference/mcp_server.md: NEW — MCP stdio server, 12 tools with I/O examples, 3 resources, Claude Desktop/VS Code/Windsurf/Cline config - docs.json: explorer added to Output group, mcp_server to Utilities group - Chat, feedback (thumbs/suggest/raise), OG/Twitter metadata, search topbar - All reference pages reformatted with Mintlify JSX components Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2.8 KiB
2.8 KiB
title, description, icon
| title | description | icon |
|---|---|---|
| Provenance Module | W3C PROV-O compliant lineage tracking, source attribution, and audit trails across all 17 modules. | link |
W3C PROV-O compliant provenance tracking for high-stakes domains requiring complete traceability.
Overview
The Provenance Module tracks the full lineage of every fact — from raw ingestion through extraction, reasoning, and export. Compliant with W3C PROV-O, suitable for HIPAA, SOX, GDPR, and FDA 21 CFR Part 11 environments.
ProvenanceManager
from semantica.provenance import ProvenanceManager
manager = ProvenanceManager()
# Track an entity
manager.track_entity(
entity_id="apple_inc",
source="annual_report_2023.pdf",
entity_type="Organization",
extraction_method="llm",
confidence=0.98
)
# Track a relationship
manager.track_relationship(
rel_id="steve_jobs_founded_apple",
source="annual_report_2023.pdf",
extraction_method="llm",
confidence=0.92
)
# Get full lineage
lineage = manager.get_lineage("apple_inc")
print(f"Source: {lineage.source}")
print(f"Extracted: {lineage.extracted_at}")
print(f"Method: {lineage.extraction_method}")
Activity Tracking
# Track a pipeline activity
activity_id = manager.start_activity(
activity_type="ner_extraction",
used=["annual_report_2023.pdf"],
generated=["apple_inc", "steve_jobs"]
)
manager.end_activity(activity_id)
# Query activities
activities = manager.get_activities(entity_id="apple_inc")
Lineage Graph
# Full lineage from source to current state
lineage_graph = manager.get_lineage_graph("apple_inc")
for node in lineage_graph.nodes:
print(f"{node.id}: {node.type} — {node.timestamp}")
W3C PROV-O Export
# Export provenance as W3C PROV-O Turtle
prov_ttl = manager.export_prov_o("apple_inc", format="turtle")
# Export full provenance graph
manager.export_all(path="provenance.ttl", format="turtle")
Integration with Other Modules
Provenance is automatically tracked when using GraphBuilderWithProvenance:
from semantica.kg import GraphBuilderWithProvenance
builder = GraphBuilderWithProvenance(provenance=True)
result = builder.build_single_source(graph_data)
# The builder records what was used to produce each node/edge
lineage = result.provenance_manager.get_lineage("entity_id")