semantica.pipeline lets you chain Semantica components into reproducible, fault-tolerant workflows:
- Per-step failure strategies:
skip,retry,abort, orfallback - Parallel workers via
ParallelismManager: thread or process pool PipelineValidatorcatches cycles, missing handlers, and config errors before running- Pre-built templates:
"document_processing","rag_pipeline","kg_construction","ontology_generation" - Pipelines are serializable to YAML: save and reload in any environment
Exported Classes
Why Use a Pipeline?
You could wire Semantica modules together with plain Python code. Pipelines add:- Retry and failure handling — A single bad document doesn’t crash a 10,000-document run.
- Parallelism — Run extraction across multiple workers with one parameter.
- Progress tracking — tqdm console bar or WebSocket streaming to Explorer.
- Reproducibility — Save the exact pipeline configuration to YAML and replay on any machine.
- Delta mode — On re-runs, only process documents that changed since the last run.
- Validation — Catch misconfigured steps and dependency cycles before they fail mid-run.
Use plain module calls for quick scripts and notebooks. Use pipelines for anything you run repeatedly, at scale, or in production.
Quick Start
1
Build a pipeline
2
Validate before running
3
Execute and inspect results
Parallel Processing
Set parallelism on the builder and passmax_workers to ExecutionEngine:
Retry and Error Handling
- Exponential backoff (recommended)
- Linear backoff
- Fixed backoff
Failure Strategies
Progress Tracking
- Console (tqdm)
- Live status check
Pipeline DSL
PipelineBuilder uses add_step(name, type, **config) and connect_steps(from, to) to define a DAG:
Serialize and Restore Pipelines
PipelineSerializer converts a pipeline to JSON or dict for storage and reloads it later:
Pre-Built Templates
PipelineTemplateManager wires common workflows with the correct step order: no manual wiring required:
create_pipeline_from_template(name) method returns a configured PipelineBuilder. Call .build(pipeline_name) on it to produce a runnable Pipeline.
-
document_processing — Ingest → Parse → Normalize → Extract → Embed → Build KG — Complete document processing from ingestion to knowledge graph.
-
rag_pipeline — Ingest → Chunk → Embed → Store Vectors — RAG pipeline for question answering: builds a vector-indexed store.
-
kg_construction — Ingest → Extract Entities → Extract Relations → Dedup → Resolve → Build Graph — Knowledge graph construction from multiple sources.
-
ontology_generation — Extract Concepts → Infer Classes → Infer Properties → Generate OWL → Validate — Ontology generation from extracted data.
ExecutionEngine
Fine-grained control over pipeline execution: pause, resume, cancel, and inspect live progress:PipelineValidator
Catches problems before they surface as mid-run failures:- Dependency cycle detection: A depends on B, B depends on A
- Step type validation: each step type must be registered
- Connection integrity: referenced step names must exist
- Configuration completeness: required parameters must be present
ParallelismManager
- Thread pool (I/O-bound)
- Process pool (CPU-bound)
ResourceScheduler
Prevents memory oversubscription on large runs:Delta Mode
Re-process only data that has changed since the last run:Delta detection uses SHA-256 checksums on source content. Only sources whose checksum differs from
base_version_id are passed to downstream steps. For pipelines that run hourly or daily against a growing corpus, delta mode eliminates redundant re-embedding and re-extraction.SPARQL CONSTRUCT Template Steps
Use the"construct_template" step type to render and execute a SPARQL CONSTRUCT template as part of a pipeline. store_backend and construct_template_registry are execution-time resources, not step config — pass them to execute_pipeline(), the same way delta_mode steps receive version_manager and triplet_store:
construct_template steps raise ProcessingError if store_backend or construct_template_registry is missing from execute_pipeline()’s options, and ValidationError if template_name isn’t registered.Schemas
ExecutionResult schema
ExecutionResult schema
PipelineStep schema
PipelineStep schema
StepStatus enum
StepStatus enum
- Ingest — First step in most pipelines.
- Semantic Extract — Core extraction step.
- Knowledge Graph — Graph construction step.
- Export — Final output step.
