6

I have built an expert system in Prolog. Is there a way I can incorporate the Prolog code into my Android application so that the application takes arguments passes them to the Prolog expert system, and the expert system returns the answer to the Android application?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user434885
  • 1,988
  • 6
  • 29
  • 51

4 Answers4

7

Try if your prolog code compiles (and runs correctly ) with any of the JVM based prolog compilers: http://www.is-research.de/info/vmlanguages/tag/prolog/

If it does then you're in luck. It will most probably run on Android.

Peter Knego
  • 79,991
  • 11
  • 123
  • 154
6

There are the following differences between the normal Java platform and the Android platform:

  • Virtual Machine: Although the Dalvik machine can execute Java 1.5, it does not support all libraries that are normally available under the standard edition of Java. We found for example that Dalvik does not have javax.management.*. On the other hand Dalvik has some goodies which the standard edition of Java doesn't have, for example android.os.SystemClock.

  • User Interface: The Android platform comes with its own widget set and window manager. Also it has a package deployment system. On the other hand the standard edition of Java offers the Swing widget set, the AWT widget set. There is also the SWT widget set as third party product available. The standard edition blends into the OS window manager and doesn't demand a package deployment.

For Jekejeke Prolog we have recently done a branching of our development, on both levels. Since release 0.9.3 the interpreter is available in a version for the standard edition of Java and in a version for Android. Since release 0.9.5 the Runtime Library has a console as well and can be directly installed from:

Google Play
Amazone Appstore
Samsung Apps

The interpreter has a programming interface. You can tightly integrate it with your application. You can even bundle your application with the intepreter since it has a distribution license. The supported Prolog language is exactly the same for the standard edition of Java and for Android. Multi-threading is also supported on both platforms. You can download an embeddable .zip for your own development from the Jekejeke Website.

Best Regards

4

I've done something similar to this a long time ago.

It wasn't related to Android, but it was agnostic to that.

I used sockets to communicate with Prolog. Prolog would read the input, do its job and return the answer. The other application (in my experience) was using C++ and OpenGL, and it worked very well.

Using sockets in Android shouldn't be your problem. Unfortunately this was many years ago, and I don't believe I have the Prolog's source code to show you how to do it, but one option is: use sockets :)

Good luck! (I will try to find that source code, but I don't expect to find it!)

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Pedro Loureiro
  • 11,436
  • 2
  • 31
  • 37
3

We used tuProlog and overcame the porting process to Android. Have a look at the discussion page where you can peruse the resources we used and see what we ran into ....

Community
  • 1
  • 1
ProfVersaggi
  • 886
  • 13
  • 18