On the Correspondence Between Monotonic Max-Sum GNNs and Datalog