[ACT-R-users] Regarding getting the values of the slots of the goal buffer via RPC

Dan Bothell db30 at andrew.cmu.edu
Sun Oct 11 20:07:02 EDT 2020


On 10/11/20 12:23 PM, Arun Krishna wrote:
>
> Hi,
>
>
> Missed to mention "Subject" in the previous mail. Sending the same 
> again with "Subject"
>
> It would be great if I get some support regarding the RPC for reading 
> the slot values of the chunk in the goal buffer.
>
> I have a chunk in the goal buffer which has 3 slots and values defined 
> for each of the slots.
>
> Via command line I can read using (goal-focus) and I get the output
>
> *(goal-focus) NAVIGATION-BEGIN-0    NAVIGATIONSTART  "state-1"   
>  NAVIGATIONEND  "state-16"    NAVIGATIONCURRENT  "state-2"*
>
> There are 3 slots and values (state-1,state-16,state-2) for each of 
> the slots.
>
> I was trying to read these values via RPC in my java application
>
> Java code:
>
> static void getGoalFocus() { JSONArray jsonArray = new JSONArray(); 
> jsonArray.put("{\"method\":\"evaluate\","); 
> jsonArray.put("\"params\":"); 
> jsonArray.put("[\"goal-focus\",\"cmn\"],"); 
> jsonArray.put("\"id\":1}"); /print/(jsonArray.getString(0) + 
> jsonArray.getString(1) + jsonArray.getString(2) + 
> jsonArray.getString(3)); }
>
> But I get only the name of the chunk in the goal buffer as output 
> shown below
>
>
> *{"result": ["NAVIGATION-BEGIN-0"], "error": null, "id": 1}**
> **Result: NAVIGATION-BEGIN-0***
>
> I was trying to read the values of the slots of the goal buffer also 
> (state-1,state-16,state-2), not only the chunk name.
>
> I tried using the other command buffer-chunk ((buffer-chunk goal)) 
> also but still not getting the slot values in the goal buffer via RPC 
> (Getting full output via command line but not via RPC).
>
> Command line:
>
> 1 > (buffer-chunk goal)
> GOAL: NAVIGATION-BEGIN-0
> NAVIGATION-BEGIN-0
> NAVIGATIONSTART"state-1"
> NAVIGATIONEND"state-16"
> NAVIGATIONCURRENT"state-2"
>
> Java Code:
>
> *static void *getBufferChunk() { JSONArray jsonArray = *new *JSONArray(); jsonArray.put(*"{**\"**method**\"**:**\"**evaluate**\"**,"*); jsonArray.put(*"**\"**params**\"**:"*); jsonArray.put(*"[**\"**buffer-chunk**\"**,**\"**goal**\"**],"*); jsonArray.put(*"**\"**id**\"**:1}"*); /print/(jsonArray.getString(0) + jsonArray.getString(1) + 
> jsonArray.getString(2) + jsonArray.getString(3)); }
>
> Could you please let me know how to get the values of the slots of the 
> goal buffer via RPC?
>
>

Those are the correct return values from goal-focus and buffer-chunk 
(when it is given a buffer name).  Goal-focus returns the name of the 
chunk in the goal buffer, and buffer-chunk returns a list of the names 
of the chunks in the buffers specified.  The output to the command-trace 
with the buffer's chunk information is a side effect of calling those 
commands, and you will see that when you call it remotely as well.

If you want to know what slots a chunk has, then you would use the 
chunk-filled-slots-list command passing it the chunk's name, and it will 
return a list of the slots it has. If you want to know what the value of 
a slot in a chunk is then you need to use the chunk-slot-value command.  
It requires the name of the chunk and the name of a slot, and then 
returns the value in that slot of that chunk.

Hope that helps,

Dan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.srv.cs.cmu.edu/pipermail/act-r-users/attachments/20201011/45312e59/attachment.html>


More information about the ACT-R-users mailing list