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
0
votes
1 answer

How to use String (atom) terms in Gnu Prolog for java

I'm a newbie in prolog and wanted to write wampus AI with prolog + java , trying to do the logic in prolog and GUI in java but im stuck and a very basic level. basically I have something like this in my knowledge base parent(john, sarah). and i…
0
votes
1 answer

Spring Data update query error

I think the error is a type missmatch exception, but i don't know why i am getting it. org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'carController' defined in file [C:\Users\aleks\Desktop\Spring…
Alexander
  • 113
  • 1
  • 9
0
votes
0 answers

SWI-Prolog: Could not open resource database "../../src/swipl.prc"

I have checked out the SWI-Prolog JPL library, and I am trying to add some functionality. Right now, I am just trying to get the tests to work in the TestJUnit test. However, I am getting the following error: SWI-Prolog: [FATAL ERROR: Could not open…
0
votes
1 answer

Need help to understand Java Bytecode Instruction

I'm trying to do static analysis of bytecode in Prolog. I'm using the bcel library to get instruction list from a MethodGen. For aload_0, I get 0:aload_0[42](1) I understand aload_0 is meant to load 0th Local variable. But I'm having a hard time…
CodeSsscala
  • 729
  • 3
  • 11
  • 23
0
votes
1 answer

how to get jpl latest version: jpl7?

I'm using a java project with the jpl library, but i'm getting the compile error "the package org.jpl7 does not exist". I've tried to download the latest version, but I've probably get the jpl3 version. How to get the latest version of jpl7? I've…
ajmf
  • 1
  • 1
0
votes
0 answers

redirect java console content to UI jframe

I have a prolog file (Expert System) that I consult from Java using Jpl libraries (org.jpl7.*) and I have an UI using jframe where I want to show the output of prolog's queries.when consult prolog file in netbeans,read() predicate runs in console…
student
  • 41
  • 1
  • 5
0
votes
1 answer

How to configure SWI-prolog with Java on Eclipse on OS X (JPL)

I am trying to get Java and Prolog to work together (on OS X 10.11.1). What I want, is just to input my Prolog Queries from Java. When I run Java code such like PrologProcess process = Connector.newPrologProcess(); process.queryOnce(query); I get…
Olia
  • 1
  • 2
0
votes
0 answers

Is there a way to dynamically generate Prolog rules from Java (based on user input)?

Key word dynamically. I've been trying out JPL for SWI-Prolog but as far as I can tell, all that can do is take a pre-written Prolog file and dynamically construct some queries to be run on that knowledge base. It has no way of actually adding to…
user5513268
  • 41
  • 1
  • 2
0
votes
1 answer

Redirect java console content on java UI

I have a prolog file (Expert System) that I consult from Java using Jpl libraries (org.jpl7.*) and I have an UI where I want to show the output of prolog's queries. This is my Custom Output Stream that should redirect every console content into my…
0
votes
1 answer

Java Die, Counting Snake Eyes

Okay so for university, we have to Create two Die objects and roll them several times, counting the number of snake eyes that occur. this is the code I have, I need some help as every time I compile and execute my program, I get a fail on it. I'm…
Tyxex
  • 1
  • 4
0
votes
1 answer

How to get solution X prolog in java

I use jpl libraries to connect prolog and java. In prolog, I can execute query : ?- meaning_forms([apple,is,fruit],X). output is : X = [is_a(x1, x2), objectx(x1, apple), objectx(x2, fruit)]. But in java, I can’t see output of this query. I tried…
deniss
  • 9
  • 2
0
votes
1 answer

Assert facts from java to prolog

I'm using SWI-Prolog with the JPL library. I have a program written in Java that produces strings like these: fact(1,2) fact(2,3) fact(1,3) Then, there is a prolog file that needs this facts in the head of file. I do not want neither insert the…
user840718
  • 1,563
  • 6
  • 29
  • 54
0
votes
2 answers

JPL Can't find dependent libraries of jpl.dll

After installing SWI-Prolog in my computer, I went on to try one of its examples, and found out this particular beauty: run: Exception in thread "main" java.lang.UnsatisfiedLinkError: C:\Program Files (x86)\swipl\bin\jpl.dll: Can't find dependent…
0
votes
1 answer

Calling the listing function in jpl

I was wondering whether anyone had managed to use the 'listing.' command in JPL to examine the contents of the Prolog knowledgebase? JPL requires you construct queries and will return solutions based on the variables which you set in the query. …
Huguenot
  • 2,427
  • 2
  • 17
  • 14
0
votes
1 answer

Get JPL output into a string in Java

I'm using Prolog in java through JPL, I have some predicates with the format predicate: format("Result ~p, ",[X]), Using JPL in java the output of format goes to the console output in java, how can I retrieve this result into a string variable in…
Naty Bizz
  • 2,262
  • 6
  • 33
  • 52