GetSchema ========= Inspect node and customer connection categories. Requires ``objects.read`` permission; no input or output blobs are used. Ownership links are excluded in every scope, including referenced and cached results. ``scope`` is ``node``, ``edge`` or ``all`` (the default). ``ref`` optionally restricts inspection to an earlier node/connection selection in this transaction. ``refresh`` defaults to true; false permits the transaction's cached schema. A referenced query always recomputes its selected objects. Response -------- The requested ``nodes`` and ``edges`` fields are arrays, including when empty. Each record contains ``class``, ``matched`` and a ``properties`` object mapping names to ``{"count":123,"type":"String"}``. Each node has a string ``class`` and a ``type``. Each edge groups its three class names under ``class`` and its two endpoint types under ``target``, as in :doc:`GetIndexes` and :doc:`GetAggregates`. ``refreshed`` is a UTC timestamp. Counts retain their 64-bit range. Class names alone do not identify a category. Indexes are listed separately by :doc:`GetIndexes`; owner links are operational data, not schema edges. Empty registered categories remain visible with ``matched:0`` and empty ``properties``, including after DeleteAll. RemoveClass removes an empty category; its numeric ID becomes reusable after the removal commits. Existing readers keep the schema from their original snapshot. .. code-block:: json [{"GetSchema":{"scope":"all","refresh":true}}] An example response is: .. code-block:: json [{ "GetSchema": { "status": 0, "refreshed": "2026-01-01T00:00:00Z", "nodes": [ {"type":"entity","class":"Person","matched":2, "properties":{"name":{"count":2,"type":"String"}}}, {"type":"image","class":"Person","matched":1,"properties":{}} ], "edges": [ {"class":{"src":"Person","connection":"AppearsIn","dst":"Person"}, "target":{"src":"entity","dst":"image"},"matched":1,"properties":{}} ] } }] Invalid scopes, undeclared references or missing permissions return a command error. See :doc:`../Responses` for transaction error envelopes. Inspect a selection ------------------- These examples assume three ``DocsSchemaPerson`` entities: Ada, age 36; Grace, age 40; and Sam, age 20. A ``DocsSchemaKnows`` connection from Ada to Grace has the property ``since: 2020``. Responses below omit the changing ``refreshed`` timestamp. First, select people aged 30 or older. ``GetSchema`` inspects only the two selected entities, even though ``results.count`` returns no entity rows. .. TESTED_EXAMPLE: GetSchema_1 .. code-block:: json [{ "FindEntity": { "with_class": "DocsSchemaPerson", "_ref": 1, "constraints": ["$age", ">=", 30], "results": { "count": true } } }, { "GetSchema": { "ref": 1 } }] .. TESTED_EXAMPLE: GetSchema_1_response .. code-block:: json [{ "FindEntity": { "count": 2, "returned": 0, "status": 0 } }, { "GetSchema": { "edges": [], "nodes": [{ "class": "DocsSchemaPerson", "matched": 2, "properties": { "age": { "count": 2, "type": "Number" }, "name": { "count": 2, "type": "String" } }, "type": "entity" }], "status": 0 } }] A connection selection reports the full typed source and destination category. Only the selected connection contributes to the property counts. .. TESTED_EXAMPLE: GetSchema_2 .. code-block:: json [{ "FindConnection": { "with_class": "DocsSchemaKnows", "_ref": 1, "results": { "count": true } } }, { "GetSchema": { "ref": 1 } }] .. TESTED_EXAMPLE: GetSchema_2_response .. code-block:: json [{ "FindConnection": { "count": 1, "returned": 0, "status": 0 } }, { "GetSchema": { "edges": [{ "class": { "connection": "DocsSchemaKnows", "dst": "DocsSchemaPerson", "src": "DocsSchemaPerson" }, "matched": 1, "properties": { "since": { "count": 1, "type": "Number" } }, "target": { "dst": "entity", "src": "entity" } }], "nodes": [], "status": 0 } }]