[ACT-R-users] Regarding getting the values of the slots of the goal buffer via RPC
Arun Krishna
arunbkris at gmail.com
Mon Oct 12 10:26:46 EDT 2020
Hi Dan,
Thank you for the reply.
In my case chunk-slot-value returns the slot value defined by add-dm command
for example I have an add-dm with
(navigation-begin ISA navigation navigationStart "state-1" navigationEnd
"state-16" navigationCurrent "state-1")
So
? (chunk-slot-value navigation-begin navigationCurrent)
"state-1"
?
I always get "state-1".
But the goal buffer has a different content in the same time which is given
below
[image: image.png]
I was trying to retrieve the value of NAVIGATIONCURRENT slot from the goal
buffer which is "state-2" .
(Which is the result of a production while running the model)
Could you please tell me how to achieve this using RPC?
Thanks & Regards,
Arun
On Mon, Oct 12, 2020 at 2:07 AM Dan Bothell <db30 at andrew.cmu.edu> wrote:
>
> 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/20201012/5f600621/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 67264 bytes
Desc: not available
URL: <http://mailman.srv.cs.cmu.edu/pipermail/act-r-users/attachments/20201012/5f600621/attachment.png>
More information about the ACT-R-users
mailing list