The crate root of
sophia-query, Sophia’s own query language. Source:sophia_query.rs.Sources: SPEC-007 Sophia Query Language; S-ADR-0011 Sophia has its own query algebra; S-ADR-0012 The query IR is a separate IR on shared primitives. code:
sophia_query.rs
prepare_textandprepare: parse, make canonical (canon), check (check), and compute the magic-set rewrite (magic). The result is aPreparedquery with its content id.Prepared::run: the native executor (eval) inside one read transaction, on any backend.Strategy::Autoruns the magic-set program when there is one;Strategy::Plainruns the query as written.Prepared::to_sqlandrun_sql: the SQL translation (sql) and its execution on SQLite (Sqlite::query_compiled).Prepared::recordandfrom_record,saveandload: queries stored as definitions of the languagesophia-query.snapshot,run_cached: result identity (query id, snapshot, parameters) and a result cache in meta rows, which are not logged, so caching does not move the snapshot. The snapshot id, the lookup and the evaluation share one read transaction. Only complete results are cached, and the caller’s row cap is applied to hits. Entries are keyedquery-result/<snapshot>/<result id>; a miss that writes removes every entry of another snapshot (old-layoutquery-result/<result id>keys included) in the same write transaction, so only the current snapshot’s results stay (SP-014, option 2).run_cancellable: a run another thread can stop.bounded(Unix; the bound itself Linux only):run_boundedruns a query in a worker process under a hard memory bound, for untrusted queries (bounded, B-017).Error::MemoryBoundandError::Workerare its errors.Rows: typed result rows;to_tableturns them into the store’sTable, with ids as hex text like thesqlviews.