Package com.articulate.sigma
Class Diagnostics
java.lang.Object
com.articulate.sigma.Diagnostics
A class that finds problems in a knowledge base. It is not meant
to be instantiated.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidMake a table of terms and the files in which they are definedstatic voidAdd a key to a map and a key, value to the map corresponding to the key.static voidAdd a key to a map and a value to the ArrayList corresponding to the key.Return a list of terms that have parents which are disjoint.static intcountOccurrences(String text, String substring) Counts how many times a substring appears in a string.static voiddiff the terms in two KBs (small first, then big) and print all the remainder with their filename and termFormatsstatic booleanfindDisconnectedGroups(HashMap<String, HashSet<String>> links) Finds all disconnected variable groups in the graph.Builds a map of variable co-occurrences in a formulastatic StringkbConsistencyCheck(KB kb) Iterating through all formulas, return a proof of an inconsistent or redundant one, if such a thing exists.static voidTest method for this class.static KBmakeEmptyKB(String kbName) Make an empty KB for use in Diagnostics.Returns a list of terms, each of which is an instance of some exhaustively decomposed class but is not an instance of any of the subclasses that constitute the exhaustive decomposition.static voidprintAllTerms(KB kb) static StringprintTermDependency(KB kb, String kbHref) Show file dependencies.Find cases where a variable appears in a quantifier list, but not in the body of the quantified expression.quantifierNotInBody(KB kb, String fname) Find cases where a variable appears in a quantifier list, but not in the body of the quantified expression.static booleanFind all relational terms that are missing an NLG format expressionstatic voidshowHelp()termCapDiff(KB kb) Find all terms that differ only in capitalizationstatic voidtermDefsByFile(KB kb) Make a table of terms and the files in which they are definedstatic voidtermDefsByGivenFile(KB kb, Set<String> files) Make a table of terms and the files in which they are definedstatic booleantermNotBelowEntity(String term, KB kb) Return a list of terms that do not have Entity as a parent term.Return a list of terms that do not have Entity as a parent term.Return a list of terms that have more than one documentation string.static ListtermsWithoutDoc(KB kb) Return a list of terms that do not have a documentation string.termsWithoutRelation(KB kb, String rel, int argnum, char letter) Return a list of terms (for a given argument position) that do not have a specified relation.termsWithoutRules(KB kb) Find all terms which do not appear in any implication (rule).static booleantermWithoutRules(KB kb, String term) Term does not appear in any implication (rule).unquantsInConseq(KB kb)
-
Field Details
-
debug
public static boolean debug -
LOG_OPS
-
varLinksParentMap
-
-
Constructor Details
-
Diagnostics
public Diagnostics()
-
-
Method Details
-
termsWithoutRelation
Return a list of terms (for a given argument position) that do not have a specified relation.- Parameters:
kb- the knowledge baserel- the relation nameargnum- the argument position of the termletter- the first letter of the term name
-
termsWithoutDoc
Return a list of terms that do not have a documentation string. -
termsWithMultipleDoc
Return a list of terms that have more than one documentation string. -
termNotBelowEntity
Return a list of terms that do not have Entity as a parent term. -
termsNotBelowEntity
Return a list of terms that do not have Entity as a parent term. -
childrenOfDisjointParents
Return a list of terms that have parents which are disjoint. -
membersNotInAnyPartitionClass
Returns a list of terms, each of which is an instance of some exhaustively decomposed class but is not an instance of any of the subclasses that constitute the exhaustive decomposition. For example, given (instance E A) and (partition A B C D), then E is included in the list of terms to be returned if E is not a instance of B, C, or D. -
relationsWithoutFormat
Find all relational terms that are missing an NLG format expression -
termWithoutRules
Term does not appear in any implication (rule). -
termsWithoutRules
Find all terms which do not appear in any implication (rule). -
singleUseVariables
- Returns:
- a list of variables used only once.
-
unquantInConsequent
- Returns:
- a list of variables only in the consequent that are unquantified TODO: if there's an implication in the consequent, test if the interior consequent has a variable not found in the interior antecedent
-
unquantsInConseq
-
existentialInAntecedent
- Returns:
- true if an existential is found in the antecedent of a rule.
-
quantifierNotInStatement
- Returns:
- true if a quantifiers in a quantifier list is not found in the body of the statement.
-
quantifierNotInBody
Find cases where a variable appears in a quantifier list, but not in the body of the quantified expression. For example (exists (?FOO) (bar ?FLOO Shmoo))- Returns:
- an ArrayList of Formula(s).
-
quantifierNotInBody
Find cases where a variable appears in a quantifier list, but not in the body of the quantified expression. For example (exists (?FOO) (bar ?FLOO Shmoo))- Returns:
- an ArrayList of Formula(s).
-
addToMapList
Add a key to a map and a value to the ArrayList corresponding to the key. Results are a side effect. -
addToDoubleMapList
public static void addToDoubleMapList(Map<String, Map<String, List<String>>> m, String key1, String key2, String value) Add a key to a map and a key, value to the map corresponding to the key. Results are a side effect. -
printTermDependency
Show file dependencies. If two files depend on each other, show only the smaller list of dependencies, under the assumption that that is the erroneous set. -
makeEmptyKB
Make an empty KB for use in Diagnostics.- Parameters:
kbName- the name of the empty KB to make
-
kbConsistencyCheck
Iterating through all formulas, return a proof of an inconsistent or redundant one, if such a thing exists. -
termDefsByFile
Make a table of terms and the files in which they are defined -
termDefsByGivenFile
Make a table of terms and the files in which they are defined -
addLabels
Make a table of terms and the files in which they are defined -
printAllTerms
-
termCapDiff
Find all terms that differ only in capitalization -
diffTerms
diff the terms in two KBs (small first, then big) and print all the remainder with their filename and termFormats -
findOrphanVars
Builds a map of variable co-occurrences in a formula- Parameters:
f- the formula to analyze- Returns:
- map from each variable to the set of variables it co-occurs with
-
findDisconnectedGroups
public static ArrayList<HashSet<String>> findDisconnectedGroups(HashMap<String, HashSet<String>> links) Finds all disconnected variable groups in the graph.- Parameters:
links- the variable co-occurrence map- Returns:
- list of disconnected groups, where each group is a set of connected variables
-
countOccurrences
Counts how many times a substring appears in a string.- Parameters:
text- the string to search insubstring- the substring to count- Returns:
- the number of occurrences
-
showHelp
public static void showHelp() -
main
Test method for this class.
-