-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathDiag.jsp
118 lines (98 loc) · 4.89 KB
/
Diag.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<%@ include file="Prelude.jsp" %>
<html>
<head>
<title> Knowledge base Diagnostics</title>
</head>
<body bgcolor="#FFFFFF">
<%
/** This code is copyright Teknowledge (c) 2003, Articulate Software (c) 2003-2017, 2020-
Infosys (c) 2017-2020.
This software is released under the GNU Public License
<http://www.gnu.org/copyleft/gpl.html>.
Please cite the following article in any publication with references:
Pease A., and Benzmüller C. (2013). Sigma: An Integrated Development Environment
for Logical Theories. AI Communications 26, pp79-97. See also
http://github.com/ontologyportal
*/
if (!role.equals("admin") && !role.equals("user")) {
response.sendRedirect("KBs.jsp");
return;
}
System.out.println("INFO in Diag.jsp: Running diagnostics");
long t0 = System.currentTimeMillis();
String kbHref = null;
String formattedFormula = null;
Map theMap = null;
kbHref = HTMLformatter.createHrefStart() + "/sigma/Browse.jsp?lang=" + language + "&kb=" + kbName + "&flang=" + flang;
%>
<form action="Diag.jsp">
<%
String pageName = "Diag";
String pageString = "Knowledge Base Diagnostics";
%>
<%@include file="CommonHeader.jsp" %>
</form>
<a href="WNDiag.jsp?kb=<%=kbName%>">Run WordNet diagnostics</a><p>
<%
// Terms without parents
ArrayList<String> termsWithoutParent = Diagnostics.termsNotBelowEntity(kb);
out.println(HTMLformatter.htmlDivider("Error: Terms without a root at Entity"));
out.println(HTMLformatter.termList(termsWithoutParent,kbHref));
// Children of disjoint parents
ArrayList<String> disjoint = Diagnostics.childrenOfDisjointParents(kb);
out.println("<br>" + HTMLformatter.htmlDivider("Error: Terms with disjoint parents"));
out.println(HTMLformatter.termList(disjoint,kbHref));
out.println("<br>" + HTMLformatter.htmlDivider("Error: Formulae with type conflicts"));
KButilities.clearErrors();
kb.kbCache.errors.clear();
SUMOtoTFAform.errors.clear();
for (Formula f : kb.formulaMap.values()) {
if (!KButilities.hasCorrectTypes(kb,f)) {
out.println(f.htmlFormat(kbHref) + "<br>");
out.println(KButilities.errors + "<P>");
}
KButilities.clearErrors();
kb.kbCache.errors.clear();
SUMOtoTFAform.errors.clear();
}
// relations without format
ArrayList<String> termsWithoutFormat = Diagnostics.relationsWithoutFormat(kb);
out.println("<br>" + HTMLformatter.htmlDivider("Warning: Relations without format"));
out.println(HTMLformatter.termList(termsWithoutFormat,kbHref));
// Terms without documentation
ArrayList<String> termsWithoutDoc = Diagnostics.termsWithoutDoc(kb);
out.println("<br>" + HTMLformatter.htmlDivider("Warning: Terms without documentation"));
out.println(HTMLformatter.termList(termsWithoutDoc,kbHref));
// Terms with multiple documentation
ArrayList<String> termsWithMultipleDoc = Diagnostics.termsWithMultipleDoc(kb);
out.println("<br>" + HTMLformatter.htmlDivider("Warning: Terms with multiple documentation"));
out.println(HTMLformatter.termList(termsWithMultipleDoc,kbHref));
// Terms differing only in capitalization
ArrayList<String> termCapDiff = Diagnostics.termCapDiff(kb);
out.println("<br>" + HTMLformatter.htmlDivider("Warning: Terms differing only in capitalization"));
out.println(HTMLformatter.termList(termCapDiff,kbHref));
// Members (instances) of a parent class that are not also members
// of one of the subclasses that constitute the exhaustive
// decomposition of the parent class.
ArrayList<String> termsMissingFromPartition = Diagnostics.membersNotInAnyPartitionClass(kb);
out.println("<br>" + HTMLformatter.htmlDivider("Warning: Instances of a partitioned class that are not instances of one of the class's partitioning subclasses"));
out.println(HTMLformatter.termList(termsMissingFromPartition,kbHref));
ArrayList<String> norule = Diagnostics.termsWithoutRules(kb);
out.println("<br>" + HTMLformatter.htmlDivider("Warning: Terms that do not appear in any rules"));
out.println(HTMLformatter.termList(norule,kbHref));
ArrayList<Formula> noquant = Diagnostics.quantifierNotInBody(kb);
out.println("<br>" + HTMLformatter.htmlDivider("Warning: Formulae with extraneous quantified variables"));
for (Formula f : noquant)
out.println(f.htmlFormat(kbHref) + "<p>");
ArrayList<Formula> noquantconseq = Diagnostics.unquantsInConseq(kb);
out.println("<br>" + HTMLformatter.htmlDivider("Warning: Formulae with unquantified variable appearing only in consequent"));
for (Formula f : noquantconseq)
out.println(f.htmlFormat(kbHref) + "<p>");
out.println("<br>" + HTMLformatter.htmlDivider("Warning: Files with mutual dependencies"));
out.println(Diagnostics.printTermDependency(kb,kbHref));
System.out.println(" > " + ((System.currentTimeMillis() - t0) / 1000.0)
+ " seconds to run all diagnostics");
%>
<%@ include file="Postlude.jsp" %>
</body>
</html>