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:

  1. Save your query in QUERY. : - Stamps as queries.
  2. Run swipl with the redirection of OUTPUT.TXT: swipl -s QUERY.TXT -g halt --quiet & gt; OUTPUT.TXT
  3. 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

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -