Patent ID: 7805456

Claim:
At a computer system including a processor and system memory, a computer-implemented method for processing a query expression, comprising: (A) an act of accessing a query expression, the query expression including a plurality of linked query clauses, the plurality of linked query clauses including at least a first query clause linked to a next query clause, the order of the plurality of linked query clauses defined in the query comprehension such that the order is independent of the underlying computing language of the query comprehension, wherein: (B) the first query clause includes a queryable source type, a first query operator, and an element type of the source type, the element type having associated therewith a control variable, the control variable having an associated scope that is determined by the query operator, the query source type indicating the type of source data that is to be queried, the element type indicating the element type of the results of the first query clause, the query operator mapping to a method defined according to a query operator pattern; and (C) the next query clause includes a next element type and a next query operator that is to be applied to the results of the first query clause, the next element type indicating the element type of the results of the next query clause, the next query operation mapping to a next method defined according to a next query operator pattern; (D) evaluate the first query clause to obtain a set of elements of the element type from within the source data based on the query source type, (E) evaluating the first query clause including calling the method to implement the query operator on the source data; (F) infer that a next source type for the next query clause is the element type, wherein the inference is based on the source type in view of the query operator, wherein the inference is performed without the need to translate the entire query comprehension; wherein the inferring that the next source type is the element type is in real time; (G) pass the set of elements to the next query clause, wherein the associated control variable is passed when the next query clause supports the scope of the control variable; (H) incrementally provide context information based upon the inferred element type to the next query clause; and (I) evaluate the next query clause to obtain a next set of elements of the next element type from within the set of elements based on the next source type and the context information, evaluating the next query clause including calling the next method to implement the next query operator on the set of elements.