Skip to content

Commit

Permalink
Changes to put kb, language, port and other common parameters in Prel…
Browse files Browse the repository at this point in the history
…ude.jsp
  • Loading branch information
apease committed Mar 15, 2011
1 parent 068ec07 commit e457e8b
Show file tree
Hide file tree
Showing 25 changed files with 207 additions and 606 deletions.
5 changes: 2 additions & 3 deletions web/jsp/AddConstituent.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ code. Please cite the following article in any publication with references:
Pease, A., (2003). The Sigma Ontology Development Environment,
in Working Notes of the IJCAI-2003 Workshop on Ontology and Distributed Systems,
August 9, Acapulco, Mexico.
August 9, Acapulco, Mexico. See also http://sigmakee.sourceforge.net
*/
// KBmanager mgr = KBmanager.getMgr();
Expand All @@ -24,7 +24,6 @@ August 9, Acapulco, Mexico.
File kbDirFile = new File(kbDir);
System.out.println("INFO in AddConstituent.jsp: KB dir: " + kbDir);
MultipartParser mpp = null;
String kbName = "";
int postSize = Integer.MAX_VALUE;
Part requestPart = null;
String fileName = "";
Expand Down Expand Up @@ -113,7 +112,7 @@ August 9, Acapulco, Mexico.
else {
if (mgr.getKB(kbName) == null)
mgr.addKB(kbName);
KB kb = mgr.getKB(kbName);
kb = mgr.getKB(kbName);
// Remove the constituent, if it is already present.
for (ListIterator lit = kb.constituents.listIterator(); lit.hasNext();) {
String constituent = (String) lit.next();
Expand Down
3 changes: 0 additions & 3 deletions web/jsp/AllPictures.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@ August 9, Acapulco, Mexico. See also http://sigmakee.sourceforge.net
<%
String kbName = "";
StringBuffer show = new StringBuffer();
KB kb = null;
String language = HTMLformatter.language;
language = HTMLformatter.processLanguage(language,kb);
term = request.getParameter("term");
kbName = request.getParameter("kb");
if (Formula.isNonEmptyString(kbName)) {
Expand Down
32 changes: 9 additions & 23 deletions web/jsp/AskTell.jsp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<%@include file="Prelude.jsp" %>

<%
/** This code is copyright Articulate Software (c) 2003. Some portions
/** This code is copyright Articulate Software (c) 2003-2011. Some portions
copyright Teknowledge (c) 2003 and reused under the terms of the GNU license.
This software is released under the GNU Public License <http://www.gnu.org/copyleft/gpl.html>.
Users of this code also consent, by use of this code, to credit Articulate Software
Expand All @@ -11,12 +11,9 @@ code. Please cite the following article in any publication with references:
Pease, A., (2003). The Sigma Ontology Development Environment,
in Working Notes of the IJCAI-2003 Workshop on Ontology and Distributed Systems,
August 9, Acapulco, Mexico. See also sigmakee.sourceforge.net
August 9, Acapulco, Mexico. See also http://sigmakee.sourceforge.net
*/
String hostname = KBmanager.getMgr().getPref("hostname");
if (hostname == null)
hostname = "localhost";
String systemsDir = KBmanager.getMgr().getPref("systemsDir");
//----Check if SystemOnTPTP exists in a local copy of TPTPWorld
Expand Down Expand Up @@ -83,23 +80,15 @@ August 9, Acapulco, Mexico. See also sigmakee.sourceforge.net
}
//]]></script>


</HEAD>
<%
System.out.println("INFO in AskTell.jsp");
StringBuffer status = new StringBuffer();
ArrayList processedStmts = null;
String kbName = request.getParameter("kb");
KB kb = KBmanager.getMgr().getKB(kbName);
String language = request.getParameter("lang");
language = HTMLformatter.processLanguage(language,kb);
String req = request.getParameter("request");
String stmt = request.getParameter("stmt");
String chosenEngine = request.getParameter("inferenceEngine");
//unused: String href = "Browse.jsp?kb=" + kbName + "&lang=" + language + "&term=";
boolean syntaxError = false;
boolean english = false;
String englishStatement = null;
Expand Down Expand Up @@ -211,46 +200,43 @@ August 9, Acapulco, Mexico. See also sigmakee.sourceforge.net
if (req.equalsIgnoreCase("tell")) {
Formula statement = new Formula();
statement.theFormula = stmt;
String port = KBmanager.getMgr().getPref("port");
if ((port == null) || port.equals(""))
port = "8080";
String kbHref = "http://" + hostname + ":" + port + "/sigma/Browse.jsp?kb=" + kbName;
status.append(kb.tell(stmt) + "<P>\n" + statement.htmlFormat(kbHref));
}
if (req.equalsIgnoreCase("ask") && chosenEngine.equals("Vampire")) {
if (stmt.indexOf('@') != -1)
throw(new IOException("Row variables not allowed in query: " + stmt));
resultVampire = kb.ask( stmt, timeout, maxAnswers );
resultVampire = kb.ask(stmt,timeout,maxAnswers);
}
if (req.equalsIgnoreCase("ask") && chosenEngine.equals("STP")) {
if (stmt.indexOf('@') != -1)
throw(new IOException("Row variables not allowed in query: " + stmt));
resultSTP = kb.askSTP( stmt, timeout, maxAnswers );
resultSTP = kb.askSTP(stmt,timeout,maxAnswers);
}
if (req.equalsIgnoreCase("ask") && chosenEngine.equals("STP2")) {
if (stmt.indexOf('@') != -1)
throw(new IOException("Row variables not allowed in query: " + stmt));
resultSTP2 = kb.askSTP2( stmt, timeout, maxAnswers );
resultSTP2 = kb.askSTP2(stmt,timeout,maxAnswers);
}
if (req.equalsIgnoreCase("ask") && chosenEngine.equals("SInE")) {
if (stmt.indexOf('@') != -1)
throw(new IOException("Row variables not allowed in query: " + stmt));
resultSInE = kb.askSInE( stmt, timeout, maxAnswers );
resultSInE = kb.askSInE(stmt,timeout,maxAnswers);
}
if (req.equalsIgnoreCase("ask") && chosenEngine.equals("LeoSine")) {
if (stmt.indexOf('@') != -1)
throw(new IOException("Row variables not allowed in query: " + stmt));
resultLeo = kb.askLEO( stmt, timeout, maxAnswers, "LeoSine" );
resultLeo = kb.askLEO(stmt,timeout,maxAnswers,"LeoSine");
}
if (req.equalsIgnoreCase("ask") && chosenEngine.equals("LeoLocal")) {
if (stmt.indexOf('@') != -1)
throw(new IOException("Row variables not allowed in query: " + stmt));
resultLeo = kb.askLEO( stmt, timeout, maxAnswers, "LeoLocal" );
resultLeo = kb.askLEO(stmt,timeout,maxAnswers,"LeoLocal");
}
if (req.equalsIgnoreCase("ask") && chosenEngine.equals("LeoGlobal")) {
if (stmt.indexOf('@') != -1)
throw(new IOException("Row variables not allowed in query: " + stmt));
resultLeo = kb.askLEO( stmt, timeout, maxAnswers, "LeoGlobal" );
resultLeo = kb.askLEO(stmt,timeout,maxAnswers,"LeoGlobal");
}
if (req.equalsIgnoreCase("ask") && chosenEngine.equals("SoTPTP")) {
if (stmt.indexOf('@') != -1)
Expand Down
10 changes: 5 additions & 5 deletions web/jsp/Browse.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,23 @@ August 9, Acapulco, Mexico. See also http://sigmakee.sourceforge.net
* kb = <name> - the name of the knowledge base
* lang = <lang> - the name of the language used to display axiom paraphrases
* */
String term = request.getParameter("term");
if (!Formula.isNonEmptyString(term))
term = "";
if (flang.equals("OWL")) {
response.sendRedirect("http://" + hostname + ":" + port + "/sigma/OWL.jsp?" +
"kb=" + kbName + "&term=" + term);
return;
}
%>
<html>
<head><title>Knowledge base Browser - <%=term%></title></head>
<body bgcolor="#FFFFFF">

<%
String parentPage = "Browse.jsp";
String simple = "no";
String kbName = "";
String language = "";
StringBuffer show = null;
KB kb = null;
%>

<%@ include file="BrowseBody.jsp"%>
Expand Down
64 changes: 23 additions & 41 deletions web/jsp/BrowseBody.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,12 @@ Pease, A., (2003). The Sigma Ontology Development Environment,
in Working Notes of the IJCAI-2003 Workshop on Ontology and Distributed Systems,
August 9, Acapulco, Mexico. See also http://sigmakee.sourceforge.net
*/
show = new StringBuffer(); // Variable to contain the HTML page generated.
kbName = null; // Name of the knowledge base
kb = null; // The knowledge base object.
String formattedFormula = null;
term = request.getParameter("term");
kbName = request.getParameter("kb");
if (kbName != null && StringUtil.isNonEmptyString(kbName)) {
kb = KBmanager.getMgr().getKB(kbName);
if (kb != null)
TaxoModel.kbName = kbName;
}
else
response.sendRedirect("login.html");
language = request.getParameter("lang");
language = HTMLformatter.processLanguage(language,kb);
Map theMap = null; // Map of natural language format strings.
String hostname = KBmanager.getMgr().getPref("hostname");
if (hostname == null)
hostname = "localhost";
String port = KBmanager.getMgr().getPref("port");
if (port == null)
port = "8080";
HTMLformatter.kbHref = "http://" + hostname + ":" + port + "/sigma/" + parentPage + "?lang=" + language + "&kb=" + kbName;
HTMLformatter.kbHref = "http://" + hostname + ":" + port + "/sigma/" + parentPage + "?lang=" + language + "&flang=" + flang + "&kb=" + kbName;
if (kb != null && StringUtil.emptyString(term)) // Show statistics only when no term is specified.
show.append(HTMLformatter.showStatistics(kb));
Expand Down Expand Up @@ -78,15 +57,13 @@ August 9, Acapulco, Mexico. See also http://sigmakee.sourceforge.net
if (tfm != null)
tfmValue = (String) tfm.get(term);
if (tfmValue != null) {
if (isArabic) {
tfmValue = "<span dir=\"rtl\">" + tfmValue + "</span>";
}
if (isArabic)
tfmValue = "<span dir=\"rtl\">" + tfmValue + "</span>";
show.append("(" + tfmValue + ")");
}
else {
else
System.out.println("INFO in BrowseBody.jsp: No term format map entry for \"" +
term + "\" in language " + language);
}
term + "\" in language " + language);
show.append(HTMLformatter.showPictures(kb,term));
show.append("</td>");
//WordNet.initOnce();
Expand All @@ -97,9 +74,8 @@ August 9, Acapulco, Mexico. See also http://sigmakee.sourceforge.net
show.append(WordNetUtilities.formatWords(tm,kbName));
show.append("</small></td>");
}
else {
System.out.println("INFO in BrowseBody.jsp: No synsets for term " + term);
}
else
System.out.println("INFO in BrowseBody.jsp: No synsets for term " + term);
show.append("</tr></table>\n");
}
show.append ("</b></font></td></tr></table>\n");
Expand All @@ -109,40 +85,46 @@ August 9, Acapulco, Mexico. See also http://sigmakee.sourceforge.net
KBmanager.getMgr().getPref("userRole").equalsIgnoreCase("administrator")) {
limit = Integer.decode(KBmanager.getMgr().getPref("adminBrowserLimit")).intValue();
}
// show.append(HTMLformatter.showFormulasLimit(kb,term,0,limit));
for (int arg = 1; arg < 6; arg++) {
String argHeader = ("appearance as argument number " + arg);
show.append(HTMLformatter.browserSectionFormatLimit(term, argHeader, kb, language,0,limit,arg,"arg"));
show.append(HTMLformatter.browserSectionFormatLimit(term, argHeader, kb, language,flang,0,limit,arg,"arg"));
}
//forms = kb.ask("ant",0,term);
show.append(HTMLformatter.browserSectionFormatLimit(term, "antecedent", kb, language,0,limit,0,"ant"));
show.append(HTMLformatter.browserSectionFormatLimit(term, "antecedent", kb, language,flang,0,limit,0,"ant"));
//forms = kb.ask("cons",0,term);
show.append(HTMLformatter.browserSectionFormatLimit(term, "consequent", kb, language,0,limit,0,"cons"));
show.append(HTMLformatter.browserSectionFormatLimit(term, "consequent", kb, language,flang,0,limit,0,"cons"));
//forms = kb.ask("stmt",0,term);
show.append(HTMLformatter.browserSectionFormatLimit(term, "statement", kb, language,0,limit,0,"stmt"));
show.append(HTMLformatter.browserSectionFormatLimit(term, "statement", kb, language,flang,0,limit,0,"stmt"));
//forms = kb.ask("arg",0,term);
show.append(HTMLformatter.browserSectionFormatLimit(term, "appearance as argument number 0", kb, language,0,limit,0,"arg"));
show.append(HTMLformatter.browserSectionFormatLimit(term, "appearance as argument number 0", kb, language,flang,0,limit,0,"arg"));
show.append("<p><table align=\"left\" width=\"50%\"><tr><td bgcolor=\"#A8BACF\">" +
"<img src=\"pixmaps/1pixel.gif\" width=\"1\" height=\"1\" border=\"0\"></td></tr>" +
"</table><br>\n");
if (!parentPage.equals("TreeView.jsp"))
show.append("\n<small><a href=\"http://" + hostname + ":" + port + "/sigma/TreeView.jsp" +
"?lang=" + language + "&kb=" + kbName +
"?lang=" + language + "&flang=" + flang + "&kb=" + kbName +
"&term=" + term + "\">Show full definition with tree view</a></small><br>\n");
show.append("\n<small><a href=\"http://" + hostname + ":" + port + "/sigma/SimpleBrowse.jsp" +
"?lang=" + language + "&kb=" + kbName + "&simple=yes" +
"?lang=" + language + "&flang=" + flang + "&kb=" + kbName + "&simple=yes" +
"&term=" + term + "\">Show simplified definition (without tree view)</a></small><br>\n");
show.append("\n<small><a href=\"http://" + hostname + ":" + port + "/sigma/TreeView.jsp" +
"?lang=" + language + "&kb=" + kbName + "&simple=yes" +
"?lang=" + language + "&flang=" + flang + "&kb=" + kbName + "&simple=yes" +
"&term=" + term + "\">Show simplified definition (with tree view)</a></small><p>\n");
/** if (flang.equals("SUO-KIF"))
show.append("\n<small><a href=\"http://" + hostname + ":" + port + "/sigma/Browse.jsp?" +
"kb=" + kbName + "&term=" + term + "&flang=TPTP" + "&lang=" + language + "\">Show TPTP translation</small><p>\n");
if (flang.equals("TPTP"))
show.append("\n<small><a href=\"http://" + hostname + ":" + port + "/sigma/Browse.jsp?" +
"kb=" + kbName + "&term=" + term + "&flang=SUO-KIF" + "&lang=" + language + "\">Show SUO-KIF original</small><p>\n");
show.append("\n<small><a href=\"http://" + hostname + ":" + port + "/sigma/OWL.jsp?" +
"kb=" + kbName + "&term=" + term + "\">Show OWL translation</small><p>\n");
*/
}
%>
27 changes: 3 additions & 24 deletions web/jsp/BrowseExtra.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ August 9, Acapulco, Mexico. See also http://sigmakee.sourceforge.net
*/
StringBuffer show = new StringBuffer(); // Variable to contain the HTML page generated.
String kbName = null; // Name of the knowledge base
KB kb = null; // The knowledge base object.
String formattedFormula = null;
String formattedFormula = null;
int start = 0;
String startString = request.getParameter("start");
if (Formula.isNonEmptyString(startString))
Expand All @@ -36,28 +34,9 @@ August 9, Acapulco, Mexico. See also http://sigmakee.sourceforge.net
arg = Integer.decode(argString).intValue();
String type = request.getParameter("type");
String term = request.getParameter("term");
String language = request.getParameter("lang");
if (!Formula.isNonEmptyString(language))
language = HTMLformatter.language;
else
HTMLformatter.language = language;
kbName = request.getParameter("kb");
if (Formula.isNonEmptyString(kbName)) {
kb = KBmanager.getMgr().getKB(kbName);
if (kb != null)
TaxoModel.kbName = kbName;
}
if (kb == null)
response.sendRedirect("login.html");
Map theMap = null; // Map of natural language format strings.
String hostname = KBmanager.getMgr().getPref("hostname");
if (hostname == null)
hostname = "localhost";
String port = KBmanager.getMgr().getPref("port");
if (port == null)
port = "8080";
HTMLformatter.kbHref = "http://" + hostname + ":" + port + "/sigma/Browse.jsp" + "?lang=" + language + "&kb=" + kbName;
HTMLformatter.kbHref = "http://" + hostname + ":" + port + "/sigma/Browse.jsp" + "?lang=" + language + "?flang=" + flang + "&kb=" + kbName;
if (kb != null && (term == null || term.equals(""))) // Show statistics only when no term is specified.
show.append(HTMLformatter.showStatistics(kb));
Expand Down Expand Up @@ -99,7 +78,7 @@ August 9, Acapulco, Mexico. See also http://sigmakee.sourceforge.net
KBmanager.getMgr().getPref("userRole").equalsIgnoreCase("administrator")) {
limit = 200;
}
show.append(HTMLformatter.browserSectionFormatLimit(term,"", kb, language,start,limit,arg,type));
show.append(HTMLformatter.browserSectionFormatLimit(term,"", kb, language,flang,start,limit,arg,type));
}
%>
<%=show.toString() %><BR>
Expand Down
8 changes: 7 additions & 1 deletion web/jsp/BrowseHeader.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ August 9, Acapulco, Mexico. See also http://sigmakee.sourceforge.net
<% if (kb != null) { %>
<b>Language:&nbsp;</b><%= HTMLformatter.createMenu("lang",language,kb.availableLanguages()) %>
<% } %>
<P><b>Formal Language:&nbsp;</b><%= HTMLformatter.createMenu("flang",flang,HTMLformatter.availableFormalLanguages) %>
</td>
</tr>
</table>
Expand All @@ -65,16 +66,21 @@ August 9, Acapulco, Mexico. See also http://sigmakee.sourceforge.net
<td align="left" valign="top">
<input type="submit" value="Show">
</td>
<input type="hidden" name="simple" value=<%=simple%>><br>
<br>
</tr>
<tr>
<td><img src="pixmaps/1pixel.gif" height="3"></td>
</tr>
</form>

<!-- show WordNet search input -->
<form method="GET" action="WordNet.jsp">
<tr>
<td align="right"><b>English Word:&nbsp;</b></td>
<input type="hidden" name="simple" value=<%=simple%>>
<input type="hidden" name="kb" value=<%=kbName%>>
<input type="hidden" name="lang" value=<%=language%>>
<input type="hidden" name="flang" value=<%=flang%>>
<td align="left" valign="top">
<input type="text" size="27" name="word">
<img src="pixmaps/1pixel.gif" width="3"></td>
Expand Down
Loading

0 comments on commit e457e8b

Please sign in to comment.