A Portable Approach for Bidirectional Integration between a Logic and a Statically-Typed Object-Oriented Programming Language

By Sergio Castro Mejia,
Université catholique de Louvain


This dissertation seeks to improve on the state of the art for creating systems integrating modules written in both a logic and a statically-typed object-oriented language. Logic languages are well suited for declaratively solving computational problems that require knowledge representation and reasoning. Modern object- oriented programming languages benefit from mature software ecosystems featuring rich libraries and developer tools. The existence of several integration approaches testifies the interest of both communities in techniques for facilitating the creation of hybrid systems. In this way, systems developed in an object-oriented language can integrate modules written in a logic language that are more convenient for solving declarative problems. On the logic side, non-trivial declarative applications can take advantage of the existence of large software ecosystems such as those surrounding contemporary object-oriented languages. The combination of both paradigms allows a programmer to use the best language available for a given task. Existing integration approaches provide different levels of abstractions for dealing with the integration concern (i.e., the required interoperability in order for logic routines to access the object-oriented world, and vice versa). Some of them still require significant amounts of boilerplate code which hinders their adoption and steepens their learning curve. Others provide a high degree of integration transparency and automation which simplifies their usage. However, many of those approaches often impose strong assumptions about the architecture of a system (e.g., a logic program must run embedded in an object-oriented one) thus suffering from portability issues. Furthermore, most approaches provide limited support for custom context-dependent reification of objects in the logic world and custom mappings of arbitrary logic terms to objects in the object-oriented world. To address these problems, we introduce our portable and customisable approach for bidirectional integration between a logic and a statically-typed object-oriented language. This approach enables a transparent and (semi-) automatic communication between routines in these two worlds. In addition, it provides a customisable context- dependent mechanism for defining how artefacts in one language should be reified in the other language. A concrete implementation is provided as a portable Java–Prolog interoperability framework. To ensure portability, our framework has been made compatible with three open source Prolog engines (SWI, YAP and XSB) by means of drivers. We validated our approach through case studies requiring a seamless integration of declarative programs in Prolog with object-oriented programs in Java.