From arunbkris at gmail.com Fri Sep 11 09:17:21 2020 From: arunbkris at gmail.com (Arun Krishna) Date: Fri, 11 Sep 2020 15:17:21 +0200 Subject: [ACT-R-users] Question regarding add-dm via RPC Message-ID: Hi, Good day. I am facing some issues for adding a new chunk via RPC for my ACT-R model. I recreated the same using the count model in ACT-R\tutorial\unit1 for problem description purposes. I am trying to create a new chunk to the count model. Through command it works (add-dm (test isa count-order first 1 second 2)) But when I use my java code (given below) *static void *addChunk() { JSONArray jsonArray = *new *JSONArray(); jsonArray.put(*"{**\"**method**\"**:**\"**evaluate**\"**,"*); jsonArray.put(*"**\"**params**\"**:"*); *//jsonArray.put("[\"add-dm\",\"count\",\"new\",\"isa\",\"count-order\",\"first\",\"5\",\"second\",\"6\"],"); *jsonArray.put(*"[**\"**define-chunks**\"**,**\"**count**\"**,**\"**new4* *\"**,**\"**isa**\"**,**\"**count-order**\"**,**\"**first**\"**,5,**\"* *second**\"**,6],"*); jsonArray.put(*"**\"**id**\"**:1}"*); *print*(jsonArray.getString(0) + jsonArray.getString(1) + jsonArray.getString(2) + jsonArray.getString(3)); } I am getting an error in command window (add-dm (test isa count-order first 1 second 2)) #|Warning: Invalid chunk definition: (TEST ISA COUNT-ORDER FIRST 1 SECOND 2) names a chunk which already exists. |# NIL 1 > I am able to use other commands successfully using my java code for example the goal-focus command as given below. *static void *setGoalFocus() { JSONArray jsonArray = *new *JSONArray(); jsonArray.put(*"{**\"**method**\"**:**\"**evaluate**\"**,"*); jsonArray.put(*"**\"**params**\"**:"*); jsonArray.put(*"[**\"**goal-focus**\"**,**\"**count**\"**,**\"**first-goal**\"**],"*); jsonArray.put(*"**\"**id**\"**:1}"*); *print*(jsonArray.getString(0) + jsonArray.getString(1) + jsonArray.getString(2) + jsonArray.getString(3)); } Could you please tell me what I am doing wrong in addChunk() function above? Thanks & Regards, Arun -------------- next part -------------- An HTML attachment was scrubbed... URL: From db30 at andrew.cmu.edu Fri Sep 11 14:07:18 2020 From: db30 at andrew.cmu.edu (db30 at andrew.cmu.edu) Date: Fri, 11 Sep 2020 14:07:18 -0400 Subject: [ACT-R-users] Question regarding add-dm via RPC In-Reply-To: References: Message-ID: --On Friday, September 11, 2020 9:17 AM -0400 Arun Krishna wrote: > > > Hi, > > Good day. > > I am facing some issues for adding a new chunk via RPC for my ACT-R model. > > I recreated the same using the count model in ACT-R\tutorial\unit1 for > problem description purposes. > > I am trying to create a new chunk to the count model. > > Through command it works (add-dm (test isa count-order first 1 second 2)) > > But when I use my java code (given below) > > static void addChunk() { > JSONArray jsonArray = new JSONArray(); > jsonArray.put("{\"method\":\"evaluate\","); > jsonArray.put("\"params\":"); > > //jsonArray.put("[\"add-dm\",\"count\",\"new\",\"isa\",\"count-order\",\"firs > t\",\"5\",\"second\",\"6\"],"); > > jsonArray.put("[\"define-chunks\",\"count\",\"new4\",\"isa\",\"count-order\", > \"first\",5,\"second\",6],"); > jsonArray.put("\"id\":1}"); > print(jsonArray.getString(0) > + jsonArray.getString(1) > + jsonArray.getString(2) > + jsonArray.getString(3)); > } > > I am getting an error in command window > > (add-dm (test isa count-order first 1 second 2)) > >#| Warning: Invalid chunk definition: (TEST ISA COUNT-ORDER FIRST 1 SECOND 2) >#| names a chunk which already exists. |# > > NIL > > 1 > > > I am able to use other commands successfully using my java code for example > the goal-focus command as given below. > static void setGoalFocus() { > JSONArray jsonArray = new JSONArray(); > jsonArray.put("{\"method\":\"evaluate\","); > jsonArray.put("\"params\":"); > jsonArray.put("[\"goal-focus\",\"count\",\"first-goal\"],"); > jsonArray.put("\"id\":1}"); > print(jsonArray.getString(0) > + jsonArray.getString(1) + jsonArray.getString(2) > + jsonArray.getString(3)); > } > > > Could you please tell me what I am doing wrong in addChunk() function above? > > Thanks & Regards, > > Arun The warning you show suggests you have called this twice: (add-dm (test isa count-order first 1 second 2)) and not an issue with the remote command that you've shown being sent since that warning is showing the contents of that chunk description and not the one that you are sending. As for the command you're sending, the description of a chunk for add-dm or define-chunks needs to be in a list. Thus, you'll need to wrap square brackets [...] around the components of the chunk description in the parameters that you send. I'm not a Java programmer, but I think that would look like this in your function: jsonArray.put("[\"define-chunks\",\"count\",[\"new4\",\"isa\",\"count-order\",\"first\",5,\"second\",6]],"); Hope that helps, Dan From arunbkris at gmail.com Mon Sep 14 02:16:48 2020 From: arunbkris at gmail.com (Arun Krishna) Date: Mon, 14 Sep 2020 08:16:48 +0200 Subject: [ACT-R-users] Question regarding add-dm via RPC In-Reply-To: References: Message-ID: Hi Dan, Thank you very much for the support. Now the command is working. Yes, there was a warning message mentioned below ? #|Warning: Invalid chunk definitions list provided to define-chunks (NEW4 ISA COUNT-ORDER FIRST 5 SECOND 6). Must be all lists or all names. |# And the root cause was the syntax of the RPC command which didn't have the square bracket. (The message I was getting " names a chunk which already exists." , was because of repeated tests). Now this command is successfully working with the changes in the command you suggested. Thanks & Regards, Arun On Fri, Sep 11, 2020 at 8:07 PM wrote: > > > --On Friday, September 11, 2020 9:17 AM -0400 Arun Krishna > wrote: > > > > > > > Hi, > > > > Good day. > > > > I am facing some issues for adding a new chunk via RPC for my ACT-R > model. > > > > I recreated the same using the count model in ACT-R\tutorial\unit1 for > > problem description purposes. > > > > I am trying to create a new chunk to the count model. > > > > Through command it works (add-dm (test isa count-order first 1 second 2)) > > > > But when I use my java code (given below) > > > > static void addChunk() { > > JSONArray jsonArray = new JSONArray(); > > jsonArray.put("{\"method\":\"evaluate\","); > > jsonArray.put("\"params\":"); > > > > > //jsonArray.put("[\"add-dm\",\"count\",\"new\",\"isa\",\"count-order\",\"firs > > t\",\"5\",\"second\",\"6\"],"); > > > > > jsonArray.put("[\"define-chunks\",\"count\",\"new4\",\"isa\",\"count-order\", > > \"first\",5,\"second\",6],"); > > jsonArray.put("\"id\":1}"); > > print(jsonArray.getString(0) > > + jsonArray.getString(1) > > + jsonArray.getString(2) > > + jsonArray.getString(3)); > > } > > > > I am getting an error in command window > > > > (add-dm (test isa count-order first 1 second 2)) > > > >#| Warning: Invalid chunk definition: (TEST ISA COUNT-ORDER FIRST 1 > SECOND 2) > >#| names a chunk which already exists. |# > > > > NIL > > > > 1 > > > > > I am able to use other commands successfully using my java code for > example > > the goal-focus command as given below. > > static void setGoalFocus() { > > JSONArray jsonArray = new JSONArray(); > > jsonArray.put("{\"method\":\"evaluate\","); > > jsonArray.put("\"params\":"); > > jsonArray.put("[\"goal-focus\",\"count\",\"first-goal\"],"); > > jsonArray.put("\"id\":1}"); > > print(jsonArray.getString(0) > > + jsonArray.getString(1) + jsonArray.getString(2) > > + jsonArray.getString(3)); > > } > > > > > > Could you please tell me what I am doing wrong in addChunk() function > above? > > > > Thanks & Regards, > > > > Arun > > > > > The warning you show suggests you have called this twice: > > (add-dm (test isa count-order first 1 second 2)) > > and not an issue with the remote command that you've shown > being sent since that warning is showing the contents of that > chunk description and not the one that you are sending. > > As for the command you're sending, the description of a > chunk for add-dm or define-chunks needs to be in a list. > Thus, you'll need to wrap square brackets [...] around the > components of the chunk description in the parameters that > you send. I'm not a Java programmer, but I think that > would look like this in your function: > > > > jsonArray.put("[\"define-chunks\",\"count\",[\"new4\",\"isa\",\"count-order\",\"first\",5,\"second\",6]],"); > > Hope that helps, > Dan > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: