Hi Dr Hill,

Thanks a bunch for your help.

I have added the "$" in the Jess file, as shown below

              (deftemplate match-muscle-machine
              (slot body-part)
              (multislot station) );;close 
             
             (asserrt (match-muscle-machine (body-part arms-upperfront)
(station N5 N8 N10 C1)) )  


             (defquery search-relevant-machines "Get the relevant machines"
             (declare (variables ?findx))
             (match-muscle-machine
             (body-part ?findx) (station ?$station)) ) 

In the Java program

              QueryResult result = r.runQueryStar
             ("search-relevant-machines", new
ValueVector().add("arms-upperfront"));

             while (result.next()) {


               Value vv = result.get  ("station");      

From
http://herzberg.ca.sandia.gov/jess/docs/70/api/jess/QueryResult.html

Now Im not sure how best to store the multilslot value. I use jess object
"Value vv" to store it and it works. 

But I do not know how to get each of them out so I have tried using
ValueVector

                ValueVector vv = result.get  ("station");       
                ValueVector vv = result.getObject  ("station"); 

'cos in the book page 240 on "extending the Jess language" there are ways to
get each value out using
ValueVector.get(1) but the java compiler keeps saying "incompatible types"
when I use the 2 ValueVector statements above. 

In short,
How can I get each element out from "Value vv"
Or how can I correctly use ValueVector?
Do people usually use Value or ValueVectors?

thank you so much
rgds
rick




Ernest Friedman-Hill wrote:
> 
> Queries are just like rules; the patterns you write have to match the  
> facts you actually have.
> 
> The pattern "(station ?station)" matches when the station multislot  
> contains exactly one station. "(station ?s1 ?s2)" matches when there  
> are exactly two. A multifield matches any number: "(station $?all)".  
> See "Jess in Action" page 103.
> 
> On Mar 25, 2007, at 12:27 AM, ricktee wrote:
> 
>>
>> Hi,
>>
>> I just changed
>>
>>               (deftemplate match-muscle-machine
>>            (slot body-part)
>>            (multislot station)       );;close
>>               (asserrt (match-muscle-machine         (body-part arms- 
>> upperfront)
>> (station N5 N8 N10 C1))      )
>>
>> to
>>
>>               (deftemplate match-muscle-machine
>>            (slot body-part)
>>             (slot station)   );;close
>>                (asserrt (match-muscle-machine        (body-part arms- 
>> upperfront)
>> (station N5))        )
>>
>> and it works.
>>
>> Is there any way for me to get a string from a multislot (station  
>> N5 N8 N10
>> C1)) )  using defquery?
>>
>> thanks
>> rick
>>
>>
>> ricktee wrote:
>>>
>>> Good day,
>>>
>>> The write query example at
>>> http://herzberg.ca.sandia.gov/jess/docs/70/queries.html#write_query
>>> shows that it is able to get variables from single slots. Does it  
>>> also
>>> work with multislots? 'Cos I can't get mine to work.
>>>
>>> I have this template & fact
>>>
>>>       (deftemplate match-muscle-machine
>>>           (slot body-part)
>>>           (multislot station)       );;close
>>>
>>>       (asserrt (match-muscle-machine        (body-part arms-upperfront)     
>>>  
>>> (station
>>> N5 N8 N10 C1))      )
>>>
>>> I'm using this query
>>>
>>>       defquery search-relevant-machines "Get the relevant machines"
>>>       (declare (variables ?findx))
>>>        (match-muscle-machine        
>>>          (body-part ?findx)         (station ?station)) )   
>>>
>>> In java I'm using
>>>
>>>       QueryResult result =
>>>                    r.runQueryStar("search-relevant-machines", new
>>> ValueVector().add("arms-upperfront"));
>>>
>>>          if (result.next()) {       
>>>
>>>               System.out.println( "\n query run is successful \n  
>>> "  );
>>>
>>> It has no errors but the program doesn't get to "System.out.println 
>>> ( "\n
>>> query run is successful \n "  );"
>>>
>>> How can I use query result on facts with multislots?
>>>
>>>
>>> thanks
>>> rick
>>>
>>
>> -- 
>> View this message in context: http://www.nabble.com/Can-QueryResult- 
>> result-work-with-multislots-facts--tf3461027.html#a9657250
>> Sent from the Jess mailing list archive at Nabble.com.
>>
>> --------------------------------------------------------------------
>> To unsubscribe, send the words 'unsubscribe jess-users  
>> [EMAIL PROTECTED]'
>> in the BODY of a message to [EMAIL PROTECTED], NOT to the list
>> (use your own address!) List problems? Notify owner-jess- 
>> [EMAIL PROTECTED]
>> --------------------------------------------------------------------
> 
> ---------------------------------------------------------
> Ernest Friedman-Hill
> Advanced Software Research          Phone: (925) 294-2154
> Sandia National Labs                FAX:   (925) 294-2234
> PO Box 969, MS 9012                 [EMAIL PROTECTED]
> Livermore, CA 94550                 http://www.jessrules.com
> 
> --------------------------------------------------------------------
> To unsubscribe, send the words 'unsubscribe jess-users [EMAIL PROTECTED]'
> in the BODY of a message to [EMAIL PROTECTED], NOT to the list
> (use your own address!) List problems? Notify [EMAIL PROTECTED]
> --------------------------------------------------------------------
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Can-QueryResult-result-work-with-multislots-facts--tf3461027.html#a9661931
Sent from the Jess mailing list archive at Nabble.com.

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

Reply via email to