Skip to content

Entities (Joint record)

The record (entity-first) form resolves a JointEntity for one or more primary keys — structured columns, Lance evidence and derived attributes in a single governed call (reachable through the semantic_query MCP tool too).

SELECT name, segment, country, recent_meeting_topics, meeting_summary
FROM osl.entities.Customer
WHERE customer_id IN ('9c1e…f04a', 'e4f8…2a91')

SELECT * returns all declared exposed_attributes. Keys are required — an empty key set is refused (no full-scan). Results are ordered by the key list; a missing key comes back marked missing rather than fabricated.

{
"customer_id": "9c1e…f04a",
"name": "Anna Vidal",
"segment": "retail-premium",
"country": "ES",
"recent_meeting_topics": [
{ "text": "…", "cite": { "source": "gong://…", "doc_id": "meet-…", "chunk_id": "chk-…" } }
],
"meeting_summary": "Anna has asked in recent meetings about […]"
}
RFC 0008 · Draftopt-in

With the engine’s joint-relation flag on (chart jointRelation.enabled, default off — off, these queries answer E0511 as before), a JointEntity can also be filtered, ordered and paged on its structured anchor, with the content legs hydrated only for the keys that selection served. “The five most recent notices with their emails” is one call:

SELECT notice_id, received_at, emails
FROM osl.entities.ChargebackNotice
ORDER BY received_at DESC
LIMIT 5
-- continuation: same select list, WHERE and ORDER BY, plus the keyset cursor
SELECT notice_id, received_at, emails
FROM JOINT(entity => 'ChargebackNotice', after => 'osl1.…')
ORDER BY received_at DESC
LIMIT 5

It runs in two governed stages: a selection on the anchor model (one governed SQL read — the SQL enforcer alone decides which keys are selected), then hydration of exactly those keys. Rules:

  • WHERE (literal =, <, >, <=, >=, IN, BETWEEN, AND only) and the single ORDER BY name structured anchor attributes. An order or filter column that is not cleartext on every row the subject may see is refused (403 E2101); JOIN, GROUP BY, HAVING, OFFSET, DISTINCT, OR and predicates over content, derived, metric or neighbour attributes are E0511.
  • The primary key and every content leg’s join key must be cleartext on every admitted row (400 E0518, audited), and the primary key must be declared unique on the anchor model (E0512).
  • LIMIT is the page size (default 20, engine maximum 100; above it the page is served at the maximum with cappedBy). Paging is by an opaque keyset cursor bound to the subject and the query (E0530/E0531), never by OFFSET. Order and key columns whose type cannot resume a cursor exactly are refused before any read.

The response is shape: "joint_relation" with population.rows_at_start (the governed count when the listing started) and a served block: consistency: "keyset", has_more, next, cumulative, legs[] (each ok, capped or failed) and withheld_keys (selected keys whose anchor row was no longer admitted at hydration — a count, never the keys). A keyset listing pins nothing, so served.complete is never true: rows added or changed while you page may be missed or met once, and only served.cumulative.rows may be claimed.

Every attribute is subject to the caller’s grants: un-granted columns come back redacted (⟦redacted⟧), obligated columns masked, Lance legs served at the required redaction version. A full denial returns a non-revealing E2101 — the engine never discloses which policy denied.