Jointly-Weakly-Sticky (JWS) Datalog± is an expressive member of the family of Datalog± programs. It is characterized by a marking procedure, the existential dependency graph, and joint acyclicity. Query-answering (QA) can be done in polynomial-time in data complexity through SChQAS, a chase-based, bottom-up QA algorithm for JWS Datalog± programs. The QA algorithm can be optimized by using a magic-sets query rewriting technique, MagicD+, for JWS programs. MagicD+ takes a Datalog± program and a query, and rewrites the combination into a new Datalog± program that becomes an input to SChQAS. With the new program, SChQAS avoids generating irrelevant facts. The main contributions of this thesis are the design and implementation of an ontology-based data access (OBDA) tool, JowsDatalog, in which SChQAS and MagicD+ are implemented.