Semantic Core Epic
User Journey
The Semantic Core bounded context serves as the central DSL processing engine for the SEA™ platform. It parses, compiles, and validates SEA-DSL specifications across all contexts, ensuring unified business semantics, automated rule enforcement, semantic context for AI agents, and dynamic knowledge discovery through the Knowledge Graph.
Jobs to be Done & EARS Requirements
Job: Define Unified Business Semantics
User Story: As a Business Analyst, I want to define a new business policy using SEA™ DSL, so that it is consistently applied across all enterprise systems and understood by AI agents.
EARS Requirement:
- When a business user defines business concepts and rules in the SEA™ DSL, the semantic-core context shall:
- Parse DSL document via ParseDocument flow using tree-sitter-sea grammar
- Generate AST (Abstract Syntax Tree) with complete syntax node hierarchy
- Compile to IR (Intermediate Representation) via CompileToIR flow
- Generate executable manifest via GenerateManifest flow with code generation targets
- Validate semantics via ValidateSemantics flow checking business rules
- Store validated specifications in Knowledge Graph for enterprise-wide access
- Ensure deterministic output: same input produces same AST, IR, and manifest
Job: Enforce Automated Business Rules
User Story: As a Compliance Officer, I want the system to automatically flag transactions that violate regulatory business rules, so that I can ensure continuous compliance.
EARS Requirement:
- When a business rule is violated, the semantic-core context shall:
- Detect rule violation through continuous validation monitoring
- Identify specific rule and violation details from DSL specification
- Trigger predefined action based on violation severity:
- Alert: Notify stakeholders with violation details
- Block Transaction: Prevent non-compliant operation
- Suggest Correction: Provide remediation guidance
- Log violation event for audit trail and reporting
- Update violation metrics for compliance dashboards
Job: Provide Semantic Context for AI
User Story: As the Artifact Engine, I want to query the Knowledge Graph for semantic relationships between business entities, so that I can generate highly relevant cognitive artifacts.
EARS Requirement:
- When an AI agent accesses the knowledge base, the semantic-core context shall:
- Query Knowledge Graph for semantic relationships using SPARQL
- Retrieve rich, semantically grounded context including:
- Business entity definitions and relationships
- Policy rules and constraints
- Domain concepts and vocabulary
- Enable accurate and context-aware AI responses
- Support relationship traversal for complex semantic reasoning
Job: Enable Dynamic Knowledge Discovery
User Story: As a Business Analyst, I want to perform a graph traversal query to identify indirect dependencies between products and suppliers, so that I can assess supply chain risks.
EARS Requirement:
- When a knowledge worker explores the knowledge base, the semantic-core context shall:
- Accept SPARQL graph traversal queries with traversal constraints:
- maxDepth, maxNodesVisited, timeoutMs
- Navigate complex relationships between entities within constraints
- Infer new insights from connected knowledge
- Return query results with relationship paths and evidence:
- Intermediate nodes with types
- Relationship labels and directions
- Confidence scores
- Source citations (DSL specs, entities)
- Provide result format definition:
- JSON-LD or ordered list of triples with optional visualization payload
- Support informed decision-making through knowledge exploration
Job: Enforce SHACL Validation at Runtime
User Story: As the Knowledge Graph Operator, I want to enable SHACL enforcement per context with clear diagnostics and migration guidance, so that I can safely roll out validation without disrupting production.
EARS Requirement:
- When SHACL validation is enabled, the semantic-core context shall:
- Enforce SHACL shapes consistently across contexts with configurable modes:
- strict (block writes), permissive (log-only), per-context overrides
- Guarantee knowledge graph integrity through constraint validation
- Provide detailed diagnostics for validation failures:
- Specific constraint violations
- Entity and property paths causing errors
- Severity levels (error, warning, info) aligned with the canonical severity taxonomy
- Generate migration guidance for controlled rollout:
- Step-by-step remediation instructions
- Impact analysis for validation changes
- Rollback procedures if needed
- Support per-context enablement for gradual deployment
- Meet performance requirements:
- Synchronous validate-on-write target <100ms for single-entity writes
- Asynchronous batch validation for large graphs
- Optional validate-on-read for high-risk queries
- Emit observability metrics:
- Validation latency, error rates, and violation counts
- Rollout impact metrics (throughput, resource usage)
Domain Entities Summary
Root Aggregates
- DSLDocument: Represents a SEA-DSL specification file with content, namespace, version, and parsing status
- ASTNode: Abstract Syntax Tree node representing parsed DSL structure with type, properties, and children
- IRRepresentation: Intermediate Representation for compilation with optimized structure and metadata
- Manifest: Executable specification with code generation targets and configuration
- KnowledgeGraphEntry: RDF triple stored in Knowledge Graph with subject, predicate, and object
- SHACLShape: Validation constraint definition with target class, property constraints, and severity
Value Objects
- ValidationResult: Outcome of semantic validation with status, errors, warnings, and diagnostics
- RelationshipPath: Traversal path through Knowledge Graph showing entity connections
- MigrationGuide: Step-by-step instructions for SHACL validation rollout
Policy Rules
- DeterministicCompilation: Same DSL input must produce identical AST, IR, and manifest
- GraphIntegrity: Knowledge Graph must maintain referential integrity and consistency
- SHACLSafety: Validation failures must not corrupt data or prevent rollbacks
Integration Points
- All Bounded Contexts: Processes SEA-DSL specifications for every context in the platform
- Knowledge Graph (Oxigraph): RDF triple store for semantic relationships and SPARQL queries
- Cognitive Extension Context: Provides semantic grounding for AI agent responses
- Query Context: Supplies parsed policy structure for RAG retrieval
- Governance Runtime Context: Provides validated specifications for enforcement
- Developer Tooling Context: Integrates with LSP for real-time validation feedback
- Ingest Context: Processes ingested policies through DSL compilation pipeline