Translation into datalog