In the Jess manual, chapter 7, queries are motivated by a linear search being inefficient.
But doesn't the existence of query parameters force the query implementation to do a linear search? (Of course that will, in general, still be more efficient than iterating over *all* WME elements.) If a query were really just a LHS, it could be included in the Rete, like a defrule. Its activations would not go on the general agenda, but kept separate. Running a query would "grep" the appropriate activations from that separate set of instantiations, where they are always up-to-date. BUT: you can't provide parameters the way Jess does with this form of query. (I have implemented this variant form of querie in our 1987 vintage RBS, which is, of course, entirely different from Jess and its "relatives".) -W
