From: John De O. <jo...@cy...> - 2008-07-11 16:50:46
|
America, Here's what Brad Bouldin found that we have in the web services code, along with an example. He says he just tested it to make sure it works. You'll notice a call to... assertWithTranscriptAndBookkeeping I didn't see that method in the API docs, but here it is and it works. - John D. http://65.99.218242:8080/RESTfulCyc/Assert.jsp<http://65.99.218.242:8080/RESTfulCyc/Assert.jsp> Enter: (#$implies (#$isa ?OBJ #$Poodle) (#$isa ?OBJ #$Dog)) #$BaseKB Result: <cyclify><success></success></cyclify> Here is the source code: protected void doPost(final HttpServletRequest request, final HttpServletResponse response) throws ServletException, IOException { System.out.println("POST STARTED"); final Writer w = response.getWriter(); final String assertStatement = request.getParameter("assert"); final String microtheory = request.getParameter("microtheory"); if (assertStatement == null) { return; } else if (assertStatement.equals("")) { return; } if (microtheory == null) { return; } else if (microtheory.equals("")) { return; } final String requestor = request.getRemoteAddr(); System.out.println("requestor:" + requestor); w.write("<cyclify>"); try { CycAccess cyc = null; cyc = CycRESTServlet.getCyc(); final CycFort mt = cyc.getConstantByName(microtheory); if (mt == null) { throw new IllegalStateException("Microtheory was not found:" + microtheory); } cyc.assertWithTranscriptAndBookkeeping(assertStatement, mt); final String result = "Success"; if (result == null) { w.write("<error>nothing found</error>"); } else { w.write("<success>"); w.write("</success>"); } } catch (final Exception e) { this.writeException(e, assertStatement + "/" + microtheory, "Assert", w); } w.write("</cyclify>"); } On Thu, Jul 10, 2008 at 4:39 PM, America Holloway <aho...@ic...> wrote: > Hi, > How can I use the Java API to add a rule containing variables to a > microtheory. There are many methods for asserting a GAF but I can't find a > method for adding a rule. Any help would be greatly appreciated. > Thanks, > America. > > ------------------------------------------------------------------------- > Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW! > Studies have shown that voting for your favorite open source project, > along with a healthy diet, reduces your potential for chronic lameness > and boredom. Vote Now at http://www.sourceforge.net/community/cca08 > _______________________________________________ > OpenCyc-devel mailing list > Ope...@li... > https://lists.sourceforge.net/lists/listinfo/opencyc-devel > > -- Website: http://www.actionitem.com Twitter: http://twitter.com/johndeo LinkedIn: http://www.linkedin.com/in/johndeo Twine: http://www.twine.com/user/johndeo |