|
| 1 | +--- |
| 2 | +title: "Choose the Right Module" |
| 3 | +description: "Map your goal to the right Semantica module in under 30 seconds." |
| 4 | +icon: "compass" |
| 5 | +--- |
| 6 | + |
| 7 | +<Info> |
| 8 | + Every module works independently — import only what you need. This page maps developer goals to starting points. The [Module Reference](modules) covers every module in depth. |
| 9 | +</Info> |
| 10 | + |
| 11 | +## Quick Reference |
| 12 | + |
| 13 | +Find your goal below. The **Module** column is your import path; **Key class** is what you instantiate first. |
| 14 | + |
| 15 | +| I want to... | Module | Key class | |
| 16 | +| :------------ | :------ | :--------- | |
| 17 | +| Load a PDF, DOCX, HTML, CSV, or archive | `ingest` | `FileIngestor` | |
| 18 | +| Crawl a website | `ingest` | `WebIngestor` | |
| 19 | +| Load Parquet files or partitioned datasets | `ingest` | `ParquetIngestor` | |
| 20 | +| Ingest XML with schema validation | `ingest` | `XMLIngestor` | |
| 21 | +| Ingest from SQL, Snowflake, Kafka, or email | `ingest` | `DBIngestor`, `SnowflakeIngestor`, `StreamIngestor` | |
| 22 | +| Extract clean text and tables from a document | `parse` | `DocumentParser` | |
| 23 | +| Parse complex PDFs with OCR or multi-column layout | `parse` | `DoclingParser` | |
| 24 | +| Chunk text for embedding or RAG | `split` | `TextSplitter` | |
| 25 | +| Normalize text, dates, entities, or encodings | `normalize` | `TextNormalizer`, `EntityNormalizer` | |
| 26 | +| Find named entities (people, orgs, locations) in text | `semantic_extract` | `NERExtractor` | |
| 27 | +| Extract typed relationships from text | `semantic_extract` | `RelationExtractor` | |
| 28 | +| Extract RDF subject–predicate–object triplets | `semantic_extract` | `TripletExtractor` | |
| 29 | +| Build a queryable knowledge graph | `kg` | `GraphBuilder` | |
| 30 | +| Add time-validity (`valid_from` / `valid_until`) to facts | `kg` | `TemporalGraphQuery` | |
| 31 | +| Run graph algorithms (centrality, communities, paths) | `kg` | `GraphAnalyzer`, `CentralityCalculator` | |
| 32 | +| Generate vector embeddings | `embeddings` | `EmbeddingGenerator` | |
| 33 | +| Store and search vectors | `vector_store` | `VectorStore` | |
| 34 | +| Persist a graph in Neo4j or FalkorDB | `graph_store` | `Neo4jStore`, `FalkorDBStore` | |
| 35 | +| Store RDF triples and query with SPARQL | `triplet_store` | `TripletStore` | |
| 36 | +| Deduplicate entities across sources | `deduplication` | `DuplicateDetector`, `EntityMerger` | |
| 37 | +| Detect and resolve contradictory facts | `conflicts` | `ConflictDetector`, `ConflictResolver` | |
| 38 | +| Give an AI agent persistent memory | `context` | `AgentContext` | |
| 39 | +| Ground LLM responses in a knowledge graph (GraphRAG) | `context` | `AgentContext.query_with_reasoning()` | |
| 40 | +| Record AI decisions with a full audit trail | `context` | `AgentContext.record_decision()` | |
| 41 | +| Search past decisions before making a new one | `context` | `AgentContext.find_precedents()` | |
| 42 | +| Trace the causal chain of a decision | `context` | `AgentContext.get_causal_chain()` | |
| 43 | +| Track where every fact came from (W3C PROV-O) | `provenance` | `ProvenanceManager` | |
| 44 | +| Version a graph with checksums and rollback | `change_management` | `TemporalVersionManager` | |
| 45 | +| Auto-generate an OWL schema from a graph | `ontology` | `OntologyGenerator` | |
| 46 | +| Validate a graph against SHACL constraints | `ontology` | `SHACLGenerator`, `OntologyValidator` | |
| 47 | +| Derive new facts from existing knowledge | `reasoning` | `Reasoner`, `GraphReasoner` | |
| 48 | +| Export to RDF Turtle, JSON-LD, or N-Triples | `export` | `RDFExporter` | |
| 49 | +| Export to Parquet for Spark / BigQuery | `export` | `ParquetExporter` | |
| 50 | +| Export for ArangoDB | `export` | `ArangoAQLExporter` | |
| 51 | +| Export to Neo4j or Memgraph via Cypher | `export` | `LPGExporter` | |
| 52 | +| Visualize a knowledge graph interactively | `visualization` | `KGVisualizer` | |
| 53 | +| Run a reproducible multi-step pipeline | `pipeline` | `PipelineBuilder` | |
| 54 | +| Use Semantica from Claude Desktop or Cursor | `mcp_server` | `semantica-mcp` | |
| 55 | +| Bootstrap a graph from verified seed data | `seed` | `SeedDataManager` | |
| 56 | +| Extend Semantica with a custom component | `core` | `PluginRegistry` | |
| 57 | + |
| 58 | + |
| 59 | +## Goal-by-Goal Starting Points |
| 60 | + |
| 61 | +Pick your goal to see the minimum imports and a working skeleton. |
| 62 | + |
| 63 | +<Tabs> |
| 64 | + <Tab title="Build a Knowledge Graph"> |
| 65 | + Turn documents, web pages, or databases into a structured, queryable graph. |
| 66 | + |
| 67 | + **Pipeline:** `ingest` → `parse` → `semantic_extract` → `kg` |
| 68 | + |
| 69 | + ```python |
| 70 | + from semantica.ingest import FileIngestor |
| 71 | + from semantica.parse import DocumentParser |
| 72 | + from semantica.semantic_extract import NERExtractor, RelationExtractor |
| 73 | + from semantica.kg import GraphBuilder |
| 74 | + |
| 75 | + sources = FileIngestor().ingest("report.pdf") |
| 76 | + parsed = DocumentParser().parse_document("report.pdf") |
| 77 | + |
| 78 | + # No API key required — pattern-based extraction |
| 79 | + entities = NERExtractor(method="pattern").extract(parsed) |
| 80 | + relationships = RelationExtractor(method="rule").extract(parsed, entities=entities) |
| 81 | + |
| 82 | + graph = GraphBuilder(merge_entities=True).build( |
| 83 | + sources=[{"entities": entities, "relationships": relationships}] |
| 84 | + ) |
| 85 | + print(f"{len(graph.nodes)} nodes, {len(graph.edges)} edges") |
| 86 | + ``` |
| 87 | + |
| 88 | + <Tip> |
| 89 | + Pass `method="pattern"` to `NERExtractor` for zero-cost, zero-API-key extraction. Switch to `method="llm"` with any of the supported providers for higher recall. |
| 90 | + </Tip> |
| 91 | + |
| 92 | + **Next:** [Quickstart →](quickstart) — full pipeline with visualization and export. |
| 93 | + </Tab> |
| 94 | + |
| 95 | + <Tab title="Build GraphRAG"> |
| 96 | + Ground every LLM response in a structured knowledge graph. Every claim links back to a source node. |
| 97 | + |
| 98 | + **Module:** `context` |
| 99 | + |
| 100 | + ```python |
| 101 | + from semantica.context import AgentContext, ContextGraph |
| 102 | + from semantica.vector_store import VectorStore |
| 103 | + from semantica.llms import Groq |
| 104 | + |
| 105 | + llm = Groq(model="llama-3.3-70b-versatile") |
| 106 | + |
| 107 | + context = AgentContext( |
| 108 | + vector_store=VectorStore(backend="faiss", dimension=768), |
| 109 | + knowledge_graph=ContextGraph(advanced_analytics=True), |
| 110 | + ) |
| 111 | + |
| 112 | + # Store facts — retrieval uses both vectors and graph structure |
| 113 | + context.store("Apple Inc. was co-founded by Steve Jobs in 1976 in Cupertino.") |
| 114 | + |
| 115 | + # GraphRAG query with multi-hop reasoning trace |
| 116 | + result = context.query_with_reasoning( |
| 117 | + "Who co-founded Apple?", |
| 118 | + llm_provider=llm, |
| 119 | + max_hops=2, |
| 120 | + ) |
| 121 | + print(result["response"]) # grounded answer |
| 122 | + print(result["reasoning_path"]) # multi-hop trace |
| 123 | + ``` |
| 124 | + |
| 125 | + **Next:** [Context module reference →](reference/context) |
| 126 | + </Tab> |
| 127 | + |
| 128 | + <Tab title="Add Agent Memory"> |
| 129 | + Give an AI agent persistent memory, decision tracking, and precedent search across sessions. |
| 130 | + |
| 131 | + **Module:** `context` |
| 132 | + |
| 133 | + ```python |
| 134 | + from semantica.context import AgentContext, ContextGraph |
| 135 | + from semantica.vector_store import VectorStore |
| 136 | + |
| 137 | + context = AgentContext( |
| 138 | + vector_store=VectorStore(backend="faiss", dimension=768), |
| 139 | + knowledge_graph=ContextGraph(advanced_analytics=True), |
| 140 | + decision_tracking=True, # required to use record_decision() |
| 141 | + ) |
| 142 | + |
| 143 | + # Store a memory |
| 144 | + context.store("GPT-4 outperforms GPT-3.5 on reasoning benchmarks by 40%.") |
| 145 | + |
| 146 | + # Record a decision with full causal context |
| 147 | + decision_id = context.record_decision( |
| 148 | + category="model_selection", |
| 149 | + scenario="Choose LLM for production reasoning pipeline", |
| 150 | + reasoning="GPT-4 benchmark advantage justifies cost increase", |
| 151 | + outcome="selected_gpt4", |
| 152 | + confidence=0.91, |
| 153 | + ) |
| 154 | + |
| 155 | + # Search past decisions before making a new one |
| 156 | + precedents = context.find_precedents("model selection", limit=5) |
| 157 | + |
| 158 | + # Trace what happened downstream from this decision |
| 159 | + chain = context.get_causal_chain(decision_id, direction="downstream") |
| 160 | + ``` |
| 161 | + |
| 162 | + <Note> |
| 163 | + `decision_tracking=True` is required. Without it, `record_decision()` raises `RuntimeError`. |
| 164 | + </Note> |
| 165 | + |
| 166 | + **Next:** [Context module reference →](reference/context) |
| 167 | + </Tab> |
| 168 | + |
| 169 | + <Tab title="Track Provenance"> |
| 170 | + W3C PROV-O lineage on every fact: source document, extraction method, timestamp, and checksum. |
| 171 | + |
| 172 | + **Modules:** `provenance`, `change_management` |
| 173 | + |
| 174 | + ```python |
| 175 | + from semantica.provenance import ProvenanceManager |
| 176 | + |
| 177 | + prov = ProvenanceManager() |
| 178 | + |
| 179 | + # Track an entity with full source details |
| 180 | + prov.track_entity( |
| 181 | + entity_id="entity_1", |
| 182 | + source="DOI:10.1371/journal.pone.0023601", |
| 183 | + source_location="Figure 2", |
| 184 | + confidence=0.92, |
| 185 | + ) |
| 186 | + |
| 187 | + # Retrieve the complete lineage for this entity |
| 188 | + lineage = prov.get_lineage("entity_1") |
| 189 | + |
| 190 | + # Version-control the graph with SHA-256 checksums |
| 191 | + from semantica.change_management import TemporalVersionManager |
| 192 | + |
| 193 | + manager = TemporalVersionManager() |
| 194 | + snapshot = manager.create_snapshot(kg, "v1.0", "user@example.com", "Initial build") |
| 195 | + diff = manager.diff("v1.0", "v1.1") |
| 196 | + ``` |
| 197 | + |
| 198 | + **Next:** [Provenance reference →](reference/provenance) · [Change Management reference →](reference/change_management) |
| 199 | + </Tab> |
| 200 | + |
| 201 | + <Tab title="Export"> |
| 202 | + Serialize your knowledge graph for the semantic web, analytics platforms, or graph databases. |
| 203 | + |
| 204 | + **Module:** `export` |
| 205 | + |
| 206 | + ```python |
| 207 | + from semantica.export import RDFExporter, ParquetExporter, LPGExporter, ArangoAQLExporter |
| 208 | + |
| 209 | + # RDF — multiple serialization formats |
| 210 | + RDFExporter().export(graph, "graph.ttl", format="turtle") |
| 211 | + RDFExporter().export(graph, "graph.jsonld", format="jsonld") |
| 212 | + |
| 213 | + # Parquet — for Spark, BigQuery, Databricks, Snowflake |
| 214 | + ParquetExporter().export(graph, "output/graph.parquet") |
| 215 | + |
| 216 | + # Neo4j / Memgraph via Cypher |
| 217 | + LPGExporter().export(graph, "graph.cypher") |
| 218 | + |
| 219 | + # ArangoDB AQL inserts |
| 220 | + ArangoAQLExporter().export(graph, "graph.aql") |
| 221 | + ``` |
| 222 | + |
| 223 | + **Formats:** Turtle · JSON-LD · N-Triples · RDF/XML · Parquet · Cypher · Arrow · OWL · CSV · ArangoDB AQL |
| 224 | + |
| 225 | + **Next:** [Export module reference →](reference/export) |
| 226 | + </Tab> |
| 227 | + |
| 228 | + <Tab title="MCP — Claude / Cursor"> |
| 229 | + Use Semantica from Claude Desktop, Cursor, VS Code, or any MCP-aware tool — no Python code required after setup. 12 tools available instantly. |
| 230 | + |
| 231 | + **Step 1 — Install:** |
| 232 | + ```bash |
| 233 | + pip install semantica |
| 234 | + ``` |
| 235 | + |
| 236 | + **Step 2 — Add to your MCP client config:** |
| 237 | + |
| 238 | + <CodeGroup> |
| 239 | + |
| 240 | + ```json Claude Desktop / Windsurf / Cline |
| 241 | + { |
| 242 | + "mcpServers": { |
| 243 | + "semantica": { |
| 244 | + "command": "semantica-mcp" |
| 245 | + } |
| 246 | + } |
| 247 | + } |
| 248 | + ``` |
| 249 | + |
| 250 | + ```json Cursor / VS Code / Continue |
| 251 | + { |
| 252 | + "mcpServers": { |
| 253 | + "semantica": { |
| 254 | + "command": "semantica-mcp", |
| 255 | + "env": { |
| 256 | + "SEMANTICA_KG_PATH": "/path/to/my_graph.json" |
| 257 | + } |
| 258 | + } |
| 259 | + } |
| 260 | + } |
| 261 | + ``` |
| 262 | + |
| 263 | + </CodeGroup> |
| 264 | + |
| 265 | + **Available tools:** `extract_entities` · `extract_relations` · `add_entity` · `add_relationship` · `record_decision` · `query_decisions` · `find_precedents` · `get_causal_chain` · `run_reasoning` · `get_graph_analytics` · `export_graph` · `get_graph_summary` |
| 266 | + |
| 267 | + <Warning> |
| 268 | + Set `SEMANTICA_KG_PATH` to persist your graph across restarts. Without it, all data is lost when the server process exits. |
| 269 | + </Warning> |
| 270 | + |
| 271 | + **Next:** [MCP Server reference →](reference/mcp_server) |
| 272 | + </Tab> |
| 273 | +</Tabs> |
| 274 | + |
| 275 | + |
| 276 | +## Still Unsure? |
| 277 | + |
| 278 | +<AccordionGroup> |
| 279 | + <Accordion title="Knowledge graph vs. vector store — which do I need?" icon="scale-balanced"> |
| 280 | + Use a **knowledge graph** (`kg`) when you need structured reasoning, multi-hop traversal, provenance, or compliance audit trails. |
| 281 | + |
| 282 | + Use a **vector store** (`vector_store`) when you need fast fuzzy similarity search over large text corpora and relationships between items don't matter. |
| 283 | + |
| 284 | + Use **both together** via `AgentContext` (GraphRAG) to get grounded LLM responses where every claim traces back to a source node. |
| 285 | + |
| 286 | + See also: [Core Concepts](concepts) |
| 287 | + </Accordion> |
| 288 | + |
| 289 | + <Accordion title="I just want to run something quickly." icon="rocket"> |
| 290 | + Start with the [Quickstart](quickstart). It builds a complete pipeline (ingest → parse → extract → graph → visualize → export) with no API key required. |
| 291 | + </Accordion> |
| 292 | + |
| 293 | + <Accordion title="I'm adding Semantica to an existing agent — what's the minimum?" icon="plug"> |
| 294 | + Add `AgentContext`. It wraps your existing agent with memory, decision tracking, and precedent search — no changes to your LLM provider or agent framework needed. |
| 295 | + |
| 296 | + ```python |
| 297 | + from semantica.context import AgentContext, ContextGraph |
| 298 | + from semantica.vector_store import VectorStore |
| 299 | + |
| 300 | + context = AgentContext( |
| 301 | + vector_store=VectorStore(backend="faiss", dimension=768), |
| 302 | + knowledge_graph=ContextGraph(advanced_analytics=True), |
| 303 | + decision_tracking=True, |
| 304 | + ) |
| 305 | + ``` |
| 306 | + |
| 307 | + [Context module reference →](reference/context) |
| 308 | + </Accordion> |
| 309 | + |
| 310 | + <Accordion title="I need a compliance-ready pipeline — what's the minimum stack?" icon="shield-check"> |
| 311 | + | Layer | Module | Key class | |
| 312 | + | :---- | :------ | :--------- | |
| 313 | + | Ingestion | `ingest` | `FileIngestor` | |
| 314 | + | Extraction | `semantic_extract` | `NERExtractor` | |
| 315 | + | Graph | `kg` | `GraphBuilder` | |
| 316 | + | Lineage | `provenance` | `ProvenanceManager` | |
| 317 | + | Versioning | `change_management` | `TemporalVersionManager` | |
| 318 | + | Audit export | `export` | `RDFExporter` | |
| 319 | + Supports HIPAA, SOX, GDPR, and FDA 21 CFR Part 11 audit requirements. |
| 320 | + </Accordion> |
| 321 | +</AccordionGroup> |
| 322 | + |
| 323 | +--- |
| 324 | + |
| 325 | +- [Quickstart](quickstart) — Full pipeline in 5 minutes. |
| 326 | +- [Module Reference](modules) — Every module with examples and common chains. |
| 327 | +- [API Reference](reference/context) — Complete class and method documentation. |
0 commit comments