Getting hook to the (a) prolog console from Java

View: New views
3 Messages — Rating Filter:   Alert me  

Getting hook to the (a) prolog console from Java

by Ivo Swartjes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Is there a way to somehow get access to the SWI-Prolog environment that
JPL uses via a console? Ideally I'd like to be able for instance to
start plwin.exe halfway the execution of my Java software to gain access
to the Prolog environment (including its state established by running
the software) and run some queries (for testing purposes).
Alternatively, I would not mind handling input and output from prolog
within my application itself. Is there any way to do this?

I looked into the manual and found prolog_ide/1 which apparently is not
what I'm looking for.

Thanks,
Ivo

------------
For further info, please visit http://www.swi-prolog.org/

To unsubscribe, send a plaintext mail with "unsubscribe prolog <e-mail>"
in its body to majordomo@...

Re: Getting hook to the (a) prolog console from Java

by Paul Singleton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Ivo Swartjes wrote:
> Hi,
>
> Is there a way to somehow get access to the SWI-Prolog environment that
> JPL uses via a console? Ideally I'd like to be able for instance to
> start plwin.exe halfway the execution of my Java software to gain access
> to the Prolog environment (including its state established by running
> the software) and run some queries (for testing purposes).
> Alternatively, I would not mind handling input and output from prolog
> within my application itself. Is there any way to do this?

Have a look at attach_console/0 in the Ref Manual 8.5.1 Debugging threads

   http://gollem.science.uva.nl/SWI-Prolog/Manual/thutil.html#sec:8.5.1

> I looked into the manual and found prolog_ide/1 which apparently is not
> what I'm looking for.
>
> Thanks,
> Ivo
>
> ------------
> For further info, please visit http://www.swi-prolog.org/
>
> To unsubscribe, send a plaintext mail with "unsubscribe prolog <e-mail>"
> in its body to majordomo@...

Paul Singleton

------------
For further info, please visit http://www.swi-prolog.org/

To unsubscribe, send a plaintext mail with "unsubscribe prolog <e-mail>"
in its body to majordomo@...

Re: Getting hook to the (a) prolog console from Java

by Ivo Swartjes :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,
>> Is there a way to somehow get access to the SWI-Prolog environment
>> that JPL uses via a console? Ideally I'd like to be able for instance
>> to start plwin.exe halfway the execution of my Java software to gain
>> access to the Prolog environment (including its state established by
>> running the software) and run some queries (for testing purposes).
>> Alternatively, I would not mind handling input and output from prolog
>> within my application itself. Is there any way to do this?
>
> Have a look at attach_console/0 in the Ref Manual 8.5.1 Debugging threads

I tried running attach_hook/0 through JPL, but this gave the following
error:

jpl.PrologException: PrologException: error(existence_error(procedure,
:(thread_util, /(win_open_console, 5))), context(:(system, /(call, 1)),
_0))
   at jpl.Query.get1(Query.java:338)
   at jpl.Query.hasMoreSolutions(Query.java:251)
   at jpl.Query.allSolutions(Query.java:551)
   at vs.rationalagent.ui.PrologCommand.execute(PrologCommand.java:46)

I find this strange as win_open_console seems to be a predicate in the
system module, and not in the thread_util module. Similar problem for
using interactor/0.When run in the plwin console, attach_console/0 just
yields true, seemingly without doing anything (probably because there is
already a console attached), whilst interactor/0 starts up an
interaction window. But none of these existence errors occur.

Any ideas on what I can do or try?

Thanks,
Ivo

------------
For further info, please visit http://www.swi-prolog.org/

To unsubscribe, send a plaintext mail with "unsubscribe prolog <e-mail>"
in its body to majordomo@...