<% response.setContentType( "text/xml" ); %> <%@ taglib uri="/WEB-INF/tlds/omcore-taglib.tld" prefix="omcore" %> <%@ taglib uri="/WEB-INF/tlds/util-taglib.tld" prefix="util" %> OpenMath Integration Service <%@page import="java.io.*,antlr.*,nl.tue.win.riaca.openmath.lang.*,nl.tue.win.riaca.openmath.io.*,localhost.*,at.ac.uni_linz.risc.openmath.expressions.parser.*"%> <%@page session="true" %> <% // Get access to service properties IntegratorService service = new IntegratorServiceLocator(); // Get port type Integrator port = service.getSymbolicIntegrator(); boolean firstTime = false; String fData = request.getParameter("fData"); if (fData == null) { firstTime = true; fData = "1+3*4*x"; } %>

Enter a simple arithmetical or polynomial expression in variable x and then press the integrate button.

Expression:

<% // Determine if this is the first time the JSP is run if (firstTime || (fData == null) || (fData.equals("")) ) ; //do nothing else{ // Get decoding StringBuffer tBuffer = new StringBuffer(); String ret = null; // clean input string char tCh; for (int i = 0; i < fData.length(); i++) { tCh = fData.charAt(i); if ( (tCh != '\n') | (tCh != '\t') | (tCh != '\r') ) tBuffer.append(tCh); } if ( !( (tBuffer.toString()).endsWith( ";" ) ) ) tBuffer.append( ";" ); UnivExprLexer tLexer = new UnivExprLexer ( new DataInputStream( new StringBufferInputStream( tBuffer.toString( ) ) ) ); UnivExprParser tParser = new UnivExprParser( tLexer ); tParser.expr(); CommonAST tAST = (CommonAST) tParser.getAST(); UnivExprTreeWalker walker = new UnivExprTreeWalker(); String tObj = walker.expr(tAST); OMXMLReader tReader = new OMXMLReader( tObj ); OMObject tObject = tReader.readObject(); StringWriter tWriter = new StringWriter( ); OMXMLWriter tXMLWriter = new OMXMLWriter( tWriter ); tXMLWriter.writeObject( tObject ); tXMLWriter.flush(); String indentObj = tWriter.toString(); OMObject tAppl = (OMObject) tObject; ret = port.IndefInt(tAppl); System.out.println("ret is " + ret); if (ret.equals(null)){ ret.concat("[NOTE: Result was null. Please verify that the service was deployed using the UtilityServicesSetup command.]"); System.out.println("ret was NULL, set to" + ret);} %>

OpenMath for the integral of <%=fData%>: Integration of your input:

<%}%>