Re: [eclipse-clp-users] JavaInterface Backtrack results

From: Kish Shen <kisshen_at_...5...>
Date: Tue, 22 Apr 2008 18:07:56 +0100
Hi,

One way to do this is described (briefly) in the Java Interface chapter 
of the Embedding and Interfacing manual:

http://www.eclipse-clp.org/doc/embedding/embroot045.html#toc45

in the section 8.4.3, More details about rpc goal execution, the 
subsection `Nondeterminism' says:

-----

The rpc feature does not support the handling of nondeterminism in the 
execution of the ECL^/i/ PS^/e/ goal. If the goal succeeds, control is 
returned to Java immediately after the first solution to the goal is 
found in ECL^/i/ PS^/e/ . All choice-points thereafter are ignored. So, 
for example, although the first ECL^/i/ PS^/e/ goal below would leave 
choice-points, it would be equal in effect to the second.

...
result = eclipse.rpc("member(X, [1, 2, 3, 4, 5])");
...
result = eclipse.rpc("member(X, [1])");

This is not a practical problem. It merely implies that if you are using 
nondeterminism to generate multiple solutions, you should collect these 
on the ECL^/i/ PS^/e/ side using a meta-level built-in predicate such as 
findall/3 and then return the result to Java.

----

If you need to process the results in real time as they are produced, 
you can send the results back via a FromEclipseQueue. You can find an 
example that uses this method in EclipseMapColourer.java in
the doc/examples/JavaInterface directory of ECLiPSe distribution.

A paper that describes the high-level generic interface (of which the 
Java one is an instance of), including a detailed description of the map 
colouring example mentioned above is available at:

http://www.eclipse-clp.org/reports/eclipse_generic_interface.ps.gz

although the language used for illustration is tcl/tk rather than Java, 
but exactly the same ideas are used in both (and in fact the same 
ECLiPSe side code is used for both the Tcl/Tk and Java examples).

Cheers,

Kish
Luiz Carlos d´Oleron wrote:
> Hello All,
>
> I´m using JavaInteface to query my rules:
>
> EclipseEngine eclise = initEclipse();
> CompoundTerm result = eclispe.rpc("myQueryHere.");
> //using result here...
>
> But only the first result is returned. How can I obtain the others 
> backtrack results?
>
> Best Regards,
>
> -- 
> Luiz Carlos d´Oleron
> CIn - Centro de Informática/UFPe - http://www.cin.ufpe.br
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
> Don't miss this year's exciting event. There's still time to save $100. 
> Use priority code J8TL2D2. 
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> ------------------------------------------------------------------------
>
> _______________________________________________
> ECLiPSe-CLP-Users mailing list
> ECLiPSe-CLP-Users_at_lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/eclipse-clp-users
>   
Received on Tue Apr 22 2008 - 10:08:31 CEST

This archive was generated by hypermail 2.3.0 : Wed Sep 25 2024 - 15:13:20 CEST