[Paper Review] Customisable handling of Java references in prolog programs
This paper proposes a customizable, portable approach for representing and managing Java object references in Prolog programs by addressing key dimensions like reference representation, opacity, identity preservation, and lifecycle management. It extends the JPC library to support three major Prolog engines (SWI, YAP, XSB), enabling seamless, language-agnostic interoperation with minimal assumptions about the Prolog engine environment.
Integration techniques for combining programs written in distinct language paradigms facilitate the implementation of specialised modules in the best language for their task. In the case of Java-Prolog integration, a known problem is the proper representation of references to Java objects on the Prolog side. To solve it adequately, multiple dimensions should be considered, including reference representation, opacity of the representation, identity preservation, reference life span, and scope of the inter-language conversion policies. This paper presents an approach that addresses all these dimensions, generalising and building on existing representation patterns of foreign references in Prolog, and taking inspiration from similar inter-language representation techniques found in other domains. Our approach maximises portability by making few assumptions about the Prolog engine interacting with Java (e.g., embedded or executed as an external process). We validate our work by extending JPC, an open-source integration library,with features supporting our approach. Our JPC library is currently compatible with three different open source Prolog engines (SWI, YAP and XSB) by means of drivers
Motivation & Objective
- To address the challenge of representing Java object references in Prolog programs in a way that preserves identity and lifecycle.
- To generalize existing foreign reference patterns in Prolog to support multiple inter-language interaction dimensions.
- To minimize assumptions about the Prolog engine environment, enhancing portability across different execution models (embedded or external processes).
- To provide a flexible, extensible framework for managing inter-language reference conversion policies.
- To validate the approach through integration into the open-source JPC library, ensuring compatibility with multiple Prolog engines.
Proposed method
- Designing a reference representation model that supports opacity, identity preservation, and controlled lifecycle management of Java objects in Prolog.
- Defining a policy-driven conversion mechanism for inter-language reference handling, allowing customization of scope and behavior.
- Implementing a driver-based architecture in the JPC library to abstract engine-specific details and ensure compatibility across Prolog engines.
- Leveraging existing inter-language representation techniques from other domains to inform the design of reference semantics.
- Extending JPC with support for customizable reference handling patterns that decouple reference semantics from engine-specific implementations.
- Validating the approach through deployment and testing on three open-source Prolog engines: SWI, YAP, and XSB.
Experimental results
Research questions
- RQ1How can Java object references be represented in Prolog in a way that preserves object identity and supports controlled lifecycle management?
- RQ2What design principles enable portable handling of foreign references across different Prolog engines with varying execution models?
- RQ3To what extent can a unified reference management model be generalized across diverse inter-language integration patterns?
- RQ4How can opacity and scope of reference representation be controlled to support both safe and efficient interoperation?
- RQ5What are the practical trade-offs and benefits of using a policy-driven approach for inter-language reference conversion?
Key findings
- The proposed approach successfully supports consistent representation and management of Java object references across multiple Prolog engines.
- The JPC library extension enables seamless integration with SWI-Prolog, YAP, and XSB Prolog engines using a common abstraction layer.
- The design minimizes assumptions about the Prolog engine environment, enhancing portability and reusability.
- The approach generalizes and extends existing foreign reference patterns in Prolog by incorporating multiple dimensions of reference handling.
- The use of drivers allows for engine-specific adaptations while maintaining a uniform interface for reference management.
- The solution supports customizable policies for reference conversion, enabling fine-grained control over scope, lifetime, and visibility.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.