mirror of
https://github.com/semantica-agi/semantica.git
synced 2026-08-29 04:26:20 +00:00
* feat(#401): temporal provenance, OWL-Time export, stable snapshot schema - ProvenanceTracker: auto-attach recorded_at (UTC) to every new record; add query_recorded_between(), revision_history(), export_audit_log() - RDFExporter.export_to_rdf: add include_temporal + time_axis params; emit OWL-Time triples (time:Interval, time:Instant, inXSDDateTimeStamp) for relationships with valid_from/valid_until; TemporalBound.OPEN represented via semantica:openEndedInterval instead of time:hasEnd - TemporalVersionManager.create_snapshot: stamp format_version "1.0" on every snapshot; add validate_snapshot() and migrate_snapshot() - New: semantica/kg/schemas/temporal_snapshot_v1.json (JSON Schema draft-2020) - Tests: 28 new tests covering all acceptance criteria (451 passing, 0 failed) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs(#401): add changelog entry for temporal provenance & export Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(#402): Temporal GraphRAG Integration — TemporalGraphRetriever & TemporalQueryRewriter - Add TemporalGraphRetriever to context_retriever.py (no new file per project convention) - Drop-in wrapper for ContextRetriever; filters related_entities/related_relationships via reconstruct_at_time(); at_time=None is a true passthrough - Returns new RetrievedContext objects (no in-place mutation) - Graceful ImportError if temporal modules unavailable - Add at_time + header_template to ContextRetriever._generate_reasoned_response() and query_with_reasoning() - Temporal header prepended to LLM context block only when at_time is set - Naive datetimes normalised to UTC before formatting - Header built with str.replace (not .format) to prevent format-string injection - Add TemporalQueryRewriter + TemporalQueryResult to semantica/kg/ - Regex-only (default) and LLM-assisted extraction modes - Resolves temporal phrases via TemporalNormalizer (deterministic, zero LLM) - Word-boundary guards on intent keywords; year fallback for noun-phrase dates - Never calls reconstruct_at_time — extraction only - Export TemporalGraphRetriever from semantica.context - Export TemporalQueryRewriter, TemporalQueryResult from semantica.kg - Add 99 tests across two new test files - tests/context/test_temporal_retriever.py (56 tests) - tests/kg/test_temporal_query_rewriter.py (43 tests) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs(#402): add changelog entry for Temporal GraphRAG Integration Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs: rewrite and polish documentation site (#413) - Rewrote index.md to match README (tagline, badges, Problem/Solution text) - Improved getting-started, concepts, quickstart, installation, faq, use-cases, contributing, glossary, learning-more, examples, modules, architecture, cookbook, deep-dive pages: tighter prose, fixed headings/bullets, removed inconsistencies and duplicate sections - Removed overuse of emojis from headings in integration pages (docling, snowflake) - Fixed change_management reference page: closed unclosed JSON code block that broke the right TOC, demoted noisy sub-headings to bold text - CSS layout: widened content area (max-width 1440px grid, left sidebar 11rem, right TOC narrowed to 11rem for broader content), tightened TOC spacing and font size, fixed word-wrap/overflow on TOC links - Added mkdocs_local.yml for local serving without mkdocs-jupyter plugin Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(#318): SHACL Shape Generation & Validation (Phase 1 + Phase 2) Phase 1 — Generation: - Add SHACLGenerator, SHACLGraph, NodeShape, PropertyShape to ontology_generator.py - 6-stage pipeline: class index → node shapes → property shapes → inheritance propagation → quality tier → serialization - Three output formats: Turtle, JSON-LD, N-Triples - Three quality tiers: basic / standard (default) / strict (sh:closed) - 3-level+ inheritance propagation, cycle-safe, no duplicate shapes - No-domain properties attach to all node shapes - OntologyEngine.to_shacl(), export_shacl() added to engine.py - RDFExporter.export_shacl() added to rdf_exporter.py Phase 2 — Runtime Validation: - Add SHACLViolation, SHACLValidationReport, _run_pyshacl to ontology_validator.py - OntologyEngine.validate_graph() with shacl= or ontology= arguments - explain_violations(): rule-based plain-English explanations for all 7 SHACL constraint types - summary(), to_dict() on SHACLValidationReport for pipeline and LLM consumers - pyshacl/rdflib are optional deferred imports (pip install semantica[shacl]) Security & reliability fixes: - Replace path-heuristic (len/newline) with os.path.exists() in validate_graph - Add shacl_format parameter to validate_graph and _run_pyshacl; thread format through correctly - Fix validate_output format alias map in to_shacl (json-ld, n-triples aliases) - Deep-copy PropertyShape in _propagate_inheritance (dataclasses.replace) — no shared mutable refs - Deterministic Turtle prefix output via sorted(graph.prefixes.items()) - Use full rdf:type URI in sh:ignoredProperties — no prefix dependency Tests & docs: - Add TestSHACLGeneration (16 tests) to test_ontology_comprehensive.py - Add TestSHACLHierarchicalAndValidation (18 tests) to test_ontology_advanced.py - 34 new tests, 0 failures, 0 regressions across 1111-test suite - Update README: Unreleased section, Features, Modules table, Ontology code block, Installation Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs(#318): add CHANGELOG entry for SHACL Shape Generation & Validation Covers Phase 1 (generation), Phase 2 (runtime validation), all 5 security/reliability fixes, test results, and README updates. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(#319): SKOS Vocabulary Module — namespace helpers, store helpers, OntologyEngine APIs, tests, docs Extends the existing ontology and triplet-store stack with first-class SKOS support without adding any new top-level packages. ### semantica/ontology/namespace_manager.py - `get_skos_uri(local_name)` — build full skos:core# URI from local name - `build_concept_scheme_uri(name)` — slug a human name into a stable ConceptScheme URI anchored at the configured base URI ### semantica/triplet_store/triplet_store.py - `add_skos_concept(concept_uri, scheme_uri, pref_label, ...)` — asserts ConceptScheme + Concept triples, prefLabel, altLabel, broader, narrower, related, definition, notation via existing `add_triplets()` API - `get_skos_concepts(scheme_uri=None)` — SPARQL SELECT via `execute_query()`, collapses multi-valued bindings into concept dicts ### semantica/ontology/engine.py - `list_vocabularies()` — list all skos:ConceptScheme instances - `list_concepts(scheme_uri)` — list concepts in a scheme with alt labels - `search_concepts(query, scheme_uri=None)` — case-insensitive substring search over prefLabel + altLabel; sanitises user input against SPARQL injection ### tests - `TestSKOSOntologyEngine` (14 tests) in test_ontology_comprehensive.py - `TestSKOSTripletStore` (6 tests) in test_triplet_store.py - All 1162 existing + new tests pass, 0 failures ### docs/reference/ontology.md - New "SKOS Vocabulary Management" section: data-model table, import examples (add_skos_concept + rdflib bulk), list/search API, NamespaceManager helpers Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs(#319): add CHANGELOG entry for SKOS Vocabulary Module Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * test: add comprehensive test suites for Temporal Semantics (#395) and all Unreleased changelog features - tests/test_395_temporal_semantics_comprehensive.py — 113 tests covering #396–#399: bitemporal model, temporal consistency validation, query time-range aggregation, ContextGraph.state_at(), causal chain trace_at_time() - tests/test_unreleased_changelog_comprehensive.py — 92 tests covering all unreleased changelog gaps: AgentContext checkpoints (#399), audit trail / named tags / rollback protection (#394), snapshot schema compatibility (#393), ContextGraph pagination & min_weight & thread safety (#385), SKOS helpers (#319), SHACL quality tiers & export (#318), OllamaProvider base_url (#408), DatalogReasoner multi-hop & graph load (#371) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: Context Explainability Output Fixes — regression tests and centrality fix - Fixed CentralityCalculator._build_adjacency() to handle ContextGraph edges (ContextEdge dataclass objects with source_id/target_id) so degree centrality and related algorithms return correct results instead of empty dicts - Added 23 regression tests in tests/context/test_context_explainability_regression.py covering readable decision text preservation, enriched causal/path outputs, PolicyEngine consistent metadata across Cypher and fallback branches, EntityLinker similarity payloads, and KG consumer compatibility - Updated CHANGELOG.md [Unreleased] to reflect the bug fix and test additions Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>