fix: index literal objects in entity table for object-based graph queries (#1042)

Literal objects (e.g. rdfs:label values) were not being inserted into the
quads_by_entity table with role='O', so queries like `tg-query-graph -o
MIL-HDBK-516D` returned no results even though the triple existed.

Removed the otype guard that skipped entity row insertion for literals in
both insert() and async_insert(). Also updated delete_collection() and
async_delete_collection() to include literal objects in entity partition
cleanup.

Existing data requires re-ingestion for old literal objects to become
queryable by object value.
This commit is contained in:
cybermaggedon 2026-07-13 21:11:01 +01:00 committed by GitHub
parent 35fc8444ec
commit f9f5a2318f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 141 additions and 27 deletions

View file

@ -99,8 +99,8 @@ class TestEntityCentricKnowledgeGraph:
# Verify batch was executed
mock_session.execute.assert_called()
def test_insert_literal_object_creates_3_entity_rows(self, entity_kg):
"""Test that inserting a quad with literal object creates 3 entity rows"""
def test_insert_literal_object_creates_4_rows(self, entity_kg):
"""Test that inserting a quad with literal object creates S+P+O entity rows + collection"""
kg, mock_session = entity_kg
mock_session.reset_mock()