1 / 12

Java+Prolog: A Land of Opportunities

Java+Prolog: A Land of Opportunities. Derived from talk at PACLP’99 Miguel Calejo. Structure of presentation. Motivation Prolog and Java backgrounds Combination possibilities. Motivation. Prolog did not conquer the world… ...but continues to evolve R&D better spent on LP intrinsics

satin
Download Presentation

Java+Prolog: A Land of Opportunities

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Java+Prolog: A Land of Opportunities Derived from talk at PACLP’99 Miguel Calejo

  2. Structure of presentation • Motivation • Prolog and Java backgrounds • Combination possibilities

  3. Motivation • Prolog did not conquer the world… • ...but continues to evolve • R&D better spent on LP intrinsics • … but OOP did • Best interface to the world • Java is clean, dynamic, highly backed • Java strengths complement LP’s • Java+Prolog interfaces are available

  4. Background: Prolog • The promise of declarativity • Prolog = imperative programming + unification + backtracking • CLP = Prolog + constraint solving • etc., …cf. other modules • ISO standard, but hardly a stable platform

  5. Background: Java platform • OOP = imperative programming + message sending • OS independence • Multi-environment • Server, desktop, browser, TV, Consumer Electronics, Cards • Enormous API scope • GUI, 3D, speech, communications, speech, e-commerce, mobile, servers, … • http://java.sun.com • Blessed by most and backed by all

  6. Background: Java GUI • About Swing/JFC • Playing with the Swingset • Principles • GUI objects are objects • User events cause messages to listeners • Listeners can be of any class but must implement simple event interfaces • Model-View/Controller • Letting the framework work for us: a minimal JTable example

  7. Background: Java Reflection • All objects know their class: • Class C = X.getClass(); • Since JDK 1.1, classes provide info about public methods and variables • Method M = C.getMethod(“anyMethod”,Class arg array) • No Prolog meta-call, but close • M.invoke(Target,Object arg array)

  8. Background: “80s” Object Serialization • An easy and natural way to persist an object is to “serialize” its state • Each class knows only how to store its own variables • writeObject(Stream s){ super.writeObject(s); WRITE MY DATA;}

  9. Background: Java Serialization • Cleaner than in previous languages: Reflection allows a system mechanism to introspect any object and serialize it... • Cf. classes ObjectOutputStream, InputObjectStream • ...oos.writeObject(ANYOBJECT); • Object ANY = ios.readObject(); • ...using a public stream format :) • Writes/reads an object graph, including class descriptions, without repeating objects

  10. How to combine Java and Prolog ? • Java (or OOP) in Prolog • LogTalk.org • Prolog in Java • DGKS Prolog, JavaLog, Jinni, MINERVA, Prolog Café, W-Prolog • Java + Prolog • JNI – based • Amzi, InterProlog (XSB), Jasper(Sicstus), JPL(SWI), JIPL (K-Prolog) • Socket-based • InterProlog(XSB, SWI, YAP), Prolog IV • Links for these and more: • http://www.declarativa.pt/interprolog/systems.htm

  11. Prolog+Java • Writing apps in Prolog and Java • Accept the 2 paradigms, side by side • Unification, backtracking, constraints • Message-sending • Reap the benefits of decades of LP research… • …saving the investment already done for Java

  12. Prolog+Java: issues • How to interface • Same OS process ? • Granularity of communication • Who calls who • Restrictions ? • Converting data • Terms and relations vs. objects • Impact on existing systems • Economics, guru independence...

More Related