Implemented pattern query validation #15

Completed pattern query validation including unit test cases.