First rule is a validator for an input. Second rule is a filter prepareing UUID to be written in a binary format and keeping the text form for output. Third one is a validator running a query over the binary value generated by a filter.
We can write a query to validate data, not to save it.