scene_service.state.relations

Relation engine — pure-geometric predicates over the object registry. Runs at 1 Hz as its own asyncio task. Output is a list of (subject, predicate, target) triples cached on the engine and exposed via current() / served by the snapshot tools.

Classes

RelationEngine(registry, *[, period_s])

Periodic recomputation of pairwise relations + cached snapshot.

RelationTriple(subject_object_id, predicate, ...)

class scene_service.state.relations.RelationEngine(registry: ObjectRegistry, *, period_s: float = 1.0)[source]

Bases: object

Periodic recomputation of pairwise relations + cached snapshot.

Read path: engine.current() returns the latest cached list. Reads don’t touch the registry lock — they grab the engine’s local cache that the periodic tick refreshed atomically. So MCP query calls don’t have to wait for ingest.

current() list[RelationTriple][source]
async start() None[source]
async stop() None[source]
class scene_service.state.relations.RelationTriple(subject_object_id: 'str', predicate: 'str', target_object_id: 'str')[source]

Bases: object

predicate: str
subject_object_id: str
target_object_id: str