RavenclawDev: returning frame from a back end

Svetlana Stenchikova svetastenchikova at gmail.com
Thu Oct 12 00:23:47 EDT 2006


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> 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/20061012/fa3d30cb/attachment.html


More information about the Ravenclaw-developers mailing list