JESS: Iterate through facts from Java

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

JESS: Iterate through facts from Java

Negoita, Cristian
Hi all,

I have a query that I want to execute and get the results from java
code. What would be the proper/best way to do it?

I have smth. like: (defquery GetResults (Result))

In java, I call it with:
Iterator it = (Iterator) Rete.executeCommand("(run-query
GetResults)").externalAddress(context);

Now, how can I get my "Result" objects further?

Thank you all,
Cristian


--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [hidden email]'
in the BODY of a message to [hidden email], NOT to the list
(use your own address!) List problems? Notify [hidden email].
--------------------------------------------------------------------

Reply | Threaded
Open this post in threaded view
|

Re: JESS: Iterate through facts from Java

Mitch Christensen
I suspect you want to use Rete.runQuery() instead.

-Mitch

Negoita, Cristian wrote:

>Hi all,
>
>I have a query that I want to execute and get the results from java
>code. What would be the proper/best way to do it?
>
>I have smth. like: (defquery GetResults (Result))
>
>In java, I call it with:
>Iterator it = (Iterator) Rete.executeCommand("(run-query
>GetResults)").externalAddress(context);
>
>Now, how can I get my "Result" objects further?
>
>Thank you all,
>Cristian
>
>
>--------------------------------------------------------------------
>To unsubscribe, send the words 'unsubscribe jess-users [hidden email]'
>in the BODY of a message to [hidden email], NOT to the list
>(use your own address!) List problems? Notify [hidden email].
>--------------------------------------------------------------------
>
>
>  
>

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [hidden email]'
in the BODY of a message to [hidden email], NOT to the list
(use your own address!) List problems? Notify [hidden email].
--------------------------------------------------------------------

Reply | Threaded
Open this post in threaded view
|

Re: JESS: Iterate through facts from Java

friedman_hill ernest j
I think Mitch Christensen wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> I suspect you want to use Rete.runQuery() instead.
>

Yes, do use runQuery() instead of executing a script. But more
importantly, if you possibly can, use Jess 7 and use runQueryStar(),
which has a wonderfully simplified interface.

But if you have to use Jess 6, then just look in the manual:

http://herzberg.ca.sandia.gov/jess/docs/61/language.html#queries 

At the end of the section, just before section 2.9.1, there's a
complete example of invoking a query and getting the results in Java.


> Negoita, Cristian wrote:
>
> >Hi all,
> >
> >I have a query that I want to execute and get the results from java
> >code. What would be the proper/best way to do it?
> >
> >I have smth. like: (defquery GetResults (Result))
> >
> >In java, I call it with:
> >Iterator it = (Iterator) Rete.executeCommand("(run-query
> >GetResults)").externalAddress(context);
> >
> >Now, how can I get my "Result" objects further?
> >
> >Thank you all,
> >Cristian
> >
> >
> >--------------------------------------------------------------------
> >To unsubscribe, send the words 'unsubscribe jess-users [hidden email]'
> >in the BODY of a message to [hidden email], NOT to the list
> >(use your own address!) List problems? Notify [hidden email].
> >--------------------------------------------------------------------
> >
> >
> >  
> >
>
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [hidden email]'
> in the BODY of a message to [hidden email], NOT to the list
> (use your own address!) List problems? Notify [hidden email].
> --------------------------------------------------------------------
>



---------------------------------------------------------
Ernest Friedman-Hill  
Advanced Software Research          Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
PO Box 969, MS 9012                 [hidden email]
Livermore, CA 94550         http://herzberg.ca.sandia.gov

--------------------------------------------------------------------
To unsubscribe, send the words 'unsubscribe jess-users [hidden email]'
in the BODY of a message to [hidden email], NOT to the list
(use your own address!) List problems? Notify [hidden email].
--------------------------------------------------------------------