Questions tagged [jpl]

JPL is a set of Java classes and C functions providing an interface between Java and Prolog.

JPL is a set of Java classes and C functions providing an interface between Java and Prolog. JPL uses the Java Native Interface (JNI) to connect to a Prolog engine through the Prolog Foreign Language Interface (FLI), which is more or less in the process of being standardized in various implementations of Prolog. JPL is not a pure Java implementation of Prolog; it makes extensive use of native implementations of Prolog on supported platforms.

JPL is designed in two layers, a low-level interface to the Prolog FLI and a high-level Java interface for the Java programmer who is not concerned with the details of the Prolog FLI. The low-level interface is provided for C programmers who may wish to port their C implementations which use the FLI to Java with minimal fuss. http://www.swi-prolog.org/packages/jpl/java_api/index.html

79 questions
17
votes
2 answers

Exception thrown when trying to use JPL and YAP Prolog in OS X

I am trying to use JPL for the interaction of Java programs and YAP Prolog. In my java file, this line is throwing an exception: Query query = new Query("consult", new Term[] { new Atom("test.pl") }); The exception is shown below: Exception in…
Sergio
  • 8,532
  • 11
  • 52
  • 94
6
votes
1 answer

How to use JPL (bidirectional Java/Prolog interface) on windows?

I'm interested in embedding a Prolog interpreter in Java. One option is using JPL, but the download links on the JPL site are broken, and the installation page mentions a jpl.zip that I can't find. I downloaded SWI-Prolog which seems to include JPL…
Firas Assaad
  • 25,006
  • 16
  • 61
  • 78
5
votes
1 answer

How do I wire up my Java UI to a JPL Prolog application?

I'm writing an application in Java using JPL provided by SWI-Prolog to call Prolog from Java. I'm using Eclipse as the IDE. I don't know how to start this example I found online: Here the java code: package prolog; import java.awt.Container; import…
nicol
  • 51
  • 1
  • 2
4
votes
1 answer

Using SWI-Prolog with Eclipse and Java (and JUNG): Should I use ProDT, PDT, or both?

I want to use SWI-Prolog, Eclipse, and Java together and I have two interrelated related issues: I don't know if I should use ProDT, PDT or both in combination. PDT says that it includes a "subsystem that enables Java code to interact with…
Quine42
  • 141
  • 2
4
votes
4 answers

Docker container with SWI-Prolog terminated with fatal error

Im developing a Spring Boot Web Application, using SWI-Prolog's JPL interface to call Prolog from Java. In development mode everything runs OK. When I deploy it to Docker the first call on JPL through API, runs fine. When I try to call JPL again,…
Antifa
  • 377
  • 1
  • 4
  • 14
4
votes
1 answer

How to use swi-prolog with android

I have developed a prolog program with swi-prolog and I attached a interface for it using regular java with JPL.jar, That is running perfectly. Now I want do the same with android mobile interfaces instead of java desktop interfaces. So I created a…
Mathee
  • 691
  • 7
  • 16
4
votes
4 answers

Connect between java and swi prolog

I am trying to run swi prolog from java. I am using eclipse and I have inserted jpl.jar into the project (properties->libraries->add external jar) and when I try to run a program (it is a sample of jpl so it should work..) I get an error: Exception…
Noray
  • 165
  • 2
  • 6
3
votes
1 answer

Retrieving ERROR messages from SWI-Prolog using Java and JPL

When I use JPL (from JavaSE 1.8), Prolog (SWI-Prolog version 8.2.2) can return an error message without throwing an exception. E.g. when using consult and the file has errors: import org.jpl7.Query; public class Test { public static void…
3
votes
2 answers

How to solve "Symbol lookup error" by using JPL on Ubuntu11.04?

I'm coding a program in Java and I would like to connect to Prolog. Thus, I decided to use JPL. It is perfectly to use JPL on Windows Vista. Later, I have to change the OS platform to be Ubuntu 11.04. Unfortunately, there is an error: symbol lookup…
BB.
  • 707
  • 2
  • 11
  • 22
3
votes
1 answer

Equivalent of "assert" in JPL7

I am currently creating a Java Swing GUI where the user can select what type of fruits they like. Depending on their choice, only certain fruit products will be shown. For instance, if the user selects "grape", then only grape products like grape…
Cheryl
  • 67
  • 12
3
votes
2 answers

Using JPL with SWI-Prolog on macOS

I'm trying to use JPL with SWI-Prolog on macOS High Sierra and I'm having troubles. In fact, at first the libjpl.dylib was not found so I added the path to it to java.library.path via java…
Théo Champion
  • 1,701
  • 1
  • 21
  • 46
3
votes
1 answer

JPL7, list of strings in prolog-query

i have a prolog-query which needs an array as atom: searchEventsOnCategory(Categories,Events) Categories is a list of strings. Example input: searchEventsOnCategory(['Bar','Disco'],Events) Output: Event =…
DraGott
  • 53
  • 1
  • 7
3
votes
1 answer

How to get swi-prolog console output using JPL?

I need the swipl console output (the trace output) for one of my projects. I'm trying to use the JPL7 API to do this but I can't seem to find a method to grab output from the swipl console. Is there a way I can do this? Or is there a query I can run…
absolutelydevastated
  • 1,657
  • 1
  • 11
  • 28
3
votes
1 answer

JPL textToTerm only produces anonymous variables

I'm using JPL to do some SWI-Prolog queries in a Java program. When I want to create a new Query, I would like to be able to use jpl.Util.textToTerm to directly instanciate Terms from a user input, without parsing it myself. The problem is that this…
Fatalize
  • 3,513
  • 15
  • 25
3
votes
1 answer

Querying Prolog with multiple results in JPL

I want to build a knowledge base for an AI in Prolog. First I want to try to learn Prolog and it's uses by doing a toy example with elephants, giant ants etc. I am using: NetBeans 8.0.1, SWI-Prolog 6.6.6 and Windows 8.1. Everything is 64-bits and…
m0rch
  • 31
  • 4
1
2 3 4 5 6