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
1
vote
0 answers

Retrieving Error messages from SWI-Prolog using java and jpl

When I use JPL (from JavaSE 1.8), Prolog (SWI-Prolog version 8.2.4) it return an error message . E.g. when using consult and the file has errors: ERROR: c:/program files/swipl/library/jpl.pl:5428: ERROR: '$open_shared_object'/3: The specified…
1
vote
1 answer

Problem connecting Java and Prolog with JPL

I wanted to connect Java and Swi Prolog together using JPL. When I added the library to my project on Intellij the code compiled and when I tried to run a query I got a runtime error: Exception in thread "main" java.lang.UnsatisfiedLinkError: no jpl…
Danny
  • 125
  • 1
  • 7
1
vote
1 answer

How to turn a java array into a prolog list and make a jpl Query with it?

I'm making a sudoku solver in java, using a small prolog kb at it's core. The prolog "sudoku" rule requires a prolog list of lists. In java I have an int[][] with the sudoku values. I've made the Query run succesfully with a prolog list of…
Mark Rensen
  • 129
  • 1
  • 7
1
vote
0 answers

How to connect Eclipse with JPL on OS X

I've got problem which wasn't solved anywhere else. I've downloaded libjpl.dylib and copied to /usr/local/Cellar/swi-prolog/7.6.4/libexec/lib/swipl-7.6.4/lib/ The output of otool -L of the libjpl.dylib give me this…
1
vote
0 answers

JPL - Java waiting for a certain solution from a prolog query

Im struggling to get this done. I have an User Interface in Java that controls a system using JPL, prolog. Firstly i run a simple query assert(goal( work_1 )). When the process is done it just asserts done( work_1 ). To process the next goal goal(…
1
vote
0 answers

Query Prolog Module through JPL

I am trying to query a dynamic module of a prolog file using JPL. Thanks to this question( how to consult file as a module in jpl) I was able to consult, assert to, and retract from the module with Query objects declared as such: assertFact = new…
1
vote
1 answer

Make and load copy of SWI-Prolog Instance with JPL

What I am trying to do is create a copy of a Prolog instance and load that copy with JPL (the Java-Prolog Interface). I can think of several possible ways to do this, but none of them are completely worked out, and that is why I have come…
1
vote
1 answer

Prolog List in Java with JPL

i am a prolog-noob and have a problem with a prolog-list in java. Prolog: event( 'Number1', 54.320021, 13.043840, [sport,hotel,schwimmen,sauna]). event( 'Number2', 54.320678, 13.046984, [einkaufen]). findAllCategories(Categories):- …
DraGott
  • 53
  • 1
  • 7
1
vote
1 answer

SWI Prolog Java jpl.PrologException Query not working

I have two Prolog files. Clauses and Rules as follows: clauses.pl get(mary,milk). go(sandra,kitchen,1). get(john,football). go(john,hallway,1). go(mary,garden,1). go(john,kitchen,2). rules.pl /* X = person Y=location T,T2= time This rule finds…
David Farthing
  • 237
  • 2
  • 13
1
vote
1 answer

How to retrieve all the facts resulting of an inference of chain rules in Prolog

I have implemented several chain rules in a way that the last rule obtain the desired result depending on the result of the previous ones. rule1(X,Y) :- pred1(X,Z), pred1(Y,Z). rule2(Z,T) :- rule1(X,Y), pred2(Z,X), pred2(T,Y). I…
Caleb
  • 179
  • 2
  • 17
1
vote
0 answers

Can`t get solutions from swi-prolog and JPL

I want to get prolog Solutions by JPL using DCG grammar which one is stored in external file but when I call a method getSolution from my class a get an exception from prolog: org.jpl7.PrologException: PrologException:…
matt_2006
  • 31
  • 4
1
vote
0 answers

Java-Prolog wrong Results

I made a query with Org.JPL7 in Java, and I tried to do it several times in diferent ways but it gave to me a lot of wrong results. The code in .pl file is the next. loco(eso,eso1). loco(eso3,eso2). and the Java code is the next. Query q2= new…
1
vote
0 answers

Prolog JPL command with Java

I have a expert system written in prolog that gives me problems when I run it from a java interface. The problems are related to the comunication of the output. I tried Streams but (only with this project) they don't work fine, the application…
1
vote
0 answers

JPL parses strings as atoms

Suppose I have the following code, which prints It works! if a term is a string using the predicate string/1: Term string = org.jpl7.Util.textToTerm("\"test\""); Query testQuery = new Query("string",string); if(testQuery.hasMoreSolutions()) { …
Fatalize
  • 3,513
  • 15
  • 25
1
vote
1 answer

How to share an object state between java and prolog with JPL?

I want to create an object in java: MyObject obj = new MyObject (); and I want to pass it to prolog with a jpl query. How can I accomplish java to prolog object passing? I know that I could use jpl_new in a prolog file like this: execMethod :- …
Kami
  • 1,079
  • 2
  • 13
  • 28