Framework orchestration, lifecycle management, configuration, and plugin system.
semantica.core is the coordination layer for the framework:
Semantica orchestrator coordinates the full KG construction pipeline from a YAML config
ConfigManager loads YAML config with deep-merge, validation, and environment variable overrides
PluginRegistry enables dynamic component registration and loading at runtime
LifecycleManager manages startup/shutdown with health monitoring and lifecycle hooks
Use individual modules directly for the vast majority of use cases. Reach for semantica.core only when you need application-level lifecycle management, centralized config, or a plugin system.
Semantica — High-level orchestrator: coordinates the full KG construction pipeline from a single config.yaml. Entry point for application-level deployments.
ConfigManager — YAML config with deep-merge, SEMANTICA_ env var overrides, and dot-notation nested key access. Keeps secrets out of source files.
LifecycleManager — Ordered startup/shutdown hooks, health monitoring, and a 6-state machine. Essential for long-running services like FastAPI apps.
PluginRegistry — Register custom ingestors, parsers, exporters, or any component. Load them by name at runtime: no imports required.
llm_provider: name: openai model: gpt-4o # Do not put API keys in YAML: use environment variables instead. # ConfigManager loads YAML with yaml.safe_load(), which does not # interpolate ${...} expressions. Set secrets via env vars (see below).processing: batch_size: 32 max_workers: 4quality: min_confidence: 0.7logging: level: INFO
Environment variable overrides (prefix SEMANTICA_):Use double underscores (__) to produce a dot separator for nested key access. The implementation strips the SEMANTICA_ prefix, lowercases the result, and replaces __ with . before calling set_nested_value() on the config dict.
Manages framework state with a defined state machine and ordered startup/shutdown hooks:State machine:UNINITIALIZED → INITIALIZING → READY → RUNNING → STOPPING → STOPPED
from semantica.core import LifecycleManagermanager = LifecycleManager()def init_db(): print("Initializing database...")def cleanup_db(): print("Closing database connections...")# Lower priority values run first during startup# Higher priority values run first during shutdownmanager.register_startup_hook(init_db, priority=10)manager.register_shutdown_hook(cleanup_db, priority=10)manager.startup()# Component health monitoringclass DatabaseComponent: def health_check(self): return {"healthy": True, "message": "Connected"}manager.register_component("database", DatabaseComponent())summary = manager.get_health_summary()# → {# "state": "ready",# "is_healthy": True,# "total_components": 1,# "healthy_components": 1,# "unhealthy_components": 0,# "last_check": 1234567890.0,# "components": {# "database": {"healthy": True, "message": "Connected", "timestamp": ...}# }# }manager.shutdown(graceful=True)
from semantica.semantic_extract import NERExtractor
Build a knowledge graph
from semantica.kg import GraphBuilder
Multi-step pipeline
from semantica.pipeline import Pipeline
App-level lifecycle + config
from semantica.core import Semantica, ConfigManager
Custom dispatch / plugins
from semantica.core import method_registry, PluginRegistry
Use Semantica and LifecycleManager only when building a long-running application (e.g. a FastAPI service) that needs ordered startup, health checks, and graceful shutdown. For scripts and notebooks, use individual modules directly.
Pipeline — Pipeline execution and step orchestration.