Constructing a proper attribute query syntax