Logic Programming as a Service in Multi-Agent Systems for the Internet of Things