Knowledge representation formalisms that are used to express ontologies assume that the information is potentially incomplete, while databases represent only complete information. Thus, there is a fundamental mismatch between different semantics of ontology-based systems and of databases. This study proposes a framework that builds a bridge between these semantics and it allows to effectively and completely evaluate queries over databases with respect to ontologies by means of query reformulation into SQL. Furthermore, this work includes investigations into domain independence, the property that guarantees SQL executability. A sound and complete procedure to check domain independence is shown for the first time.