Deciding Finiteness, Groundness and Domain Independence of Pure Datalog Queries