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

From: Luiz Carlos dŽOleron <doleron_at_...6...>
Date: Tue, 22 Apr 2008 15:12:23 -0300
Hello Kish,

Thanks a lot!

This solve my problem!

I wrote a spike (http://www.extremeprogramming.org/rules/spike.html) to
demonstrate this:

:- lib(ech).
:- constraints bird/1, fly/1, bird_fly/1.

bird(X) ==> X=pinguin ; X = albatroz ; X = bemtevi.
fly(X) ==> X =pinguin | false.

bird_fly(X) ==> bird(X) , fly(X).

[eclipse 6]: findall(X, bird_fly(X), L).

X = X
L = [albatroz, bemtevi]
Yes (0.00s cpu)

Muito Obrigado.

2008/4/22 Kish Shen <kisshen_at_...5...>:

> 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
> >
> >
>
>


-- 
Luiz Carlos dŽOleron
CIn - Centro de Informática/UFPe - http://www.cin.ufpe.br
Received on Tue Apr 22 2008 - 11:12:33 CEST

This archive was generated by hypermail 2.3.0 : Tue Apr 16 2024 - 09:13:20 CEST