This document discusses building a software ecosystem for Java-Prolog interoperability. It introduces JPC, a portable Java library for Java-Prolog connectivity that facilitates object-to-term mappings. It also introduces LogicObjects, a Java-Prolog linguistic symbiosis framework built on JPC that uses annotations to specify mappings. The document then presents a case study of modeling the London underground in Prolog with a Java interface using these libraries to achieve linguistic symbiosis between the languages.
Logic languages are well suited for declaratively solving computational problems that require knowledge representation and reasoning. Object-oriented programming languages benefit from mature software ecosystems featuring rich libraries and developer tools. Several integration solutions exist that allow a software system to be decomposed into a combination of modules implemented in both a logic and an object-oriented language. Unfortunately, significative amounts of boilerplate code must still be written to accomplish the required interoperability. In addition, such approaches often are not amenable to custom context-dependent reification of objects in the logic world and custom mappings of arbitrary logic terms to objects in the object-oriented world. Furthermore, in the specific case of Prolog-Java integration, existing solutions are often compatible with only a single or a restricted set of Prolog engines and thus suffer from portability issues.
To address these problems, we introduce a portable framework, relying on linguistic integration, for transparently and (semi-)automatically enabling communication between routines in these two worlds, as well as a simple mechanism for customising how native artefacts in one language should be reified in the other language. We validate our approach with case studies requiring a seamless integration of declarative programs in Prolog with libraries belonging to the Java ecosystem.
This session, delivered at Devoxx Poland, covers all the major changes to the Java platform between JDK 12 and JDK 17. All language features are covered, as well as many of the important API changes.
In this presentation, I'm talking about a powerful tool for asynchronous loading which is provided by Android framework - loaders. Why guys from Android team added this tool and how we can customise it? We'll try to find answers for these questions.
For most of us, Reactive Android means using RxJava. In this presentation, I try to borrow a few ideas from the backend world and enrich the concept of Reactive in Android.
Logic languages are well suited for declaratively solving computational problems that require knowledge representation and reasoning. Object-oriented programming languages benefit from mature software ecosystems featuring rich libraries and developer tools. Several integration solutions exist that allow a software system to be decomposed into a combination of modules implemented in both a logic and an object-oriented language. Unfortunately, significative amounts of boilerplate code must still be written to accomplish the required interoperability. In addition, such approaches often are not amenable to custom context-dependent reification of objects in the logic world and custom mappings of arbitrary logic terms to objects in the object-oriented world. Furthermore, in the specific case of Prolog-Java integration, existing solutions are often compatible with only a single or a restricted set of Prolog engines and thus suffer from portability issues.
To address these problems, we introduce a portable framework, relying on linguistic integration, for transparently and (semi-)automatically enabling communication between routines in these two worlds, as well as a simple mechanism for customising how native artefacts in one language should be reified in the other language. We validate our approach with case studies requiring a seamless integration of declarative programs in Prolog with libraries belonging to the Java ecosystem.
This session, delivered at Devoxx Poland, covers all the major changes to the Java platform between JDK 12 and JDK 17. All language features are covered, as well as many of the important API changes.
In this presentation, I'm talking about a powerful tool for asynchronous loading which is provided by Android framework - loaders. Why guys from Android team added this tool and how we can customise it? We'll try to find answers for these questions.
For most of us, Reactive Android means using RxJava. In this presentation, I try to borrow a few ideas from the backend world and enrich the concept of Reactive in Android.
Progscon 2017: Taming the wild fronteer - Adventures in ClojurescriptJohn Stevenson
Progscon 2017 conference talk, introducing Clojurescript for a functional programming approach to building React.js apps.
Examples include using React.js directly and the Om Clojurescript library that closely follows the React.js API. Also cover a simpler approach to React with the Clojurescript libraries called Reagent and Rum.
Using Elasticsearch as the Primary Data StoreVolkan Yazıcı
The biggest e-commerce company in the Netherlands and Belgium, bol.com, set out on a 4 year journey to rethink and rebuild their entire ETL (Extract, Transform, Load) pipeline, that has been cooking up the data used by its search engine since the dawn of time. This more than a decade old white-bearded giant, breathing in the dungeons of shady Oracle PL/SQL hacks, was in a state of decay, causing ever-increasing hiccups on production. A rewrite was inevitable. After drafting many blueprints, we went for a Java service backed by Elasticsearch as the primary storage! This idea brought shivers to even the most senior Elasticsearch consultants hired, so to ease your mind I’ll walk you through why we took such a radical approach and how we managed to escape our legacy.
Java 9 is just around the corner. In this session, we'll describe the new modularization support (Jigsaw), new JDK tools, enhanced APIs and many performance improvements that were added to the new version.
Finally Java SE 7 is GA and you can start using it. This talk will cover the most important new features of the language and the virtual machine. It will also cover some features that did not make it in to the SE 7 release. Finally we will discuss current state of Java as an ecosystem and my analysis and hopes for the future.
How I learned to time travel, or, data pipelining and scheduling with AirflowLaura Lorenz
****UPDATE: Project is now open sourced at https://www.github.com/industrydive/fileflow****
From Pydata DC 2016
Description
Data warehousing and analytics projects can, like ours, start out small - and fragile. With an organically growing mess of scripts glued together and triggered by cron jobs hiding on different servers, we needed better plumbing. After perusing the data pipelining landscape, we landed on Airflow, an Apache incubating batch processing pipelining and scheduler tool from Airbnb.
Abstract
The power of any reporting tool breaks based on the data behind it, so when our data warehousing process got too big for its humble origins, we searched for something better. After testing out several options such as Drake, Pydoit, Luigi, AWS Data Pipeline, and Pinball, we landed on Airflow, an Apache incubating batch processing pipelining and scheduler tool originating from Airbnb, that provides the benefits of pipeline construction as directed acyclic graphs (DAGs), along with a scheduler that can handle alerting, retries, callbacks and more to make your pipeline robust. This talk will discuss the value of DAG based pipelines for data processing workflows, highlight useful features in all of the pipelining projects we tested, and dive into some of the specific challenges (like time travel) and successes (like time travel!) we’ve experienced using Airflow to productionize our data engineering tasks. By the end of this talk, you will learn
- pros and cons of several Python-based/Python-supporting data pipelining libraries
- the design paradigm behind Airflow, an Apache incubating data pipelining and scheduling service, and what it is good for
- some epic fails to avoid and some epic wins to emulate from our experience porting our data engineering tasks to a more robust system
- some quick-start tips for implementing Airflow at your organization.
www.denizoguz.com-For an in company JDK 7 orientation I have prepared a presentation which summaries new features of JDK 7. I would like to make it public for everyone who needs it.
Softshake 2013: Introduction to NoSQL with CouchbaseTugdual Grall
This presentation was delivered during Softshake 2013. Learn why RDBMS are not enought and why NoSQL help developers to scale their applications and provide agility.
Java is moving faster and faster. A lot of features are not as known as they should be.
Let’s review together the old ones you missed.
Then show you the ones you never had time to look at in 9, 10, 11, 12 and 13.
And go crazy to check how it’s implemented under the hood (yes, there will be bytecode).
There is an increasing interest in functional programming from Java developers and the organisations in which they work. For many companies the challenge now is how to make use of the competitive advantage of functional programming. For developers, how do you adapt your mindset to this newly reimagined paradigm? Through the use of examples and a modular approach to design, Clojure made simple will show how developers can be productive quickly without a major change to their current development life-cycle. We will also cover the Clojure build process, tools and exciting projects out there.
These slides, covering the topics of Software Maintenance and Evolution, are introductory slides to the course LINGI2252 “Software Maintenance and Evolution”, given by Prof. Kim Mens at UCL, Belgium
An introductory lecture on Context-Oriented Programming, part of the course LINGI2252 “Software Maintenance and Evolution”, given by Prof. Kim Mens at UCL, Belgium. This particular lecture was made by Dr. Sebastian Gonzalez in close collaboration with Prof. Kim Mens.
More Related Content
Similar to Towards a software ecosystem for java prolog interoperabilty
Progscon 2017: Taming the wild fronteer - Adventures in ClojurescriptJohn Stevenson
Progscon 2017 conference talk, introducing Clojurescript for a functional programming approach to building React.js apps.
Examples include using React.js directly and the Om Clojurescript library that closely follows the React.js API. Also cover a simpler approach to React with the Clojurescript libraries called Reagent and Rum.
Using Elasticsearch as the Primary Data StoreVolkan Yazıcı
The biggest e-commerce company in the Netherlands and Belgium, bol.com, set out on a 4 year journey to rethink and rebuild their entire ETL (Extract, Transform, Load) pipeline, that has been cooking up the data used by its search engine since the dawn of time. This more than a decade old white-bearded giant, breathing in the dungeons of shady Oracle PL/SQL hacks, was in a state of decay, causing ever-increasing hiccups on production. A rewrite was inevitable. After drafting many blueprints, we went for a Java service backed by Elasticsearch as the primary storage! This idea brought shivers to even the most senior Elasticsearch consultants hired, so to ease your mind I’ll walk you through why we took such a radical approach and how we managed to escape our legacy.
Java 9 is just around the corner. In this session, we'll describe the new modularization support (Jigsaw), new JDK tools, enhanced APIs and many performance improvements that were added to the new version.
Finally Java SE 7 is GA and you can start using it. This talk will cover the most important new features of the language and the virtual machine. It will also cover some features that did not make it in to the SE 7 release. Finally we will discuss current state of Java as an ecosystem and my analysis and hopes for the future.
How I learned to time travel, or, data pipelining and scheduling with AirflowLaura Lorenz
****UPDATE: Project is now open sourced at https://www.github.com/industrydive/fileflow****
From Pydata DC 2016
Description
Data warehousing and analytics projects can, like ours, start out small - and fragile. With an organically growing mess of scripts glued together and triggered by cron jobs hiding on different servers, we needed better plumbing. After perusing the data pipelining landscape, we landed on Airflow, an Apache incubating batch processing pipelining and scheduler tool from Airbnb.
Abstract
The power of any reporting tool breaks based on the data behind it, so when our data warehousing process got too big for its humble origins, we searched for something better. After testing out several options such as Drake, Pydoit, Luigi, AWS Data Pipeline, and Pinball, we landed on Airflow, an Apache incubating batch processing pipelining and scheduler tool originating from Airbnb, that provides the benefits of pipeline construction as directed acyclic graphs (DAGs), along with a scheduler that can handle alerting, retries, callbacks and more to make your pipeline robust. This talk will discuss the value of DAG based pipelines for data processing workflows, highlight useful features in all of the pipelining projects we tested, and dive into some of the specific challenges (like time travel) and successes (like time travel!) we’ve experienced using Airflow to productionize our data engineering tasks. By the end of this talk, you will learn
- pros and cons of several Python-based/Python-supporting data pipelining libraries
- the design paradigm behind Airflow, an Apache incubating data pipelining and scheduling service, and what it is good for
- some epic fails to avoid and some epic wins to emulate from our experience porting our data engineering tasks to a more robust system
- some quick-start tips for implementing Airflow at your organization.
www.denizoguz.com-For an in company JDK 7 orientation I have prepared a presentation which summaries new features of JDK 7. I would like to make it public for everyone who needs it.
Softshake 2013: Introduction to NoSQL with CouchbaseTugdual Grall
This presentation was delivered during Softshake 2013. Learn why RDBMS are not enought and why NoSQL help developers to scale their applications and provide agility.
Java is moving faster and faster. A lot of features are not as known as they should be.
Let’s review together the old ones you missed.
Then show you the ones you never had time to look at in 9, 10, 11, 12 and 13.
And go crazy to check how it’s implemented under the hood (yes, there will be bytecode).
There is an increasing interest in functional programming from Java developers and the organisations in which they work. For many companies the challenge now is how to make use of the competitive advantage of functional programming. For developers, how do you adapt your mindset to this newly reimagined paradigm? Through the use of examples and a modular approach to design, Clojure made simple will show how developers can be productive quickly without a major change to their current development life-cycle. We will also cover the Clojure build process, tools and exciting projects out there.
These slides, covering the topics of Software Maintenance and Evolution, are introductory slides to the course LINGI2252 “Software Maintenance and Evolution”, given by Prof. Kim Mens at UCL, Belgium
An introductory lecture on Context-Oriented Programming, part of the course LINGI2252 “Software Maintenance and Evolution”, given by Prof. Kim Mens at UCL, Belgium. This particular lecture was made by Dr. Sebastian Gonzalez in close collaboration with Prof. Kim Mens.
Software Reuse and Object-Oriented Programmingkim.mens
These slides on Software Reuse and Object-Oriented Programming are part of the course LINGI2252 “Software Maintenance and Evolution”, given by Prof. Kim Mens at UCL, Belgium
These slides on Object-Oriented Design Heuristics are part of the course LINGI2252 “Software Maintenance and Evolution”, given by Prof. Kim Mens at UCL, Belgium.
This presentation on Object-Oriented Application Frameworks is part of a larger course LINGI2252 on Software Maintenance and Evolution, given at UCL university in Belgium.
Towards a Context-Oriented Software Implementation Frameworkkim.mens
Context-aware systems must manage the dynamic selection, activation, and execution of feature variants according to changing contexts, detected from data gathered from their surrounding execution environment. Many context-oriented programming languages focus only on the implementation level by providing appropriate language abstractions for implementing behavioural variations that can adapt dynamically to changing contexts. They often ignore or presuppose the existence of mechanisms to deal with earlier aspects such as the gathering of sensory input and context discovery. In this presentation we discuss a layered software architecture that reconciles all these aspects in a single implementation framework, which can be customised by application programmers into actual context-aware applications. This framework and a simulator to test applications build using this framework we recently implemented in Ruby and Ruby on Rails.
Towards a Taxonomy of Context-Aware Software Variabilty Approacheskim.mens
Modern software systems demand more and more smart capabilities depending on their context of use, as well as the ability to dynamically adapt these capabilities according to sensed context changes. This requires appropriate techniques for modelling, representing and handling context-aware software variability. While traditional variability modelling approaches like feature orientation and software product lines are evolving to address the increased dynamicity and context specificity required for this new generation of software systems, new paradigms such as context-oriented programming have emerged. Although developed independently, since they address similar issues, many similarities exist between these approaches. The purpose of this work is to define, categorise and compare key concepts shared by these approaches.
Such a taxonomy is a first step towards a better understanding of the differences and similarities between different approaches for managing context-aware software variability, and to achieve a cross-fertilisation between them.
An introductory lecture on context-oriented programming, part of a full course on Programming Paradigms at UCL university in Belgium, focussing on reflection and meta programming techniques in a variety of languages. This particular lecture was made by Sebastian Gonzalez in close collaboration with Kim Mens.
An introduction to the basics of reflection and meta programming, part of a full lecture on programming paradigms at UCL university in Belgium, with reflection and meta programming as theme. (Further lectures focus more in depth on reflection and meta programming in a variety of programming languages such as Smalltalk, Ruby and Java.) Slides created collaboratively by Kim Mens and Roel Wuyts.
After a previous introductory lecture on the basics of reflection in Java, in this lecture we take a closer look at some more advanced reflective features of the language such as dynamic proxies, call stack introspection and instrumentation. This lecture is part of a full course on Programming Paradigms at UCL university in Belgium, focussing on the programming languages Smalltalk, Ruby and Java, with reflection and meta programming as underlying theme.
An introduction to the basics of reflection in the object-oriented programming language Java, part of a full lecture on Programming Paradigms at UCL university in Belgium, focussing on the programming languages Smalltalk, Ruby and Java, with reflection and meta programming as underlying theme.
An introduction to some advanced language features of the object-oriented programming language Ruby, part of a full lecture on Programming Paradigms at UCL university in Belgium, focussing on the programming languages Smalltalk, Ruby and Java, with reflection and meta programming as underlying theme. This lecture looks into the Ruby features of higher-order programming (lambdas), singleton methods, mixin modules, reflection and metaprogramming.
A quick introduction to the object-oriented programming language Ruby, part of a full lecture on Programming Paradigms at UCL university in Belgium, focussing on the programming languages Smalltalk, Ruby and Java, with reflection and meta programming as underlying theme.
A quick introduction to the object-oriented programming language Smalltalk, part of a full lecture on Programming Paradigms at UCL university in Belgium, focussing on the programming languages Smalltalk, Ruby and Java, with reflection and meta programming as underlying theme.
A gentle and intuitive introduction to reflection and meta programming, part of a full lecture on programming paradigms at UCL university in Belgium, with reflection and meta programming as theme. (Further lectures focus more in depth on reflection and meta programming in a variety of languages such as Smalltalk, Ruby and Java.)
Dev Dives: Train smarter, not harder – active learning and UiPath LLMs for do...UiPathCommunity
💥 Speed, accuracy, and scaling – discover the superpowers of GenAI in action with UiPath Document Understanding and Communications Mining™:
See how to accelerate model training and optimize model performance with active learning
Learn about the latest enhancements to out-of-the-box document processing – with little to no training required
Get an exclusive demo of the new family of UiPath LLMs – GenAI models specialized for processing different types of documents and messages
This is a hands-on session specifically designed for automation developers and AI enthusiasts seeking to enhance their knowledge in leveraging the latest intelligent document processing capabilities offered by UiPath.
Speakers:
👨🏫 Andras Palfi, Senior Product Manager, UiPath
👩🏫 Lenka Dulovicova, Product Program Manager, UiPath
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionAggregage
Join Maher Hanafi, VP of Engineering at Betterworks, in this new session where he'll share a practical framework to transform Gen AI prototypes into impactful products! He'll delve into the complexities of data collection and management, model selection and optimization, and ensuring security, scalability, and responsible use.
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™UiPathCommunity
In questo evento online gratuito, organizzato dalla Community Italiana di UiPath, potrai esplorare le nuove funzionalità di Autopilot, il tool che integra l'Intelligenza Artificiale nei processi di sviluppo e utilizzo delle Automazioni.
📕 Vedremo insieme alcuni esempi dell'utilizzo di Autopilot in diversi tool della Suite UiPath:
Autopilot per Studio Web
Autopilot per Studio
Autopilot per Apps
Clipboard AI
GenAI applicata alla Document Understanding
👨🏫👨💻 Speakers:
Stefano Negro, UiPath MVPx3, RPA Tech Lead @ BSP Consultant
Flavio Martinelli, UiPath MVP 2023, Technical Account Manager @UiPath
Andrei Tasca, RPA Solutions Team Lead @NTT Data
SAP Sapphire 2024 - ASUG301 building better apps with SAP Fiori.pdfPeter Spielvogel
Building better applications for business users with SAP Fiori.
• What is SAP Fiori and why it matters to you
• How a better user experience drives measurable business benefits
• How to get started with SAP Fiori today
• How SAP Fiori elements accelerates application development
• How SAP Build Code includes SAP Fiori tools and other generative artificial intelligence capabilities
• How SAP Fiori paves the way for using AI in SAP apps
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
GDG Cloud Southlake #33: Boule & Rebala: Effective AppSec in SDLC using Deplo...James Anderson
Effective Application Security in Software Delivery lifecycle using Deployment Firewall and DBOM
The modern software delivery process (or the CI/CD process) includes many tools, distributed teams, open-source code, and cloud platforms. Constant focus on speed to release software to market, along with the traditional slow and manual security checks has caused gaps in continuous security as an important piece in the software supply chain. Today organizations feel more susceptible to external and internal cyber threats due to the vast attack surface in their applications supply chain and the lack of end-to-end governance and risk management.
The software team must secure its software delivery process to avoid vulnerability and security breaches. This needs to be achieved with existing tool chains and without extensive rework of the delivery processes. This talk will present strategies and techniques for providing visibility into the true risk of the existing vulnerabilities, preventing the introduction of security issues in the software, resolving vulnerabilities in production environments quickly, and capturing the deployment bill of materials (DBOM).
Speakers:
Bob Boule
Robert Boule is a technology enthusiast with PASSION for technology and making things work along with a knack for helping others understand how things work. He comes with around 20 years of solution engineering experience in application security, software continuous delivery, and SaaS platforms. He is known for his dynamic presentations in CI/CD and application security integrated in software delivery lifecycle.
Gopinath Rebala
Gopinath Rebala is the CTO of OpsMx, where he has overall responsibility for the machine learning and data processing architectures for Secure Software Delivery. Gopi also has a strong connection with our customers, leading design and architecture for strategic implementations. Gopi is a frequent speaker and well-known leader in continuous delivery and integrating security into software delivery.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
Towards a software ecosystem for java prolog interoperabilty
1. Towards a Software Ecosystem
for Java-Prolog Interoperability
Sergio Castro Kim Mens
RELEASeD LAB
Université catholique de Louvain
Belgium
Paulo Moura
Center for Research in Advanced Computing Systems
INESC TEC
Portugal
1
Tuesday 9 July 13
10. Integration difficult to achieve
• The Prolog community is fragmented.
• Existing Java-Prolog libraries also suffer the symptoms of such
fragmentation.
4
Tuesday 9 July 13
11. An ecosystem for Java-Prolog
development
• Providing a portable general-purpose library for building Java-
Prolog systems (JPC).
• Providing a framework for linguistic symbiosis between Java &
Prolog (LogicObjects).
• Providing a set of reusable hybrid components.
5
Tuesday 9 July 13
12. Why Java ?
• None of the authors is a big fan of the Java language itself.
• But we recognise the advantages of the huge Java ecosystem.
• And the emerging languages running on the JVM
• (e.g., Scala, Clojure, JRuby, etc...).
6
Tuesday 9 July 13
13. • Facilitates the creation of hybrid Java-Prolog applications and
frameworks.
• Not constrained to a specific execution environment (e.g. an
Eclipse plugin).
• Compatible with some of the most popular open source
Prolog engines (XSB,YAP, SWI) and more coming soon.
• Available at the Maven central snapshot repository and
GitHub1 (currently) under the LGPL license.
7
1https://github.com/sergio-castro/
JPC: Java-Prolog Connectivity
Tuesday 9 July 13
14. Lessons learned when building
libraries without JPC
• Applications are strongly coupled to a concrete Java-Prolog
library.
• Conversion concerns tangled with other concerns.
• Complex routines dealing with conversion heuristics (high
cyclomatic complexity).
• Ugly ad-hoc implementation of context-dependent
conversions.
8
Tuesday 9 July 13
15. JPC features
• A portable abstraction of a Prolog virtual machine.
• A set of utilities for dealing with Java-Prolog inter-language
conversions.
9
Tuesday 9 July 13
16. JPC as a portable layer
10
Prolog engines
Bridge libraries
JPC drivers
JPC library
Java-Prolog
applications
Java-Prolog
frameworks
(layer coupling denoted by the
direction of the arrows)
Tuesday 9 July 13
19. JPC as a tool for inter-language
conversions
• JPC implements a “new” mechanism for passing artefacts
between Java and Prolog.
• Mechanism based on the specification of mappings of such
artefacts.
13
Tuesday 9 July 13
20. Common integration techniques
• Shared memory approach (e.g. SOUL).
• Passing object references to Prolog (e.g. JPL).
• Serializing objects (e.g. InterProlog).
• Mapping objects to terms (e.g. JPC, LogicObjects).
14
Tuesday 9 July 13
21. Shared memory approach
• Tight integration/control between Java and Prolog.
• Difficult to implement an efficient Prolog embedded in Java.
• Often no access to well-proven Prolog libraries.
• But easy access to libraries in the host language.
15
Tuesday 9 July 13
22. Passing object references
• The original object reference is preserved.
• Garbage collection may be an issue.
• No control on the term representation of an object on the
Prolog side.
16
Tuesday 9 July 13
23. Serializing objects
• Object reference is not preserved.
• No configuration required.
• Only works with serializable objects.
• Support for circular relations.
• No control on the term representation of an object on the
Prolog side.
17
Tuesday 9 July 13
24. Mapping objects to terms
• Object reference is difficult to preserve.
• Difficult to support circular relations.
• Requires explicit mappings (where they cannot be inferred).
• Fine control on the (context dependent) term representation
of an object.
18
Tuesday 9 July 13
25. JPC mapping features
• Helps to modularize context dependent conversions.
• Converters can receive hints on the expected conversion to
apply.
• Custom conversions can be added at any moment.
• Catalog of useful Prolog-Java converters.
19
Tuesday 9 July 13
26. JPC architecture
• Abstraction of a PrologVM.
• Reification of Prolog data types (e.g.Atom, Compound, etc).
• The conversion context.
20
Tuesday 9 July 13
28. The converter manager
• Converts between Java-Prolog artefacts.
• Composition of specialized converters (primitive types
converters, exception converters, multi-valued converters,
etc).
• Interprets and refines hints from the user.
22
Tuesday 9 July 13
29. public class CollectionConverter<E> extends JpcConverter<Collection<E>, Term> {
@Override
public Collection<E> fromTerm(Term listTerm, Type type, Jpc context) {
...
}
...
}
23
A pre-defined converter example
Tuesday 9 July 13
30. public class CollectionConverter<E> extends JpcConverter<Collection<E>, Term> {
@Override
public Collection<E> fromTerm(Term listTerm, Type type, Jpc context) {
...
}
...
}
23
A pre-defined converter example
Java type
Tuesday 9 July 13
31. public class CollectionConverter<E> extends JpcConverter<Collection<E>, Term> {
@Override
public Collection<E> fromTerm(Term listTerm, Type type, Jpc context) {
...
}
...
}
23
A pre-defined converter example
Prolog type
Tuesday 9 July 13
32. public class CollectionConverter<E> extends JpcConverter<Collection<E>, Term> {
@Override
public Collection<E> fromTerm(Term listTerm, Type type, Jpc context) {
...
}
...
}
23
A pre-defined converter example
term to convert
Tuesday 9 July 13
33. public class CollectionConverter<E> extends JpcConverter<Collection<E>, Term> {
@Override
public Collection<E> fromTerm(Term listTerm, Type type, Jpc context) {
...
}
...
}
23
A pre-defined converter example
type guiding conversion
Tuesday 9 July 13
34. public class CollectionConverter<E> extends JpcConverter<Collection<E>, Term> {
@Override
public Collection<E> fromTerm(Term listTerm, Type type, Jpc context) {
...
}
...
}
23
A pre-defined converter example
the conversion context
Tuesday 9 July 13
35. A default conversion example
Jpc jpc = ... //the conversion context
Term listTerm = listTerm(new Atom("1"), new Atom("2")); //[‘1’, ‘2’]
List<String> list = jpc.fromTerm(listTerm);
assertEquals("1", list.get(0));
assertEquals("2", list.get(1));
24
Tuesday 9 July 13
36. A default conversion example
Jpc jpc = ... //the conversion context
Term listTerm = listTerm(new Atom("1"), new Atom("2")); //[‘1’, ‘2’]
List<String> list = jpc.fromTerm(listTerm);
assertEquals("1", list.get(0));
assertEquals("2", list.get(1));
24
Prolog list of
atoms
Tuesday 9 July 13
37. A default conversion example
Jpc jpc = ... //the conversion context
Term listTerm = listTerm(new Atom("1"), new Atom("2")); //[‘1’, ‘2’]
List<String> list = jpc.fromTerm(listTerm);
assertEquals("1", list.get(0));
assertEquals("2", list.get(1));
24
Java list of
Strings
Tuesday 9 July 13
38. A typed conversion example
Term listTerm = listTerm(new Atom("1"), new Atom("2"));
Type type = new TypeToken<ArrayList<Integer>>(){}.getType();
List<Integer> list = jpc.fromTerm(listTerm, type);
assertEquals(1, list.get(0));
assertEquals(2, list.get(1));
25
Tuesday 9 July 13
39. A typed conversion example
Term listTerm = listTerm(new Atom("1"), new Atom("2"));
Type type = new TypeToken<ArrayList<Integer>>(){}.getType();
List<Integer> list = jpc.fromTerm(listTerm, type);
assertEquals(1, list.get(0));
assertEquals(2, list.get(1));
25
type guiding conversion
Tuesday 9 July 13
40. A custom converter
public class StationConverter extends JpcConverter<Station, Compound> {
public static final String STATION_FUNCTOR = "station";
@Override public Compound toTerm(Station station, Jpc context) {
return new Compound(STATION_FUNCTOR, asList(new Atom(station.getName())));
}
@Override public Station fromTerm(Compound term, Jpc context) {
String stationName = ((Atom)term.arg(1)).getName();
return new StationJpc(stationName);
}
}
26
Tuesday 9 July 13
41. The type solver
• Attempts to infer the best Java type of a Prolog term if no
hint is available.
• Question:What does this term look like ?
[A-x,B-y,C-z]
• Answer: It may be a map.
27
Tuesday 9 July 13
42. The instantiation manager
• A customizable mechanism for instantiating abstract classes/
interfaces if required.
• E.g. a Prolog list term may be mapped to a Java List or a Map.
• This manager knows which instance of List and Map to use (if
the given hint does not contain such information).
28
Tuesday 9 July 13
43. LogicObjects
• A portable Java-Prolog linguistic symbiosis framework.
• Currently being migrated to JPC.
• Based on annotations for specifying mappings between Java-
Prolog artefacts.
• Support for context dependent mappings.
29
Tuesday 9 July 13
44. Symbiosis
30
“The intimate living together of two dissimilar organisms in a
mutually beneficial relationship.” (Merriam-Webster dictionary)
Tuesday 9 July 13
45. Linguistic symbiosis
• Objects from different worlds must understand each other.
• Invoking routines from another language as if they were defined
in their own language.
31
• Easier to achieve if the
languages belong to the
same paradigm.
Tuesday 9 July 13
46. A paradigm leak
“The event of concepts leaking from one programming paradigm
to another”
32
* Gybels, K.
SOUL and Smalltalk - Just Married: Evolution of the Interaction Between
a Logic and an Object-Oriented Language Towards Symbiosis.
In Proceedings of the Workshop on Declarative Programming in the Context
of Object-Oriented Languages. (2003)
*
Tuesday 9 July 13
47. The inhabitants of our two
worlds
33
The OO
world
The logic
world
Tuesday 9 July 13
48. The inhabitants of our two
worlds
33
Packages
Classes
Objects
Methods
Method invocations
Return values
The OO
world
The logic
world
Libraries
Modules
Terms
Clauses
Queries
Query solutions
Tuesday 9 July 13
49. Reducing the gap with Logtalk
34
The OO
world
The logic
world
Tuesday 9 July 13
50. Reducing the gap with Logtalk
34
The OO
world
The logic
world
Logtalk
An object-oriented layer
Tuesday 9 July 13
59. Interesting relations
37
line1A C
line2
D
F
B
Connected: Directly connected
(e.g., A with B).
Nearby: At most one intermediate
station, in the same line (e.g., A with C).
Reachable: Transitively connected
(e.g., A with F).
reachable
Tuesday 9 July 13
60. Interesting relations
38
Connected: Directly connected
(e.g., A with B).
Nearby: At most one intermediate
station, in the same line (e.g., A with C).
Reachable: Transitively connected
(e.g., A with F).
Easily expressed with
logic facts and rules
Tuesday 9 July 13
61. Which is the best language for
this problem?
• A logic language would let us express our problem using facts
and rules.
• But we sill want access to a modern OO language to develop
a user friendly interface.
• Then let’s do it with both through linguistic symbiosis.
39
Tuesday 9 July 13
62. Implementation Strategy
• Develop the program in Prolog.
• Wrap it with an OO layer (Logtalk).
• Program the Java side using LogicObjects.
40
Tuesday 9 July 13
63. A rule based system using Prolog
connected(station(bond_street), station(oxford_circus), line(central)).
connected(station(oxford_circus), station(tottenham_court_road), line(central)).
...
nearby(S1,S2) :- connected(S1,S2,_).
nearby(S1,S2) :- connected(S1,S3,L), connected(S3,S2,L).
reachable(S1,S2,[]) :- connected(S1,S2,_).
reachable(S1,S2,[S3|Ss]) :- connected(S1,S3,_), reachable(S3,S2,Ss).
line(Name) :- setof(L, S1^S2^connected(S1,S2,L), Ls), list::member(line(Name), Ls).
41
Tuesday 9 July 13
64. A rule based system using Prolog
connected(station(bond_street), station(oxford_circus), line(central)).
connected(station(oxford_circus), station(tottenham_court_road), line(central)).
...
nearby(S1,S2) :- connected(S1,S2,_).
nearby(S1,S2) :- connected(S1,S3,L), connected(S3,S2,L).
reachable(S1,S2,[]) :- connected(S1,S2,_).
reachable(S1,S2,[S3|Ss]) :- connected(S1,S3,_), reachable(S3,S2,Ss).
line(Name) :- setof(L, S1^S2^connected(S1,S2,L), Ls), list::member(line(Name), Ls).
41
FACTS
Tuesday 9 July 13
65. A rule based system using Prolog
connected(station(bond_street), station(oxford_circus), line(central)).
connected(station(oxford_circus), station(tottenham_court_road), line(central)).
...
nearby(S1,S2) :- connected(S1,S2,_).
nearby(S1,S2) :- connected(S1,S3,L), connected(S3,S2,L).
reachable(S1,S2,[]) :- connected(S1,S2,_).
reachable(S1,S2,[S3|Ss]) :- connected(S1,S3,_), reachable(S3,S2,Ss).
line(Name) :- setof(L, S1^S2^connected(S1,S2,L), Ls), list::member(line(Name), Ls).
41
RULES
Tuesday 9 July 13
72. Invoking a Logtak method
Messages in Logtalk are expressed with the :: operator.
For example:
line(central)::connects(Station1, Station2)
Answers all the stations connected by the line ‘central’
44
Tuesday 9 July 13
73. Invoking a Logtak method
Messages in Logtalk are expressed with the :: operator.
For example:
line(central)::connects(Station1, Station2)
Answers all the stations connected by the line ‘central’
44
Tuesday 9 July 13
74. The Java world
45
public abstract class Line {
String name;
public Line(String name) {this.name = name;}
public abstract boolean connects(Station s1, Station s2);
public abstract int segments();
}
public abstract class Station {
...
}
public abstract class Metro {
...
}
Tuesday 9 July 13
75. The Java world
45
public abstract class Line {
String name;
public Line(String name) {this.name = name;}
public abstract boolean connects(Station s1, Station s2);
public abstract int segments();
}
public abstract class Station {
...
}
public abstract class Metro {
...
}
@LObject(args={“name”})
@LMethod(name={“connects”}, args={“_”, “_”})
@LObject(args={“name”})
Tuesday 9 July 13
77. Linguistic symbiosis challenges
• Translating objects to logic terms (and back).
• Mapping OO methods to logic queries.
• Dealing with unbound variables.
• Returning values from queries.
• Managing multiplicity.
47
* Some of them presented a bit differently in:
D'Hondt, Maja and Gybels, Kris and Jonckers, Viviane.
Seamless integration of rule-based knowledge and object-
oriented functionality with linguistic symbiosis.
In Proceedings of the 2004 ACM symposium on Applied computing,
SAC '04, pages 1328{1335, New York, NY, USA, 2004. ACM.
*
Tuesday 9 July 13
81. public abstract class Metro {...}
@LObject(name = "my_metro")
public abstract class Metro {...}
@LObject(args = {"name"})
public abstract class Line {
private String name;
...
}
metro
my_metro
line(l_name)
Translating objects to logic terms
49
Java Logtalk
Tuesday 9 July 13
82. public abstract class Metro {...}
@LObject(name = "my_metro")
public abstract class Metro {...}
@LObject(args = {"name"})
public abstract class Line {
private String name;
...
}
metro
my_metro
line(l_name)
Translating objects to logic terms
49
Java Logtalk
Tuesday 9 July 13
83. public abstract class Metro {...}
@LObject(name = "my_metro")
public abstract class Metro {...}
@LObject(args = {"name"})
public abstract class Line {
private String name;
...
}
metro
my_metro
line(l_name)
Translating objects to logic terms
49
Java Logtalk
Tuesday 9 July 13
84. public abstract class Metro {...}
@LObject(name = "my_metro")
public abstract class Metro {...}
@LObject(args = {"name"})
public abstract class Line {
private String name;
...
}
metro
my_metro
line(l_name)
Translating objects to logic terms
49
Java Logtalk
Tuesday 9 July 13
85. Mapping Java methods to Logtalk
methods
50
@LObject(args = {"name"})
public abstract class Line {
private String name;
public abstract
boolean connects(Station s1, Station s2);
@LMethod(name = "connects", args = {"_", "_"})
public abstract
int segments();
}
line(l_name)::connects(
station(s1_name), station(s2_name)).
line(l_name)::connects(_, _).
Java Logtalk
Tuesday 9 July 13
86. Mapping Java methods to Logtalk
methods
50
@LObject(args = {"name"})
public abstract class Line {
private String name;
public abstract
boolean connects(Station s1, Station s2);
@LMethod(name = "connects", args = {"_", "_"})
public abstract
int segments();
}
line(l_name)::connects(
station(s1_name), station(s2_name)).
line(l_name)::connects(_, _).
Java Logtalk
Tuesday 9 July 13
87. Mapping Java methods to Logtalk
methods
50
@LObject(args = {"name"})
public abstract class Line {
private String name;
public abstract
boolean connects(Station s1, Station s2);
@LMethod(name = "connects", args = {"_", "_"})
public abstract
int segments();
}
line(l_name)::connects(
station(s1_name), station(s2_name)).
line(l_name)::connects(_, _).
Java Logtalk
Tuesday 9 July 13
88. Mapping Java methods to Logtalk
methods
50
@LObject(args = {"name"})
public abstract class Line {
private String name;
public abstract
boolean connects(Station s1, Station s2);
@LMethod(name = "connects", args = {"_", "_"})
public abstract
int segments();
}
line(l_name)::connects(
station(s1_name), station(s2_name)).
line(l_name)::connects(_, _).
Java Logtalk
Tuesday 9 July 13
89. @LObject(args = {"name"})
public abstract class Station {
@LSolution("IntermediateStations")
@LMethod(name = "reachable", args = {"$1", "IntermediateStations"})
public abstract List<Station> intermediateStations(Station station);
...
}
51
Dealing with unbound variables in
method calls
Tuesday 9 July 13
90. @LObject(args = {"name"})
public abstract class Station {
@LSolution("IntermediateStations")
@LMethod(name = "reachable", args = {"$1", "IntermediateStations"})
public abstract List<Station> intermediateStations(Station station);
...
}
51
first Java method parameter
(as term)
Dealing with unbound variables in
method calls
Tuesday 9 July 13
91. @LObject(args = {"name"})
public abstract class Station {
@LSolution("IntermediateStations")
@LMethod(name = "reachable", args = {"$1", "IntermediateStations"})
public abstract List<Station> intermediateStations(Station station);
...
}
51
first Java method parameter
(as term)
unbound
logic variable
Dealing with unbound variables in
method calls
Tuesday 9 July 13
92. @LObject(args = {"name"})
public abstract class Station {
@LSolution("IntermediateStations")
@LMethod(name = "reachable", args = {"$1", "IntermediateStations"})
public abstract List<Station> intermediateStations(Station station);
...
}
51
station(s1_name)::reachable(station(s2_name), IntermediateStations)
Dealing with unbound variables in
method calls
Tuesday 9 July 13
93. 52
Interpreting a query result as a
Java object
The logic solutions
Varx1 x1, Vary1 y1
Varx2 x2, Vary2 y2
Varxn xn, Varyn yn
Tuesday 9 July 13
94. 52
Interpreting a query result as a
Java object
The logic solutions
Varx1 x1, Vary1 y1
Varx2 x2, Vary2 y2
Varxn xn, Varyn yn
(set of frames binding logic
variables to terms)
frame 1
frame 2
frame n
Tuesday 9 July 13
95. 53
Interpreting a query result as a
Java object
The logic solutions
Varx1 x1, Vary1 y1
Varx2 x2, Vary2 y2
Varxn xn, Varyn yn
(set of frames binding logic
variables to terms)
Tuesday 9 July 13
96. 53
Interpreting a query result as a
Java object
The logic solutions The method return value
Varx1 x1, Vary1 y1
Varx2 x2, Vary2 y2
aJavaObject
Varxn xn, Varyn yn
(set of frames binding logic
variables to terms)
Tuesday 9 July 13
97. 54
Returning values from one
solution
The logic solutions The method return value
term(Varx1, Vary1)
Varx1 x1, Vary1 y1 term(x1, y1)
Varx2 x2, Vary2 y2 term(x2, y2)
Varxn xn, Varyn yn term(xn, yn)
(set of frames binding logic
variables to terms)
Tuesday 9 July 13
98. 54
Returning values from one
solution
The logic solutions The method return value
term(Varx1, Vary1)
Varx1 x1, Vary1 y1 term(x1, y1)
Varx2 x2, Vary2 y2 term(x2, y2)
Varxn xn, Varyn yn term(xn, yn)
(set of frames binding logic
variables to terms)
(specified in a method
with @LSolution)
Tuesday 9 July 13
99. 54
Returning values from one
solution
The logic solutions The method return value
term(Varx1, Vary1)
Varx1 x1, Vary1 y1 term(x1, y1)
Varx2 x2, Vary2 y2 term(x2, y2)
Varxn xn, Varyn yn term(xn, yn)
(set of frames binding logic
variables to terms)
(specified in a method
with @LSolution)
(default solution)
Tuesday 9 July 13
100. @LObject(args = {"name"})
public abstract class Station {
@LSolution("IntermediateStations")
@LMethod(name = "reachable", args = {"$1", "IntermediateStations"})
public abstract List<Station> intermediateStations(Station station);
...
}
55
Explicitly specification of return
values
Tuesday 9 July 13
101. @LObject(args = {"name"})
public abstract class Station {
@LSolution("IntermediateStations")
@LMethod(name = "reachable", args = {"$1", "IntermediateStations"})
public abstract List<Station> intermediateStations(Station station);
...
}
55
Explicitly specification of return
values
Tuesday 9 July 13
102. @LObject(args = {"name"})
public abstract class Station {
@LSolution("IntermediateStations")
@LMethod(name = "reachable", args = {"$1", "IntermediateStations"})
public abstract List<Station> intermediateStations(Station station);
...
}
55
Explicitly specification of return
values
Tuesday 9 July 13
103. @LObject(args = {"name"})
public abstract class Station {
@LMethod(name = "reachable", args = {"$1", "LSolution"})
public abstract List<Station> intermediateStations(Station station);
...
}
56
Implicit specification of return
values
Tuesday 9 July 13
104. @LObject(args = {"name"})
public abstract class Station {
@LMethod(name = "reachable", args = {"$1", "LSolution"})
public abstract List<Station> intermediateStations(Station station);
...
}
56
Implicit specification of return
values
Tuesday 9 July 13
105. Managing multiplicity
57
• A logic routine can have many solutions, in Java only one.
• Multiple values can be grouped with @LComposition.
• The kind of container to return depends on the method
signature.
• The kind of object in the container is also extracted from the
method signature.
Tuesday 9 July 13
106. 58
Returning multiple values from
queries
The logic solutions The method return value
term(Varx1, Vary1)
Varx1 x1, Vary1 y1 term(x1, y1)
Varx2 x2, Vary2 y2 term(x2, y2)
Varxn xn, Varyn yn term(xn, yn)
Tuesday 9 July 13
107. 58
Returning multiple values from
queries
The logic solutions The method return value
term(Varx1, Vary1)
Varx1 x1, Vary1 y1 term(x1, y1)
Varx2 x2, Vary2 y2 term(x2, y2)
Varxn xn, Varyn yn term(xn, yn)
(a composed solution)
Tuesday 9 July 13
108. @LObject(args = {"name"})
public abstract class Station {
...
@LComposition @LSolution("S")
@LMethod(args = {"S"})
public abstract List<Station> nearby();
}
59
station(aName)::nearby(S).
LogtalkJava
Returning multiple values from
queries
Tuesday 9 July 13
109. @LObject(args = {"name"})
public abstract class Station {
...
@LComposition @LSolution("S")
@LMethod(args = {"S"})
public abstract List<Station> nearby();
}
59
station(aName)::nearby(S).
LogtalkJava
Returning multiple values from
queries
Tuesday 9 July 13
110. @LObject(args = {"name"})
public abstract class Station {
...
@LComposition @LSolution("S")
@LMethod(args = {"S"})
public abstract List<Station> nearby();
}
59
station(aName)::nearby(S).
LogtalkJava
Returning multiple values from
queries
Tuesday 9 July 13
111. @LObject(args = {"name"})
public abstract class Station {
...
@LComposition @LSolution("S")
@LMethod(args = {"S"})
public abstract List<Station> nearby();
}
59
container type
station(aName)::nearby(S).
LogtalkJava
Returning multiple values from
queries
Tuesday 9 July 13
112. @LObject(args = {"name"})
public abstract class Station {
...
@LComposition @LSolution("S")
@LMethod(args = {"S"})
public abstract List<Station> nearby();
}
59
each solution type
container type
station(aName)::nearby(S).
LogtalkJava
Returning multiple values from
queries
Tuesday 9 July 13
113. Returning a property of the result
set
60
@LObject(args = {"name"})
public abstract class Line {
private String name;
public abstract
boolean connects(Station s1, Station s2);
@LMethod(name = "connects", args = {"_", "_"})
public abstract
int segments();
}
Tuesday 9 July 13
114. Returning a property of the result
set
60
@LObject(args = {"name"})
public abstract class Line {
private String name;
public abstract
boolean connects(Station s1, Station s2);
@LMethod(name = "connects", args = {"_", "_"})
public abstract
int segments();
}
should return if logic method succeeds or not
Tuesday 9 July 13
115. Returning a property of the result
set
60
@LObject(args = {"name"})
public abstract class Line {
private String name;
public abstract
boolean connects(Station s1, Station s2);
@LMethod(name = "connects", args = {"_", "_"})
public abstract
int segments();
}
should return if logic method succeeds or not
should return the number of solutions
Tuesday 9 July 13
116. Instantiating a symbiotic object in
Java
Line line = newLogicObject(Line.class, “central”);
System.out.println("Number of segments of line " + line + ": " + line.segments());
61
Tuesday 9 July 13
117. Instantiating a symbiotic object in
Java
Line line = newLogicObject(Line.class, “central”);
System.out.println("Number of segments of line " + line + ": " + line.segments());
61
Tuesday 9 July 13
118. Instantiating a symbiotic object in
Java
Line line = newLogicObject(Line.class, “central”);
System.out.println("Number of segments of line " + line + ": " + line.segments());
61
Tuesday 9 July 13
119. Other features
• Java expressions embedded in logic terms (symbiosis terms).
• Dependency management.
• Integration with plain Prolog (without Logtalk).
62
Tuesday 9 July 13
120. Future work
• Finishing a full two-ways linguistic symbiosis framework.
• Supporting more Prolog engines.
• Adding support to other kinds of integration techniques (e.g.
serialization and objects references).
• Continue the development of reusable hybrid components.
63
Tuesday 9 July 13
121. Inspiration from other domains
• Interoperability layer: JDBC.
• Mapping of artefacts using annotations: JAXB.
• Context dependent conversions: GSON.
• Linguistic symbiosis concepts: SOUL.
64
Tuesday 9 July 13
122. Conclusions
• We have provided portable and simple solutions for many
issues concerning Java-Prolog interoperability.
• We are actively exploring how far we can get in automation/
transparency regarding Java-Prolog linguistic symbiosis.
• We are targeting complex heterogeneous realistic scenarios.
• We are attempting to provide reusable hybrid components
and frameworks that may be helpful to the community.
65
Tuesday 9 July 13