Implementation of Chain Logic Queries