RavenclawDev: returning frame from a back end; with lists
Dan Bohus
dbohus at cs.cmu.edu
Fri Oct 13 07:19:06 EDT 2006
Hi Svetlana,
Hmm, sorry, I'm a bit confused by the beginning of it...
String str = "{\nerror false\n}";
/ "{\n" +
"error false\n" +
Does that compile in java? Or is that just a mistype in the email. O/w I
can't see anything with the naked eye, but you might try setting a
breakpoint right on the line in FrameConcept.cpp where RavenClaw crashes
and see what the problem is... Sorry I can't be more helpful, I hope
you'll sort it out... We should have had this "string frame" format
documented somewhere really well...
-Dan
________________________________
From: Svetlana Stenchikova [mailto:svetastenchikova at gmail.com]
Sent: Friday, October 13, 2006 12:14 AM
To: Dan Bohus
Cc: ravenclaw-developers at cs.cmu.edu
Subject: Re: RavenclawDev: returning frame from a back end; with lists
Hi,
I am now trying to hard-code a string to return, just for a test:
String str = "{\nerror false\n}";
/ "{\n" +
"error false\n" +
"results :1\n" +
"{\n" +
"{\n" +
"date_time {\n" +
"time {\n" +
" start_time 1700\n" +
" end_time 1800\n" +
"}\n" +
"date {\n" +
" valid_date true\n" +
" year 2006\n" +
" month 10\n" +
" day 11\n" +
" weekday 3\n" +
"}\n" +
"}\n" +
"}\n" +
"}\n" +
"}";
GFrame newframe = new Clause("");
newframe.setProperty(":outframe", str);
and getting exception in FrameConcept.cpp on line 288
Can anyone see a problem with this hard-coded string?
thanks,
Svetlana
On 10/12/06, Svetlana Stenchikova <svetastenchikova at gmail.com> wrote:
OK, it worked after several replacements were done to the string:
GFrame eventAdded = new Clause("");
String strRes = tempFrame.toString();
String newstr1 = strRes.replaceAll("\\{c", "{\n");
String newstr2 = newstr1.replaceAll("\\\"", "");
String newstr = newstr2.replaceAll("\\}", "\n}");
eventAdded.setProperty(":outframe", newstr);
thanks,
Svetlana
On 10/11/06, Dan Bohus < dbohus at cs.cmu.edu <mailto:dbohus at cs.cmu.edu> >
wrote:
Hi Svetlana,
Yes, you should indeed return a GFrame from the java backend server.
This GFrame should contain one string element, called :outframe which
contains the string representation you had below of the desired
structure (e.g. like for instance the RoomLine perl returns it). If you
look into the BackendServer for RoomLine, essentially what that does is
take that string representation and put it in an outframe string slot in
a galaxy return frame.
Hope this helps, but let me know if it doesn't
Dan
________________________________
From: Svetlana Stenchikova [mailto:svetastenchikova at gmail.com]
Sent: Wednesday, October 11, 2006 3:32 PM
To: Dan Bohus
Cc: ravenclaw-developers at cs.cmu.edu
Subject: Re: RavenclawDev: returning frame from a back end
Do you think it is possible to return a structure from a java back-end
in a format expected by RavenClaw?
If so, could you please recomment how, and if not, could someone point
to the place in RavenClaw that I could modify to work around this issue?
I am sorry to bother you with this question, but we have a demo coming
up and listing the events is one of the essential functionality that we
wanted to show.
Thank you all for your help!
Svetlana
On 10/10/06, Svetlana Stenchikova <svetastenchikova at gmail.com> wrote:
Thanks Dan,
this generally makes sense, but I am not sure how to do this in the java
server.
The operation function in the java galaxy service returns a GFrame.
I can set properties of this frame in any way, but I must return a
GFrame, I think. I tried declaring an operation that returns String and
it causes runtime exception:
java.lang.ClassCastException: java.lang.String
This is how a RoomLine return from a perl back end looks like:
{
suggested_refine none
error false
results :1
{
{
date_time {
time {
start_time 1700
end_time 1800
}
date {
valid_date true
year 2006
month 10
day 11
weekday 3
}
}
room_size 30
room_projector true
room_whiteboard true
room_computer true
room_network true
room_location Wean Hall
room_size_spec large
room_number 4625
}
}
}
And here is how my java back end frame looks like:
Server environment sending frame:
{c java_be.add_event
error "false"
:hub_opaque_data {c admin_info
:reply_requested 1
:session_id "Default"
:tidx 70
:scriptless 1
:timestamp [array: type GAL_FLOAT_64, 1 elements]
:provider_id "[8]"
:invoked_stype "java_be" } }
Please make a suggestion on how to return a string from a java server.
thank you,
Svetlana
On 10/10/06, Dan Bohus <dbohus at cs.cmu.edu > wrote:
Hi Svetlana,
I think this is the same problem with "Ravenclaw frames" and "galaxy
frames" but on the output side. Basically what you're doing in the code
below is constructing a galaxy frame. Instead ravenclaw expects a single
string in that galaxy frame which contains the information in a single
string in the "string Ravenclaw frame" format...
If this message is too cryptic, let me know and I can send you more
details,
Dan
________________________________
From: ravenclaw-developers-bounces at LOGANBERRY.srv.cs.cmu.edu
[mailto:ravenclaw-developers-bounces at LOGANBERRY.srv.cs.cmu.edu] On
Behalf Of Svetlana Stenchikova
Sent: Tuesday, October 10, 2006 5:41 PM
To: ravenclaw-developers at cs.cmu.edu
Subject: RavenclawDev: returning frame from a back end
Hi,
How should a back-end function of a ravenclaw dialog manager format a
frame?
For example, I am expecting to get a "error" parameter from:
CALL("java_be.add_event <event_add error>backend_error")
backend_error is declared as:
BOOL_SYSTEM_CONCEPT(backend_error)
In the java back-end:
public GFrame serverOpAddEvent(GFrame f) {
...
GFrame eventAdded = new Clause("event_add");
eventAdded.setProperty("error", "false");
return eventAdded;
}
But the backend_error in DM does not get initialized.
Is there a particular way that the return GFrame from the backend server
has to be generated?
Thank you,
Svetlana
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.srv.cs.cmu.edu/pipermail/ravenclaw-developers/attachments/20061013/4e0a40da/attachment-0001.html
More information about the Ravenclaw-developers
mailing list