[Attempto] Can't unparse expressions (from DRSXML) using atom_to_term/3, Single quotes lost

Joshua TAYLOR tayloj at cs.rpi.edu
Tue Jun 2 16:56:54 CEST 2009


Hello,

I'm having a bit of trouble unparsing expressions using
atom_to_term/3.  It seems that single quotes that are present in
Prolog output are lost in DRSXML output. For instance:

=== DRS output

CL-USER 28 > (invoke-ape-webservice :text "\"a)b\" is good." :solo "drs")
"drs([A, B], [property(A, good, pos)-1/5, predicate(B, be,
string('a)b'), A)-1/4])"

?- atom_to_term("string('a)b')",X,Y).
X = string('a)b'),
Y = [].

=== DRSXML output

<DRS domain=\"A B\">
  <property ref=\"A\" adj=\"good\" degree=\"pos\" sentid=\"1\" tokid=\"5\"/>
  <predicate ref=\"B\" verb=\"be\" subj=\"string(a)b)\"
      obj=\"A\" sentid=\"1\" tokid=\"4\"/>
</DRS>"

?- atom_to_term("string(a)b)",X,Y).
ERROR: Syntax error: Operator expected
ERROR: string(a)
ERROR: ** here **
ERROR: b) .

Now, I couldn't find anything that explicitly affirmed that the DRSXML
attribute values would be string representations of Prolog atoms, but
the representations seemed close enough that it was probably the case.
 If string contents aren't quoted, the expressions can easily become
ambiguous.  E.g., (a contrived example):

CL-USER 33 > (invoke-ape-webservice :text "John dictates \"Every )
must be preceded by a (.\"." :solo "drsxml")
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>

<DRS domain=\"A\">
  <predicate
      ref=\"A\"
      verb=\"dictate\"
      subj=\"named(John)\"
      obj=\"string(Every ) must be preceded by a (.)\"
      sentid=\"1\"
      tokid=\"2\"/>
</DRS>"

Regards,
Joshua


More information about the attempto mailing list