A method for cleansing anomalies from sequence-based data at query time.
Sequence-based data such as RFID data is loaded into a database. A
cleansing rule is received at a cleansing rules engine. The cleansing
rule engine converts the cleansing rule to a template that includes logic
to compensate for anomalies in the sequence-based data. A query to
retrieve the sequence-based data is received by a query rewrite engine.
The query rewrite engine rewrites the query by applying the template
logic and an expanded rewrite technique. The rewritten query is executed
at query time. The result of the rewritten query execution is identical
to the result of executing the original query on a data set generated by
applying the cleansing rule to all of the sequence-based data.