Files
semantica/tests
KaifAhmad1andClaude Sonnet 4.6 39c9fc97b4 fix: resolve all remaining review issues in ontology alignment API
- fix(query_engine): progress tracker leak in expand_entity_uri
  stop_tracking was only called inside the `if hasattr(execute_sparql)`
  block; backends without execute_sparql silently leaked a tracker entry.
  Now stop_tracking(completed) is always reached on the happy path, and
  stop_tracking(failed) is reached on exception.

- fix(query_engine): add skos:relatedMatch to expand_entity_uri FILTER
  get_alignment_predicates() exposed relatedMatch but the SPARQL filter
  did not include it, making relatedMatch alignments invisible.

- fix(query_engine): sanitize URIs in build_values_clause
  URIs were interpolated raw into <{uri}> angle-bracket literals.
  A URI containing > would break the VALUES clause. Now _sanitize_uri
  is applied to every URI before wrapping.

- fix(engine): add skos:relatedMatch to get_alignments and list_alignments
  FILTER lists now consistent with get_alignment_predicates().

- fix(engine): close SPARQL injection vector in list_alignments
  Previously only " was escaped in the ontology_uri filter string.
  A URI containing } would break out of the WHERE block. Now \, ", {
  and } are all percent-encoded before interpolation.

- fix(engine): validate predicate is a full URI in create_alignment
  Passing a CURIE like "owl:equivalentClass" silently stored a broken
  triple that get_alignments() could never find. Now raises ProcessingError
  with a clear message if the predicate does not start with http/https.

- fix(tests): rewrite E2E test to actually be end-to-end
  test_end_to_end_cross_ontology_uri_flow was mocking expand_entity_uri
  itself, so it only tested build_values_clause string formatting.
  Now uses a real mock backend with execute_sparql, calls the real
  expand_entity_uri, and asserts both the backend was queried and the
  resulting SPARQL template contains both URIs.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-12 23:40:37 +05:30
..