Commit Graph
1321 Commits
Author SHA1 Message Date
KaifAhmad1andClaude Sonnet 4.6 f7170cd6df fix(security): resolve CodeQL alerts #4, #5, #9, #10
- fix(redos) #10: replace capturing group with non-capturing group in
  naming_conventions.py to eliminate exponential backtracking (py/redos)
- fix(html-filter) #4: update script/iframe end-tag regex to match
  tags with trailing attributes e.g. </script foo="bar"> (py/bad-tag-filter)
- fix(regex-range) #9: replace overly broad [$-_] character range with
  explicit safe-char list in email_ingestor.py URL pattern (py/overly-large-range)
- fix(info-exposure) #5: replace str(exc) with a generic error message
  and log the full stack trace server-side in export_import.py (py/stack-trace-exposure)

Closes #4, Closes #5, Closes #9, Closes #10

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 15:20:07 +05:30
Mohd Kaif 0f1d262327 Merge pull request #428 from Hawksight-AI/security-enhancement
ci(codeql): add CodeQL workflow to auto-close security alerts on push…
2026-03-30 20:20:25 +05:30
KaifAhmad1andClaude Sonnet 4.6 6390138edc fix(codeql): remove 403-failing disable step; dismiss fixed alerts via API
GITHUB_TOKEN cannot change Default Setup (requires admin rights — HTTP 403).
Removed the disable-default-setup job entirely.

New approach:
- analyze job: runs CodeQL with upload:false then uploads SARIF via
  upload-sarif with continue-on-error:true so the workflow does not fail
  if Default Setup is still active
- dismiss-fixed-alerts job: runs on push to main, fetches all open alerts
  matching the 3 fixed rule IDs and dismisses them via PATCH API which
  only requires security-events:write (no admin needed)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 20:17:18 +05:30
KaifAhmad1andClaude Sonnet 4.6 8b47c148c5 fix(codeql): split disable-default-setup into separate job with confirmation
The previous fix used || true in a single-step which masked API failures
and had no propagation delay — Default Setup remained active when the
SARIF upload ran, causing the same conflict error.

Changes:
- New job `disable-default-setup` runs first: calls the API, waits 30s,
  then polls to confirm state=not-configured before exiting
- `analyze` job depends on `disable-default-setup` via `needs:` so CodeQL
  only runs after the state change is confirmed propagated

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 20:15:13 +05:30
KaifAhmad1andClaude Sonnet 4.6 8eae75c03a fix(codeql): disable Default Setup before Advanced Setup analysis
Advanced Setup and Default Setup cannot run simultaneously — SARIF upload
fails with "cannot be processed when the default setup is enabled".

Added a pre-analysis step that calls the GitHub code-scanning API to switch
Default Setup to not-configured before CodeQL runs, eliminating the conflict.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 20:10:56 +05:30
KaifAhmad1andClaude Sonnet 4.6 9eb7ea97d0 ci(codeql): add CodeQL workflow to auto-close security alerts on push to main
Adds explicit CodeQL analysis workflow triggered on push/PR to main and
weekly schedule. Without this, GitHub Default Setup only runs on a
schedule — alerts do not re-scan after a PR merge, leaving fixed
vulnerabilities still shown as open.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 20:04:06 +05:30
Mohd Kaif cd07e02db6 Merge pull request #427 from Hawksight-AI/security-enhancement
fix(security): resolve CodeQL alerts for logging, URL sanitization, a…
2026-03-30 19:55:09 +05:30
KaifAhmad1andClaude Sonnet 4.6 dfb51f8b54 docs(changelog): add security-enhancement CodeQL alert remediation entry
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 19:52:15 +05:30
KaifAhmad1andClaude Sonnet 4.6 1d88c06cbb fix(security): resolve CodeQL alerts for logging, URL sanitization, and workflow permissions
- Remove api_key debug print blocks from relation_extractor.py and triplet_extractor.py (CWE-532 clear-text logging)
- Replace URL substring check with exact equality in test_web_ingestor.py (CWE-20 incomplete sanitization)
- Add `permissions: contents: read` to benchmark.yml and security.yml workflows (least-privilege)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 19:46:30 +05:30
Mohd Kaif 033eaab108 Merge pull request #426 from ZohaibHassan16/feat/explorer-vocab-api
feat: SKOS Vocabulary API & Hierarchy Engine
2026-03-30 19:26:04 +05:30
Mohd Kaif 9a81034336 Merge branch 'main' into feat/explorer-vocab-api 2026-03-30 19:21:05 +05:30
KaifAhmad1andClaude Sonnet 4.6 664e343914 docs(changelog): add PR #426 SKOS Vocabulary REST API & Hierarchy Engine entry
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 19:20:22 +05:30
KaifAhmad1andClaude Sonnet 4.6 f677b638e2 fix(explorer): resolve test crash, import error handling, cycle safety, and missing utils package
- test_vocabulary.py: remove sys.modules['spacy'] = MagicMock() — caused
  ValueError in pytest collection when transformers called
  importlib.util.find_spec('spacy') on a MagicMock without __spec__;
  add setup_function() reset_mock() to prevent cross-test state pollution;
  expand from 3 to 16 tests covering narrower edges, topConceptOf,
  hasTopConcept, flat scheme, empty scheme, missing param, cycle safety,
  .rdf/.owl format path, invalid file 422, and metadata envelope fallback
- vocabulary.py: /import returned HTTP 200 with {"status":"error"} on parse
  failure — now raises HTTPException(422) so clients get a proper error code;
  replace bare except with ValueError-specific catch, move add_nodes/add_edges
  outside the try block
- vocabulary.py: get_hierarchy tree assembly had no cycle detection — cyclic
  broader/narrower edges in real-world SKOS data would cause infinite recursion
  during Pydantic serialization; replaced inline loop with recursive
  _attach_children() that carries a visited set
- semantica/explorer/utils/: branch was based on main and missing rdf_parser.py
  and __init__.py (introduced in #425); copied from ebd2be3 so vocabulary.py
  import resolves correctly
- tests/explorer/test_rdf_parser.py: carried forward from #425 (32 tests)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 19:02:24 +05:30
ZohaibHassan16 2537976e8f feat(explorer): implement SKOS vocabulary routes and integration tests 2026-03-30 17:01:11 +05:00
ZohaibHassan16 5cf49bf799 feat(explorer): implement SKOS vocabulary routes and schemes 2026-03-30 17:01:11 +05:00
Mohd Kaif c4d72ee3fc Merge pull request #425 from ZohaibHassan16/feat/explorer-infra-integration
feat(explorer): integrate API routers and add RDF parsing util
2026-03-30 17:17:23 +05:30
KaifAhmad1andClaude Sonnet 4.6 7a879a3508 docs(changelog): add PR #425 Explorer server integration & RDF parsing util entry
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 17:04:01 +05:30
KaifAhmad1andClaude Sonnet 4.6 ebd2be3d9d fix(explorer): resolve router isolation, rdf_parser param shadow, and missing utils package
- server.py: split vocabulary router into its own try/except so a missing
  vocabulary module (pending #421) cannot prevent the 7 existing routers
  from mounting
- rdf_parser.py: rename `format` param to `rdf_format` to avoid shadowing
  the Python builtin; add exception chaining (raise...from e); document
  the silent edge-drop behaviour for cross-vocabulary URIs
- Add semantica/explorer/utils/__init__.py (package was not importable)
- Add tests/explorer/test_rdf_parser.py: 32 tests covering node/edge
  extraction, label priority, altLabel dedup, all 6 SKOS edge types,
  orphan-edge filtering, empty graph, error cases, and RDF/XML format

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 16:40:43 +05:30
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> bc33bf9340 ci(deps): bump actions/deploy-pages from 4 to 5 (#423)
Bumps [actions/deploy-pages](https://github.com/actions/deploy-pages) from 4 to 5.
- [Release notes](https://github.com/actions/deploy-pages/releases)
- [Commits](https://github.com/actions/deploy-pages/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/deploy-pages
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-30 15:44:31 +05:30
dependabot[bot]anddependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> 77e50127c8 ci(deps): bump actions/configure-pages from 4 to 6 (#424)
Bumps [actions/configure-pages](https://github.com/actions/configure-pages) from 4 to 6.
- [Release notes](https://github.com/actions/configure-pages/releases)
- [Commits](https://github.com/actions/configure-pages/compare/v4...v6)

---
updated-dependencies:
- dependency-name: actions/configure-pages
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-03-30 15:35:57 +05:30
ZohaibHassan16 73af7d5bfc feat(explorer): integrate API routers and add RDF parsing util 2026-03-30 15:04:46 +05:00
Mohd KaifandClaude Sonnet 4.6 e30ef6cb76 Kg Context Explainability Output Fixes (#419)
* 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>
2026-03-29 13:03:52 +05:30
Mohd KaifandClaude Sonnet 4.6 cf7a78fa10 test: add comprehensive test suites for Temporal Semantics (#395) and all Unreleased changelog features (#417)
- 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>
2026-03-28 18:48:04 +05:30
Mohd Kaif ebfce8c5ab Merge pull request #416 from Hawksight-AI/ontology
feat(#319): SKOS Vocabulary Module
2026-03-28 14:23:40 +05:30
KaifAhmad1andClaude Sonnet 4.6 34bc7a45b9 docs(#319): add CHANGELOG entry for SKOS Vocabulary Module
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-28 14:15:02 +05:30
KaifAhmad1andClaude Sonnet 4.6 71d037f581 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>
2026-03-28 13:59:23 +05:30
Mohd Kaif 6651386074 Merge pull request #415 from Hawksight-AI/ontology
SHACL Shape Generation & Validation
2026-03-27 18:08:03 +05:30
KaifAhmad1andClaude Sonnet 4.6 a219c2f44e 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>
2026-03-27 17:56:07 +05:30
KaifAhmad1andClaude Sonnet 4.6 dae368532c 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>
2026-03-27 17:42:46 +05:30
Mohd KaifandClaude Sonnet 4.6 b282487b17 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>
2026-03-26 18:38:21 +05:30
Mohd Kaif 21c7933ec1 Merge pull request #412 from Hawksight-AI/context
feat(#402): Temporal GraphRAG Integration — TemporalGraphRetriever & …
2026-03-26 14:43:21 +05:30
KaifAhmad1andClaude Sonnet 4.6 c46e531dcd docs(#402): add changelog entry for Temporal GraphRAG Integration
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 14:40:41 +05:30
KaifAhmad1andClaude Sonnet 4.6 0f0800f109 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>
2026-03-26 14:20:38 +05:30
Mohd KaifandClaude Sonnet 4.6 9e68266563 feat(#401): Temporal Provenance & Export (#411)
* 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>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 12:38:24 +05:30
Mohd Kaif c66f8160dd Merge pull request #410 from Hawksight-AI/semantic-extract
feat(semantic-extract): temporal metadata extraction from text (#400)
2026-03-25 22:33:06 +05:30
KaifAhmad1andClaude Sonnet 4.6 b1e1c9f0d9 docs(changelog): add entry for temporal metadata extraction (#400)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 22:31:06 +05:30
Mohd Kaif cef2b4314a Delete PR_DESCRIPTION_SEMANTIC_EXTRACT.md 2026-03-25 22:28:37 +05:30
KaifAhmad1andClaude Sonnet 4.6 b9af181625 feat(semantic-extract): temporal metadata extraction from text (#400)
- Add `extract_temporal_bounds: bool = False` to `extract_relations_llm()`.
  When True the LLM prompt is extended with a calibrated confidence scale
  and four few-shot examples; each returned Relation gains valid_from,
  valid_until, temporal_confidence, and temporal_source_text in metadata.
  Low confidence (<0.5) with non-null dates logs a WARNING. Default False
  preserves 100% backward compatibility.

- Add `RelationWithTemporalOut` / `RelationsWithTemporalResponse` Pydantic
  schemas so the four temporal fields are captured from structured LLM
  output (separate from RelationOut which uses extra="ignore").

- New `semantica/kg/temporal_normalizer.py` — `TemporalNormalizer` class
  (zero LLM calls, pure regex + dateutil arithmetic):
    * normalize(value) → (start, end) UTC datetimes or None
    * Resolution order: ISO 8601 → partial dates (year/month/Q) →
      ambiguity detection → domain phrase map → relative phrases
    * normalize_phrase(phrase) → metadata dict or None
    * Default phrase map covers 13 domains: General, Policy, Healthcare,
      Drug Discovery, Cybersecurity, Supply Chain, Finance, Energy
    * TemporalAmbiguityWarning for DD/MM/YYYY-style ambiguous inputs
    * Custom phrase_map at construction (merged over defaults)

- Add `TemporalAmbiguityWarning(UserWarning)` to exceptions.py.
- Export `TemporalNormalizer` from `semantica/kg/__init__.py`.
- Propagate `extract_temporal_bounds` through `_extract_relations_chunked`
  and add flag to cache key to prevent cross-mode cache pollution.

- 53 new tests in tests/semantic_extract/test_temporal_extraction.py;
  zero real LLM calls, suite runs in ~3.5s. 873 existing tests unaffected.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-25 21:42:57 +05:30
Mohd Kaif 05fa3247b7 Merge pull request #409 from Hawksight-AI/semantic-extract
fix(semantic-extract): pass base_url as host when initialising Ollama…
2026-03-24 19:48:49 +05:30
KaifAhmad1andClaude Sonnet 4.6 42899c1416 docs(changelog): add entry for OllamaProvider base_url fix (#408)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 19:44:56 +05:30
KaifAhmad1andClaude Sonnet 4.6 19665b9db2 fix(semantic-extract): pass base_url as host when initialising OllamaProvider client
Closes #408

Previously `_init_client` assigned the raw `ollama` module to
`self.client`, so the `base_url` parameter was silently ignored and
every request hit the default localhost:11434. Now an `ollama.Client`
instance is created with `host=self.base_url`, so remote Ollama servers
are reachable.

Three regression tests added to prevent recurrence:
- default base_url is forwarded as host
- custom base_url (e.g. http://192.168.1.3:11434) is forwarded as host
- self.client is never the raw module

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 19:36:22 +05:30
Mohd Kaif 07dc579faf Merge pull request #407 from Hawksight-AI/context
feat(context): add temporal awareness to ContextGraph and AgentContext
2026-03-24 13:28:25 +05:30
KaifAhmad1andClaude Sonnet 4.6 96e438c81c docs(changelog): add entry for temporal awareness in context graph (#399)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 13:25:16 +05:30
KaifAhmad1andClaude Sonnet 4.6 c483352d7a fix(context): resolve review issues in temporal awareness PR
- Fix max_depth error message: "1 and 20" -> "1 and 100" to match actual check
- Fix Cypher query at_time param to RFC3339 UTC (append Z) for unambiguous DB comparisons
- Fix _normalize_temporal_input to raise ValueError on unparseable strings instead of returning raw input
- Fix datetime.now() -> datetime.utcnow() in recorded_at stamps and checkpoint timestamps (matches codebase convention, avoids wrong local time on Windows)
- Wrap TemporalVersionManager() construction in flush_checkpoint with clear RuntimeError

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 13:20:54 +05:30
KaifAhmad1andClaude Sonnet 4.6 01ba7d113b feat(context): add temporal awareness to ContextGraph and AgentContext
- Add valid_from/valid_until fields to Decision dataclass and record_decision()
- Add include_superseded and as_of filters to find_precedents_by_scenario()
- Add _decision_matches_temporal_filters() and _normalize_temporal_input() helpers
- Add ContextGraph.state_at(timestamp) for point-in-time graph snapshots
- Stamp recorded_at on causal relationship edges
- Add CausalChainAnalyzer.trace_at_time() for transaction-time causal chain tracing
- Add AgentContext.checkpoint(), diff_checkpoints(), flush_checkpoint() for named context snapshots
- 93 tests passing (33 context_graph, 36 causal_analyzer, 24 agent_context)

Closes #399

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-24 12:18:25 +05:30
Mohd Kaif cdd45331fa Merge pull request #406 from Hawksight-AI/semantic-extract
Harden spaCy NER Fallback in Semantic Extract
2026-03-23 23:33:18 +05:30
KaifAhmad1 a3a0848577 Fix semantic extract spaCy fallback review issues 2026-03-23 23:31:01 +05:30
Mohd Kaif eeda5f5b80 Merge branch 'main' into semantic-extract 2026-03-23 23:16:19 +05:30
KaifAhmad1 62b03d4fa5 Harden spaCy NER fallback in semantic extract 2026-03-23 23:12:48 +05:30
Mohd Kaif 8a2b07b864 Merge pull request #405 from Hawksight-AI/kg
Deterministic Temporal Reasoning Engine and Query Integration
2026-03-23 19:55:15 +05:30