Passing SWI-Prolog Query from Java Program -
There is a query generated in the query variable by my Java program, I want to send SWI-Prolog to get its resolution. Displays the sub-code written in Java to communicate with SWI-Prolog.
process P = new process builder ("C: \\ program files \\ swipl \\ bin \\ swipl-win .exe") start () .; BufferedReader process output = new BufferedReader (new InputStreamReader (P.getInputStream ())); BufferedWriter process input = new buffed waist (new output point water (P.getOutputStream ()); String command tset send = query; ProcessInput.write (commandToSend); But the SWI-Prolog window opens, but I'm not writing the procedure to send SWI-Prolog. Can someone recommend me the best way to do this? I also need to produce a query execution from SWI-Prolog in a file.
Save your query to the external text file and from the command line (with the appropriate option set) swipl and perform the output redirect to another text file. Example:
- Save your query in QUERY.
: - Stamps as queries. - Run swipl with the redirection of OUTPUT.TXT:
swipl -s QUERY.TXT -g halt --quiet & gt; OUTPUT.TXT - Read the contents of OUTPUT.TXT
In addition to this, I suspect that you can use a combination of Runtime.getRuntime () Should use. Exec (...) and wait (...) to wait for swipl to generate the output.
Comments
Post a Comment