Query
Find and retrieve entities that match structured conditions.
Concept
The Query pragmatic is the read-only interface to the Knowledge Base. It takes a condition (defined in standard CNL syntax) and returns the set of all entities that satisfy it. Unlike SQL, which thinks in tables, CNL Query thinks in Sets and logical intersections.
Syntax
// Return a simple list of names Return the name of every user who is active. // Return a structured count Return the number of servers that have high load. // Verify a boolean condition (Is the set empty?) Verify that no user is an admin and a guest.
Execution Logic
The AST is compiled into a SetPlan.
user-> Scans the `user` unary bitset.who is active-> Scans the `active` unary bitset.user who is active-> ComputesBitset(user) & Bitset(active).
The result is a raw Bitset. The engine then "hydrates" this bitset by looking up the name attribute for each ID in the set, returning a JSON array of strings.