check the source of query is defined