Join this community to post or comment
Greatly simplified web and mobile Java coding for Prolog. (Jekejeke)

We updated our deployment guide to conform to our new programming API for Jekejeke Prolog. In this new programming API the application programmer can directly use strings, there is no need to wrap them in a class TermAtom. But the new programming API for Jekejeke Prolog has also further goodies. To sum up the following changes are available:

Interactor Interface:
   As the first screenshot shows the new programming API goes with Java iterator inspired methods. The class Knowledge base has a method iterable() which will return an Interpreter. The class Interpreter has a method iterator() which will return a CallIn. The new programming API now also allows multiple iterators at the same time without spawning a thread.

Class Path Loading:
   The second screenshot shows the preferred way to load a Prolog text. We abandoned the path/1 constructor and now go exclusively with the library/1 constructor when a Prolog text should be loaded from the class path. When using the library/1 constructor it is not necessary to mention the extension (.p, .pl or .pro).

Lightweight Atomics:
    The third screenshot shows the wastely simplified code when using atomics in the programming API. Prolog atoms/functors, Prolog numbers and Prolog references can now be directly passed and returned by Java strings, Java numbers and Java classes. So creating a compound <agefrom> =< <COLUMN_AGE> becomes a one liner TermCompound("=<", Integer.valueOf(agefrom), vars[COLUMN_AGE]).

We made recently a last change to the programming API. We still preserve a hierarchy rooted in our Term class besides the new hierarchy rooted in Java Object class, which facilitates the use of the programmming API. The Term hierarchy is then needed when Prolog atoms/functors also carry call-site information. There was a little glitch in this hierarchy which will be get fixed for the next release.

Nevertheless we could already update all our deployment examples. Terminal and Standalone deployment examples have already been rewritten and tested. Web and Database deployment examples have already been rewritten, but we should do some testing. Mobile deployment example has been rewritting and lifted to Android 6.0. The last screenshots show the mobile example in action.

When developing mobile applications for Android with Jekejeke Prolog we recommend using the HAXM emulator. On the windows platform this emulator has the fastest start-up time and also the most fluid execution. We even have the impression that the HAXM emulator is faster that many mobile devices and more or less on par with the Java JVM. For the HAXM emulator VT has to be enabled in Bios.

Last but not least we have updated the android manifest XML. The changes in the android manifest and the use of the lasted Android SDK to compile the mobile example results in a more modern look & feel when we run the application. The mobile application is a little bit unorthodox since we create all widgets on the fly. Nevertheless the basic styling of the widgets depends on android manifest and SDK.

Intel® Hardware Accelerated Execution Manager

Jekejeke Prolog Mobile Deployment Example:
Add a comment...

I am completely new to Prolog. I am coming from Web development mainly with Ruby on Rails.

What is the best resource(s) that I can use to start learning Prolog? Plus, setting up development environment on Mac?

Thanks in advance

Anne Ogborn's profile photoIgor Maznitsa's profile photo
the book of Ivan Bratko "Prolog Programming for Artificial Intelligence" is the best about Prolog
if you want to play with small tests of prolog then you can try my java prolog engine with embedded easy UI editor
Add a comment...

ayami asakura

Discussion  - 
can i ask, what's the problem in this

write('What game do you wish to play?'), nl,
write('Enter game1 followed by a period(.) to play Rock, Paper, Scissors, Lizard, Spock'), nl,
write('Enter game2 followed by a period(.) to play Animal Guessing Game'), nl,

checkInp(H) :-
H == 'game1' -> consult(''); consult('

PS: Codes Updated

I mean, it always give this error zz
ERROR: Type error: `dict' expected, found `game1' (an atom)

PS: Updated, it no longer posted the error above
but i need to type game2 2 times to play the game. is there something wrong in the code ?
Anders Jackson's profile photoayami asakura's profile photo
well i copied what you posted, and made some adjustment :D
Add a comment...

ayami asakura

Discussion  - 
uhm.. i'm sry i'm just new to prolog, may I ask, is there a GUI of Prolog?

i was task to create a Rock Scissor Paper Lizard Spock game in prolog,
but i all see is Text.
is there a GUI so I can Put a Pic in it ?
Clark Wilson's profile photoAnne Ogborn's profile photo
yes, but writing in anything but Prolog makes me feel queasy and bloated. So I advocate the Prolog only solution.  But Prolog provides many methods, to each their own.
Add a comment...
ANN: Jekejeke Prolog 1.0.9 (Java auto loading)

We have just uploaded the new release of Jekejeke Prolog. We were mainly improving the module system:

- Richer Foreign Function Interface:
Besides introducing a new data type of small floats, denoted by the "0f" prefix, we have also extended the foreign_XX/3 directives. Its now possible to register Java methods and Java fiels as evaluable functions, and Java constructors and Java fiels as predicates.

- Prolog Text Auto Loading:
A qualified predicate or evaluable function call will automatically load a module if it hasn't yet been loaded. Currently modules names are first looked up in libraries. This means the following works now:

   ?- basic/lists:member(X, [1,2,3]).

If a module name is not found, an empty module whos members are automatically public is created. This means the following now works as well:

   ?- [user].
   ?- foo:bar.

- Java class Auto Loading:
Additionally a module name is also looked up in the Java class path. If a corresponding Java class is found, this Java class is made available to the Prolog system. Here is an example how the Java class java.lang.Math is automatically loaded:

   ?- X is java/lang/'Math':'PI'.

And here is an example how the Java class java.lang.System and are automatically loaded:

   ?- java/lang/'System':out(X), java/io/'PrintStream':println(X,'abc').

When a Java class is automatically loaded foreign_XX/3 directives are automatically placed. For overloaded Java class members branching code is generated which also respects specificity of argument types and inheritance of Java class members from the super class.

Happy coding!

Android Appstores:

Add a comment...

Anne Ogborn

Discussion  - 
Aaargh - looking for a constructive area geometry package for Prolog
Add a comment...

Igor Maznitsa

Discussion  - 
funny result in SWI-Prolog if to try to prove a non-instantiated variable
?- X.
% ... 1,000,000 ............ 10,000,000 years later
%       >> 42 << (last release gives the question)
Add a comment...

Juan Bridges

Sticky Posts  - 
good night!! hello everybody!
my name is juan bridges and i'm a student of informatical engineering,and i need some help for use of visual prolog  7.5 and the use of events in listbox and buttons,thanks for your help
Add a comment...
Who let the Dogs out? Development & Minlog on Google Play!

Just uploaded Jekejeke Minlog and Jekejeke Development to Google Play. This is a little experiment in giving these two apps a wider audience. Beforehand these apps were only downloadable from . One has still to go to this website to obtain an evaluation license.

But the apps are now also visible on Google Play. Possibly we might get feedback on how well the apps integrate on the Android platform. Jekejeke Minlog is an extension. Before Jekejeke Minlog can be used one has to either install Jekejeke Runtime or Jekejeke Development or both. Jekejeke Minlog itself will not show a run icon on the Android desktop, instead the Runtime or the Development will allow loading it.

Besides testing the extension mechanism on a greater scale, we might gradually move from this testing stage to more mature apps and possibly a better integration with Google Play. For the moment the icon of the apps on Google Play will be marked with "Beta" to indicate that this stage has not yet been reached.

Happy Coding!

Jekejeke Minlog on Google Play

Jekejeke Development on Google Play
Add a comment...

Anne Ogborn

Discussion  - 
Launch! Our new SWI-Prolog powered website has gone live!  
This is the first product to come out of The Elgin Works.
Toucan Laser Baked Color is an advanced coloring agent for laser engraving. Toucan colors liven up laser engraved items, and provide increased contrast that increase sales.
Add a comment...

About this community

The Prolog world is divided into too many armed camps surrounding specific implementations: YAP, SWI, SISCtus, GProlog, etc. This community is a place where anybody interested in Prolog can discuss any dialect of Prolog. (Even weird things like Logtalk!)

hernan biondini

Implementations  - 
Edulog is a software application written in Java which aims to facilitate the teaching of logic programming language Prolog.
It is a university project, help us to grow with like.

EDULOG es una aplicación de software escrita en Java cuyo objetivo es facilitar la enseñanza del lenguaje de programación lógica PROLOG.
 ·  Translate
Add a comment...

Matthew DeVore

Implementations  - 
If you are a Java coder interested in logic programming, check out Gulava - a relational programming library for Java. You can write Prolog-style code and get integration with the JVM and your favorite Java libraries.

Feedback is welcome!

GitHub site:
Simple tutorial:
gulava - Relational programming library for Java.
Add a comment...

Ian Siao

Discussion  - 
Can someone give me a consulting code for prolog: division without using "/" or using repeated subtraction. Thank you!
Craig Taylor's profile photoIan Siao's profile photo
thank you for the help! I'll try my best to finish it.
Add a comment...
New discussion of the deployment of the sto/1 constraint for type inference available.

Notice the beauty of the Prolog solution compare to a solution in a functional programming language.

New Jekejeke Minlog release with predefined sto/1 constraint coming in a few days.
Add a comment...

Torbjörn Josefsson

Implementations  - 
Example of "visual" prolog in industrial use:

Hi! Just wanted to show the system I'm working on - this is "just" the newest iteration (implemented in WPF, generating prolog code that will be run by Sicstus Prolog) - we've been doing this for 10+ years :) - this version has not quite reached production status yet, hence extra ugliness.

We can run the "models" compiled in different ways; in a UI, where users can interact with it (showing/hiding different questions, based on given facts) or in web-services where we process potentially huge amounts of incoming structured data. - and a few other ways as well..

Here's the bare minimum necessary to try to make sense of the drawings:

Each model has unique, named "parameters" organized in a hierarchic Page/Page section structure, and in these drawings I make a few rules working on them to come to some conclusions about a prospective loan-client.

..ok.. I don't know how to make this look nice in G+, so here's a bunch of strangely ordered pictures
4) Parameter definitions view - we often have 100-300 params like this
3) A simple parameter rule, where the value of prApplicantAge is set
2) Some more rules, with comments
1) Conclusion-rules

How does it represent a logical rule? - A shape without outgoing arrows will (if it one of the shapes that can) become a rule, with incoming arrows as preconditions. -Before the logical statement of each shape is resolved, all the logical statements pointing at it are resolved, in left-to-right order (recursively, of course :))

Not shown: table data, foreign data structures used, and a bunch of other shapes and their uses.

We use this a Lot - we have models with hundreds of Big drawing pages, dozens of big data tables, and 1000+ different foreign classes imported.

Questions welcome: I don't think any of this is really a secret - just not very publicized, and I felt like sharing it with the Prolog community :)

It's surprisingly handy to work with, and we wouldn't have it any other way - Prolog rules!
Torbjörn Josefsson's profile photoAnders Jackson's profile photo
Well, you could go thrugh the program if you want to know? They start this autumn with next acceptens. ;-)
Or you could mail him.
Add a comment...

Olivier Duhart

Implementations  - 
a very basic prolog implementation in full python ... still a work in progres with very sharp edges.
the parser part is written with PLY
solve partially a classical family problem for now.

help greatly appreciated for who wants test / debug

pyProlog - prolog parser and interpreter
Add a comment...
I need code in prolog about only any two of this:

Depth first search
Breadth first search

Uniform cost search
Greedy search

A* search

Iterative deepening search
Limited depth search
Anders Jackson's profile photo
By the way, The Craft of Prolog is a really good book.
Add a comment...

Shon Feder

Discussion  - 
Here is a request for "Recommended topics to cover for Prolog presentation" to an audience of "primarily senior programmers and architect enterprise in object-oriented imperative paradigms". I will link this G+ post in a comment there too, so it is feasible to offer suggestions as replies to his post if you're not reddit inclined.
I've tentatively agreed to give a talk on Prolog at a local user group for programming. I gave a short 7 minutes lightening talk on Prolog's...
Michael Hendricks's profile photo
I posted some thoughts on the original Reddit thread.
Add a comment...

Clark Wilson

Discussion  - 
Please tell us about the Elgin Works?
Launch! Our new SWI-Prolog powered website has gone live!  
This is the first product to come out of The Elgin Works.
Toucan Laser Baked Color is an advanced coloring agent for laser engraving. Toucan colors liven up laser engraved items, and provide increased contrast that increase sales.
Anne Ogborn's profile photo
it's crazy working on this small scale. Today I've done software engineering, social media marketing, and fabricated a camera holder in the shop so we can do videos. Tomorrow I'll be a film actor and director and then a video editor- not to mention graphic designer, web designer, custodial worker, and who knows what else.
Add a comment...