Package com.articulate.sigma
Class DocGen
java.lang.Object
com.articulate.sigma.DocGen
A class to generate simplified HTML-based documentation for SUO-KIF terms.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceclass -
Field Summary
FieldsModifier and TypeFieldDescriptionA TreeMap of TreeMaps of ArrayLists where the keys are uppercase single characters (of term formats or headwords) and the values are TreeMaps with a key of the term formats or headwords and ArrayList values of the actual term names.A Set of Strings.protected static final Stringprotected StringThe default image file (such as an organization's logo) to be used in HTML generationprotected StringThe default image file (such as an organization's logo) to be used in HTML generation, wrapped in any necessary additional markup required for proper display.protected StringThe default namespace associated with this DocGen objectprotected StringThe default namespace for predicates in the ontology associated with this DocGen objectprotected DocGen.DisplayFilterThe DisplayFilter which, if present, determines if a given SUO-KIF object may be displayed or output by this DocGen object.protected static Mapprotected intA int value representing the bit values that control the file generation process.protected StringA default key to identify this particular DocGen objectprotected static final StringThis String token denotes Sigma's "simple" HTML layout, and is used as a flag in the HTML generation code to switch between full and simple modes.protected StringThe document footer text to be used for HTML generationprotected static StringThe default base plus file suffix name for the main index file for a set of HTML output files.protected SetA set of the predicates that should not be displayed to the user.protected static MapSupports memoization for isInstanceOf(kb, c1, c2).protected KBThe KB associated with this DocGen object.protected Stringprotected intA List of currently known namespace prefixes.A List of currently known namespaces.protected StringThe ontology associated with this DocGen object, and for which the DocGen object is used to generate files.protected StringThe canonical pathname of the current directory in which output files will be (are being) saved.protected FileThe parent directory for target subdirectories of HTML, XSD, and other types of files generated by this DocGen object.A Map in which each key is a KB name and the corresponding value is a List of the Predicates defined in the KB.protected booleanIf true, a termFormat value obtained for term will be displayed rather than the term name itself.protected static final StringA Map containing String replacement pairs.protected StringThe style sheet (CSS filename) to be referenced in HTML generationprotected StringThe document title text to be used for HTML generationprotected StringThe header to be used for the the table of contents (or index list) section during HTML generation. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedDocGen()To obtain an instance of DocGen, use the static factory method getInstance(). -
Method Summary
Modifier and TypeMethodDescriptionintaddDocGenControlBits(int val) Adds val via bitwise OR to the int value that represents the bit values used to control the document generation process for this DocGen instance.intaddDocGenControlBits(String token) Adds via bitwise OR the bit value corresponding to token to the int value that represents the bit values used to control the document generation process for this DocGen instance.voidClears the alphaList for this DocGen object.voidSets to 0 the int value that represents the bit values used to guide aspects of the document generation process for this DocGen instance.convertRowStringsToLists(List<String> rows, char delimiter) Converts a List of char-delimited Strings to a List of Lists (i.e., an array) representing a spreadsheet.protected intcountDelimiters(String line, char delimiter) Counts the number of field delimiters in line and returns the count, ignoring delimiters that are inside Strings.createAllStatements(KB kb, String kbHref, String term, int limit) Create an HTML page that lists information about a particular term, with a limit on how many statements of each type should be displayed.createAlphaList(KB kb) protected StringcreateBelongsToClass(KB kb, String kbHref, String term, String language) Returns a String containing HTML markup for the Belongs to Class section of an HTML page displaying the partial definition of term in kb.protected StringReturns a String containing HTML markup for the Belongs to Class section of an HTML page displaying the partial definition of term in kb.protected StringcreateChildren(KB kb, String kbHref, String term, String language) Returns a String containing HTML markup for the Children field of an HTML page displaying the definition of term in kb.protected StringcreateComments(KB kb, String kbHref, String term, String language) Returns a String containing the HTML markup for the Comment field in a page displaying the definition of term in kb.protected StringcreateCompositeComponentLine(KB kb, String kbHref, String term, int indent, String language) Returns a String containing HTML markup for a single table row in the Composite Component section of an HTML page displaying the partial definition of term in kb.createCompositePage(KB kb, String kbHref, String term, Map<String, Map<String, List<String>>> alphaList, int limit, String language, String formatToken) Create an HTML page that lists information about a particular composite term, which is a representation of an XML structure.protected ListcreateCompositeRecurse(KB kb, String term, boolean isAttribute, int indent) Recursively computes and then returns a List that constitutes the graph containing those XML elements and attributes syntactically subordinate to term in kb.protected StringcreateContainingCompositeComponentLine(KB kb, String kbHref, String containingComp, String instance, int indent, String language) Returns a String containing HTML markup for a row displaying a contained component in an HTML page displaying the partial definition of instance in kb.protected StringcreateDisplayNames(KB kb, String kbHref, String term, String formatToken) Returns a String containing HTML markup for the Display Labels field of an HTML page displaying statements about term in kb.protected StringcreateDocs(KB kb, String kbHref, String term, String language) Returns a String consisting of HTML markup for a documentation String for term obtained from kb and indexed by language.protected StringcreateFormula(KB kb, String kbHref, String indentSeq, int level, String previousTerm, String currentTerm, String context) Returns a String containing HTML markup for a SUO-KIF Formula.protected StringcreateHasSameComponents(KB kb, String kbHref, String term, String language) Returns a String containing HTML markup for the Has Same Components As field of an HTML page displaying the definition of term in kb.protected StringReturns a String containing HTML markup for the Instances section of an HTML page displaying the definition of term in kb.createPage(KB kb, String kbHref, String term, Map<String, Map<String, List<String>>> alphaList, int limit, String language, String formatToken) Create an HTML page that lists information about a particular term, with a limit on how many statements of each type should be displayed.protected StringReturns a String containing HTML markup for the Parents field of an HTML page displaying the definition of term in kb.protected StringReturns a String containing HTML markup for the Relations section of an HTML page displaying the definition of term in kb.protected StringcreateSynonyms(KB kb, String kbHref, String term, String formatToken) Returns a String containing HTML markup for the synonym field of an HTML page displaying the definition of term in kb.protected StringcreateUsingSameComponents(KB kb, String kbHref, String term, String language) Returns a String containing HTML markup for the Composites Using Same Components field of an HTML page displaying the definition of term in kb.static booleanprotected ListfindContainingComposites(KB kb, String term) Returns an ArrayList holding the composite entities (Elements) that contain term, or returns an empty ArrayList.protected StringformatCompositeHierarchy(KB kb, String kbHref, List hier, String language) Returns a String containing HTML markup for a hierarchy or tree display of terms that denote nested composite components.protected StringformatContainingComposites(KB kb, String kbHref, List containing, String composite, String language) Given the SUO-KIF statements: (hasXmlElement PartyDescriptor LocalInstance_2_459) (datatype LocalInstance_2_459 PartyId) (documentation LocalInstance_2_459 PartyDescriptor "A Composite containing details...") show PartyDescriptor as one of the "containing composites" of PartyId, and show the documentation for the instance node next to the parent composite.generateDynamicTOCHeader(String kbHref) Generate an alphabetic HTML list that points to the individual index pages (which collect all terms starting with a particular letter.voidgenerateHTML(KB kb, String language, boolean simplified, String formatToken) Generate simplified HTML pages for all terms.generateHtmlDocStart(String title) Returns a String of HTML markup for the start of a document, using title as the document title String.protected StringgenerateHtmlFooter(String footerText) Returns a String of HTML markup encoding the footer section of an HTML document, and using footerText as the text to be displayed at the bottom of the page.generateHTMLPages(KB kb, Map<String, Map<String, List<String>>> alphaList, String language, String formatToken) voidgenerateSingleHTML(KB kb, String language, boolean simplified) voidgenerateSingleHTML(KB kb, String dir, Map<String, Map<String, List<String>>> alphaList, String language, boolean simplified) Generate a single HTML page showing all terms.protected StringGenerate an alphabetic HTML list that points to the individual index pages (which collect all terms or term formats) starting with a particular letter.protected StringgenerateTOCPage(KB kb, String firstLetter, Map<String, Map<String, List<String>>> alphaList, String language) Generate an HTML page that lists term name and its documentationReturns an ArrayList of namespace delimiter Strings gathered from all loaded KBs, obtained by collecting statements formed with the predicate docGenNamespaceDelimiter.getAlphaList(KB kb) Returns a List of the names of all client ontologies currently represented in any loaded KB.protected StringgetClosestXmlDataType(KB kb, String term) Collects and returns the Set containing all known coded identifiers in kb, including ISO code values stated to be such.protected ListgetContainingComposites(KB kb, String term) Travels up the HasXmlElement and HasXmlAttribute relation hierarchies to collect all parents, and returns them in an ArrayList.protected StringgetContextualDocumentation(KB kb, String term, List contexts) Returns the first documentation String obtained for term in kb, using the List of namespaces or other contextualizing terms in contexts.static intgetControlBitValue(String token) protected ListgetDatatypeTerms(KB kb, String term, int targetArgnum) Returns the base filename plus filename suffix form of the logo image file to be referenced during HTML document generation, else returns an empty String if no value has been set.Returns the base filename plus filename suffix form of the logo image file, wrapped in any additional markup required for the intended rendering of the image.Returns the String denoting the default namespace associated with this DocGen object.Returns the String denoting the default namespace for predicates in the ontology associated with this DocGen object.Returns the DisplayFilter object associated with this DocGen object, or null if no DisplayFilter has been set.intReturns the int value that represents the bit values used to guide aspects of the document generation process for this DocGen instance.Returns the String key that is the index for this particular DocGen object.protected StringgetFirstContainingClass(KB kb, String term) Returns a SUO-KIF constant that denotes the first containing Class of term obtained in kb.protected StringgetFirstDatatype(KB kb, String term) protected StringgetFirstGeneralTerm(KB kb, String term) Returns the first containing, subsuming, or superordinate entity that can be found for term in kb.getFirstGeneralTerms(KB kb, String term) Returns a List of the first containing, subsuming, or superordinate entities found for term in kb.static StringgetFirstHtmlFormatToken(KB kb, String ontology) Returns the first String token retrieved from ontology in kb that denotes an HTML output format.getFirstInstances(KB kb, String term) Returns a List of the entities that are immediate instances of term in kb.getFirstSpecificTerms(KB kb, String term) Returns a List of the first instances or syntactic subordinate entities that can be found for term in kb.getFirstSubClasses(KB kb, String term) Returns a List containing the immediate SUO-KIF subclasses of term in kb.protected StringgetFirstSubsumingTerm(KB kb, String term) Returns the first purely "subsuming" entity that can be found for term in kb, assuming that term denotes a Class or a Relation.protected StringgetFirstTermFormat(KB kb, String term, List contexts) Returns a String that is the first termFormat value obtained for term in kb, else returns null if no termFormat value exists.Returns the String that will be used as the footer text for HTML document generation, else returns an empty String if no footer text value has been set.Returns a Set containing the names of those predicates for which display should be suppressed, and tries to create the Set from docGenInhibitDisplayRelations statements found in the current KB if the Set does not already exist.static DocGenstatic DocGengetInstance(KB kb, String ontology) static DocGengetInstance(String compositeKey) getKB()static StringgetNamespaceDelimiters(KB kb, String ontology) Returns a List of all Strings used as namespace delimiters in terms defined or referred to in ontology, as specified by statements formed with the SUO-KIF predicate docGenNamespaceDelimiter.protected StringgetNamespacePrefix(KB kb, String term) Returns the namespace prefix of term based on the namespaces known in kb, else returns the empty String if term appears to have no namespace prefix.Returns an ArrayList of all known namespace prefixes sorted by length, from longest to shortest.Returns a List of all SUO-KIF terms that denote namespaces in any loaded KB, obtained by gathering statements formed with the predicates inNamespace and ontologyNamespace as well as explicit instance statements.getNamespaces(KB kb, String ontology, boolean force) Returns a List of all SUO-KIF terms denoting namespaces in kb or in ontology, using the predicates inNamespace and ontologyNamespace.protected StringgetNearestContainingClass(KB kb, String term) Returns the first containing Class that can be found for term in kb.Returns a term denoting the default Ontology for this DocGen object if an Ontology has been set, and tries very hard to find a relevant Ontology if one has not been set.getOntology(KB kb) Returns a term denoting the default Ontology for this DocGen object if an Ontology has been set, and tries very hard to find a relevant Ontology if one has not been set.getOntologyNamespaces(KB kb, String ontology) Returns a List of all SUO-KIF terms denoting those namespaces containing terms that are defined in, or occur in, statements in ontology.Returns the canonical pathname String of the current directory in which output files will be (are being) saved.getOutputFormatTokens(KB kb, String ontology) Returns a List of String tokens that determine how the output should be formatted.Returns a File object representing the directory in which the subdirectories for the various types of output files will be located.getPredicates(KB kb, boolean requireNamespace) Collects and returns a List of all Predicates in kb.getRangeValueList(KB kb, String predicate) Returns an ArrayList of Strings extracted from the range argument (arg2) of the first retrieved statement formed with predicate.static StringbooleanReturns true if a termFormat value obtained for term will be displayed during HTML rendering rather than the term name itself.getStringReplacement(String fromString) Returns the String replacement for fromString, if one can be located, else just returns fromString.Returns the Map to be used for HTML character entity to ASCII replacements, attempting to build it from docGenCodeMapTranslation statements found in the KB if the Map does not already exist.Returns the base filename plus filename suffix form of the Cascading Style Sheet file to be referenced during HTML document generation, else returns an empty String if no value has been set.getSubComponents(KB kb, String term) Returns a List containing those terms that are immediate syntactic subordinates of term in kb.protected ListgetSubordinateAttributes(KB kb, String kifTerm) Returns a List containing the subordinate XmlAttributes of kifTerm, else return an empty List.protected ListgetSubordinateElements(KB kb, String kifTerm) Returns a List containing the subordinate XmlElements of kifTerm, else return an empty List.getSuperComponents(KB kb, String term) Returns a List containing those terms that are immediate syntactic superiors or "containers" of term in kb.protected ListgetSyntacticCompositeTerms(KB kb, String term, int targetArgnum) protected ListgetSyntacticExtensionTerms(KB kb, String term, int targetArgnum, boolean computeClosure) getSyntacticSubordinateTerms(KB kb, String term) Returns a List of the entities that are immediate syntactic subordinates of term in kb.protected ListgetSyntacticUnionTerms(KB kb, String term, int targetArgnum) getTermNamespace(KB kb, String term) getTermPresentationName(KB kb, String term) getTermPresentationName(KB kb, String namespace, String term) getTermPresentationName(KB kb, String namespace, String term, boolean withSpanTags) Returns the String that will be used as the title text for HTML document generation, else returns an empty String if no title text value has been set.Returns the String header to be used in generated HTML files.static Stringprotected booleanhasSubComponents(KB kb, String term) Returns true if term has syntactic subcomponents such as XML elements or XML attributes in kb, else returns false.static StringindentChars(String str, int indent) Returns a String consisting of str concatenated indent times.static booleanisComposite(KB kb, String term) Returns true if term is an instance or subclass of CompositeContentBearingObject in kb, else returns false.protected booleanisDataType(KB kb, String term) protected static booleanisInstanceOf(KB kb, String i, String c) Returns true if i is an instance of c, else returns false.protected booleanisLegalForDisplay(String term) Returns true if statements that include term and occur in the kb and ontology associated with this DocGen object may be displayed or output (at all, in any form).static booleanprotected static booleanisSkipNode(KB kb, String term) Returns true if term should be skipped over during printing, else returns false.protected booleanisXmlAttribute(KB kb, String term) Returns a List that constitutes the graph containing those XML elements and attributes syntactically subordinate to term in kb.static voidprotected FilemakeOutputDir(String token) Creates a subdirectory of SIGMA_HOME/files/, in which output files of the type specified by token are saved.protected voidprintHTMLPages(Map<String, String> pageList, String dirpath) Save pages below the KBs directory in a directory called HTML.protected StringprocessDocString(KB kb, String kbHref, String namespace, String docString, boolean isXmlDoc, boolean addHrefs) readSpreadsheetFile(String inpath, char delimiter) readSpreadsheetFile(String inpath, char delimiter, int delimitersPerRow, List<String> rowFlags) Parses a file of delimited fields into an ArrayList of ArrayLists.protected StringremoveLinkableNamespacePrefixes(KB kb, String text) Removes namespace prefixes from all SUO-KIF terms to be hyperlinked in text.resortKbTerms(KB kb) Rebuilds the TreeSet containing all terms in kb, and forces the new TreeSet to sort according to each term's presentation name.protected voidGenerate and save all the index pages that link to the individual term pages.voidsetDefaultImageFile(String filename) Sets the base name plus suffix filename of the logo image file to be referenced during HTML document generation.voidsetDefaultImageFileMarkup(String markup) Sets the base name plus suffix filename of the logo image file to be referenced during HTML document generation.voidsetDefaultNamespace(String namespace) Sets the default namespace for this DocGen object.voidsetDefaultPredicateNamespace(String namespace) Sets the default namespace for predicates in the ontology associated with this DB object.voidsetDisplayFilter(DocGen.DisplayFilter filterObj) Sets the DisplayFilter associated with this DocGen object to filterObj.voidsetDocGenKey(String key) Sets the String key that is the index for this particular DocGen object.voidsetFooterText(String str) Sets the footer text String to be used during HTML document generation.voidsetInhibitDisplayRelations(Set relations) Sets the predicates for which display should be suppressed to those contained in relations.voidvoidvoidsetMetaDataFromKB(KB kb, String ontology) Tries to use the values obtained from kb and ontology to set some of the parameter values used for HTML generation.voidsetOntology(String term) voidsetOutputDirectoryPath(String pathname) Sets the canonical pathname String of the current directory in which output files will be (are being) saved.voidsetOutputParentDir(KB kb, String ontology) Sets the parent directory in which subdirectories for different types of output files will be created to the abstract pathname represented by a statement in kb formed with the predicate docGenOutputParentDirectory and the argument ontology.voidsetOutputParentDir(File obj) Sets the parent directory in which subdirectories for different types of output files will be created to the File obj, and tries to create the directory pathname if it does not already exist.voidsetOutputParentDir(String pathname) Sets to pathname the parent directory in which subdirectories for different types of output files will be created, and tries to create the directory pathname if it does not already exist.voidsetOutputParentDir(List pathnameComponents) Sets the parent directory in which subdirectories for different types of output files will be created to the File obj, and tries to create the directory pathname if it does not already exist.voidsetSimplified(boolean val) Sets this.simplified to val.voidsetStringReplacementMap(Map<String, String> keyValPairs) Sets the Map to be used for HTML character entity to ASCII replacements.voidsetStyleSheet(String filename) Sets the base name plus suffix filename of the Cascading Style Sheet file to be referenced during HTML document generation.voidsetTitleText(String titlestr) Sets the title text to be used during HTML document generation.voidsetTocHeader(String header) Sets the String header to be used in generated HTML files to header.protected StringshowCardinalityCell(KB kb, String kbHref, String term, String context) Returns a String containing HTML markup for the Cardinality field of an HTML page displaying the definition of term in kb.showTermName(KB kb, String term, String language) Returns the termFormat entry for term in kb and language, otherwise returns the termFormat entry for term in English, otherwise just returns the term name.voidsortByPresentationName(KB kb, String namespaceTerm, List<String> stringList) Sorts stringList in place by the presentation name of each its terms, which could be very different from the raw term name.protected voidsortByTermLength(List<String> terms) Sorts the List terms by the length of the Strings it contains, from longest to shortest.protected StringstripNamespacePrefix(KB kb, String term) Returns term without its namespace prefix if it appears to have one in kb, else just returns term.booleantestDocGenControlBits(int valToTest) Returns true if the bit values represented by valToTest are among the control bits represented for this DocGen instance.booleantestDocGenControlBits(String token) Returns true if the bit values corresponding to token are among the control bits represented for this DocGen instance.protected StringtoKifNamespace(KB kb, String term) Returns a SUO-KIF term denoting a namespace.static voidwriteToStream(List<String> data, OutputStream stream) Writes a List of Strings to an OutputStream.
-
Field Details
-
F_SI
This String token denotes Sigma's "simple" HTML layout, and is used as a flag in the HTML generation code to switch between full and simple modes.- See Also:
-
F_CONTROL_TOKENS
-
SP2
- See Also:
-
INDEX_FILE_NAME
The default base plus file suffix name for the main index file for a set of HTML output files. -
localCounter
protected int localCounter -
DEFAULT_KEY
- See Also:
-
DOC_GEN_INSTANCES
-
lineSeparator
-
docGenControlBits
protected int docGenControlBitsA int value representing the bit values that control the file generation process. -
defaultNamespace
The default namespace associated with this DocGen object -
defaultPredicateNamespace
The default namespace for predicates in the ontology associated with this DocGen object -
ontology
The ontology associated with this DocGen object, and for which the DocGen object is used to generate files. -
kb
The KB associated with this DocGen object. -
codedIdentifiers
A Set of Strings. -
titleText
The document title text to be used for HTML generation -
styleSheet
The style sheet (CSS filename) to be referenced in HTML generation -
defaultImageFile
The default image file (such as an organization's logo) to be used in HTML generation -
defaultImageFileMarkup
The default image file (such as an organization's logo) to be used in HTML generation, wrapped in any necessary additional markup required for proper display. -
outputDirectoryPath
The canonical pathname of the current directory in which output files will be (are being) saved. -
stringReplacementMap
A Map containing String replacement pairs. This is to provide adequate ASCII translations for HTML character entities, in circumstances where occurrences of the entities might cause parsing or rendering problems (e.g., apparently, in XSD files). -
inhibitDisplayRelations
A set of the predicates that should not be displayed to the user. -
tocHeader
The header to be used for the the table of contents (or index list) section during HTML generation. -
docGenKey
A default key to identify this particular DocGen object -
simplified
protected boolean simplifiedIf true, a termFormat value obtained for term will be displayed rather than the term name itself. -
relationsByKB
A Map in which each key is a KB name and the corresponding value is a List of the Predicates defined in the KB. -
outputParentDir
The parent directory for target subdirectories of HTML, XSD, and other types of files generated by this DocGen object. -
displayFilter
The DisplayFilter which, if present, determines if a given SUO-KIF object may be displayed or output by this DocGen object. -
alphaList
A TreeMap of TreeMaps of ArrayLists where the keys are uppercase single characters (of term formats or headwords) and the values are TreeMaps with a key of the term formats or headwords and ArrayList values of the actual term names. Note that if "simplified" is false actual term names will be used instead of term formats or headwords and the interior map will have keys that are the same as their values. Pictorially: letter-> formattedTerm1->term11,term12...term1N formattedTerm2->term21,term22...term2N -
namespacePrefixes
A List of currently known namespace prefixes. -
namespaces
A List of currently known namespaces. -
isInstanceOfCache
Supports memoization for isInstanceOf(kb, c1, c2).
-
-
Constructor Details
-
DocGen
protected DocGen()To obtain an instance of DocGen, use the static factory method getInstance().
-
-
Method Details
-
getControlTokens
-
getControlBitValue
-
getInstance
-
getInstance
-
getInstance
-
getLineSeparator
-
setLineSeparator
-
getDocGenControlBits
public int getDocGenControlBits()Returns the int value that represents the bit values used to guide aspects of the document generation process for this DocGen instance.- Returns:
- An int value representing bit values
-
clearDocGenControlBits
public void clearDocGenControlBits()Sets to 0 the int value that represents the bit values used to guide aspects of the document generation process for this DocGen instance. -
addDocGenControlBits
public int addDocGenControlBits(int val) Adds val via bitwise OR to the int value that represents the bit values used to control the document generation process for this DocGen instance.- Parameters:
val- An integer representing bit values- Returns:
- An int value representing the result of the bitwise OR operation.
-
addDocGenControlBits
Adds via bitwise OR the bit value corresponding to token to the int value that represents the bit values used to control the document generation process for this DocGen instance.- Parameters:
token- A String representing bit values- Returns:
- An int value representing the result of the bitwise OR operation.
-
testDocGenControlBits
public boolean testDocGenControlBits(int valToTest) Returns true if the bit values represented by valToTest are among the control bits represented for this DocGen instance.- Parameters:
valToTest- An integer representing bit values to be tested- Returns:
- true or false
-
testDocGenControlBits
Returns true if the bit values corresponding to token are among the control bits represented for this DocGen instance.- Parameters:
token- A String token corresponding to a bit value- Returns:
- true or false
-
getOutputFormatTokens
Returns a List of String tokens that determine how the output should be formatted. The List could be empty.- Parameters:
kb- The KB in which to look for docGenOutputFormat statementsontology- A SUO-KIF term denoting an Ontology- Returns:
- a List of Strings, which could be empty
-
getFirstHtmlFormatToken
Returns the first String token retrieved from ontology in kb that denotes an HTML output format. Such tokens may be the third element in statements for which the predicate is docGenOutputFormat.- Parameters:
kb- The KB in which to look for docGenOutputFormat statementsontology- A SUO-KIF term denoting an Ontology- Returns:
- a String token, or null.
-
getDefaultNamespace
Returns the String denoting the default namespace associated with this DocGen object. -
setDefaultNamespace
Sets the default namespace for this DocGen object. -
getDefaultPredicateNamespace
Returns the String denoting the default namespace for predicates in the ontology associated with this DocGen object. -
setDefaultPredicateNamespace
Sets the default namespace for predicates in the ontology associated with this DB object. -
setOntology
-
getOntology
Returns a term denoting the default Ontology for this DocGen object if an Ontology has been set, and tries very hard to find a relevant Ontology if one has not been set. -
getOntology
Returns a term denoting the default Ontology for this DocGen object if an Ontology has been set, and tries very hard to find a relevant Ontology if one has not been set. -
setKB
-
getKB
-
getCodedIdentifiers
Collects and returns the Set containing all known coded identifiers in kb, including ISO code values stated to be such.- Parameters:
kb- The KB in which to gather terms defined as coded identifiers- Returns:
- A Set of all the terms that denote ISO code values and other coded identifiers
-
setTitleText
Sets the title text to be used during HTML document generation.- Parameters:
titlestr- A String that will be used as the HTML document title
-
getTitleText
Returns the String that will be used as the title text for HTML document generation, else returns an empty String if no title text value has been set. -
setStyleSheet
Sets the base name plus suffix filename of the Cascading Style Sheet file to be referenced during HTML document generation.- Parameters:
filename- A String that is a base filename plus a filename suffix
-
getStyleSheet
Returns the base filename plus filename suffix form of the Cascading Style Sheet file to be referenced during HTML document generation, else returns an empty String if no value has been set. -
setDefaultImageFile
Sets the base name plus suffix filename of the logo image file to be referenced during HTML document generation.- Parameters:
filename- A String that is a base filename plus a filename suffix
-
getDefaultImageFile
Returns the base filename plus filename suffix form of the logo image file to be referenced during HTML document generation, else returns an empty String if no value has been set. -
setDefaultImageFileMarkup
Sets the base name plus suffix filename of the logo image file to be referenced during HTML document generation.- Parameters:
markup- A String that includes the image file pathname plus any additional markup required for proper display of the image
-
getDefaultImageFileMarkup
Returns the base filename plus filename suffix form of the logo image file, wrapped in any additional markup required for the intended rendering of the image. -
setOutputDirectoryPath
Sets the canonical pathname String of the current directory in which output files will be (are being) saved.- Parameters:
pathname- A canonical pathname String
-
getOutputDirectoryPath
Returns the canonical pathname String of the current directory in which output files will be (are being) saved. -
setStringReplacementMap
Sets the Map to be used for HTML character entity to ASCII replacements. -
getStringReplacementMap
Returns the Map to be used for HTML character entity to ASCII replacements, attempting to build it from docGenCodeMapTranslation statements found in the KB if the Map does not already exist. -
getStringReplacement
Returns the String replacement for fromString, if one can be located, else just returns fromString.- Parameters:
fromString- A String for which a replacement is sought- Returns:
- A replacement String
-
setInhibitDisplayRelations
Sets the predicates for which display should be suppressed to those contained in relations.- Parameters:
relations- A Set of predicate names
-
getInhibitDisplayRelations
Returns a Set containing the names of those predicates for which display should be suppressed, and tries to create the Set from docGenInhibitDisplayRelations statements found in the current KB if the Set does not already exist.- Returns:
- a Set of predicate names
-
setTocHeader
Sets the String header to be used in generated HTML files to header. -
getTocHeader
Returns the String header to be used in generated HTML files. -
getDocGenKey
Returns the String key that is the index for this particular DocGen object. -
setDocGenKey
Sets the String key that is the index for this particular DocGen object. -
getKifNamespaceDelimiter
-
getW3cNamespaceDelimiter
-
getSafeNamespaceDelimiter
-
getSimplified
public boolean getSimplified()Returns true if a termFormat value obtained for term will be displayed during HTML rendering rather than the term name itself. -
setSimplified
public void setSimplified(boolean val) Sets this.simplified to val. If this.simplified is true, the statements in Sigma's KB will be rendered in a simple frame-like HTML format rather than as SUO-KIF Formulas. -
getRelationsByKB
-
indentChars
Returns a String consisting of str concatenated indent times.- Parameters:
str- The String to be concatenated with itselfindent- An int indicating the number of times str should be concatenated- Returns:
- A String
-
setOutputParentDir
Sets the parent directory in which subdirectories for different types of output files will be created to the File obj, and tries to create the directory pathname if it does not already exist.- Parameters:
obj- A File object representing a directory
-
setOutputParentDir
Sets to pathname the parent directory in which subdirectories for different types of output files will be created, and tries to create the directory pathname if it does not already exist.- Parameters:
pathname- A String representing a directory pathname
-
setOutputParentDir
Sets the parent directory in which subdirectories for different types of output files will be created to the File obj, and tries to create the directory pathname if it does not already exist.- Parameters:
pathnameComponents- A String representing a directory pathname
-
setOutputParentDir
Sets the parent directory in which subdirectories for different types of output files will be created to the abstract pathname represented by a statement in kb formed with the predicate docGenOutputParentDirectory and the argument ontology. Tries to create the directory pathname if it does not already exist.- Parameters:
kb- The KB containing a statement formed with the predicate docGenOutputParentDirectory and ontologyontology- The ontology referred to in a statement formed with the predicate docGenOutputParentDirectory in kb
-
getOutputParentDir
Returns a File object representing the directory in which the subdirectories for the various types of output files will be located. -
setDisplayFilter
Sets the DisplayFilter associated with this DocGen object to filterObj.- Parameters:
filterObj- An instance of DisplayFilter
-
getDisplayFilter
Returns the DisplayFilter object associated with this DocGen object, or null if no DisplayFilter has been set. -
resortKbTerms
Rebuilds the TreeSet containing all terms in kb, and forces the new TreeSet to sort according to each term's presentation name. -
getAlphaList
- Returns:
- a TreeMap of TreeMaps of ArrayLists where the keys are uppercase single characters (of term formats or headwords) and the values are TreeMaps with a key of the term formats or headwords and ArrayList values of the actual term names. Note that if "simplified" is false actual term names will be used instead of term formats or headwords and the interior map will have keys that are the same as their values. Pictorially: letter-> formattedTerm1->term11,term12...term1N formattedTerm2->term21,term22...term2N
-
clearAlphaList
public void clearAlphaList()Clears the alphaList for this DocGen object. -
createAlphaList
- Returns:
- a TreeMap of TreeMaps of ArrayLists where the keys are uppercase single characters (of term formats or headwords) and the values are TreeMaps with a key of the term formats or headwords and ArrayList values of the actual term names. Note that if "simplified" is false actual term names will be used instead of term formats or headwords and the interior map will have keys that are the same as their values. Pictorially: letter-> formattedTerm1->term11,term12...term1N formattedTerm2->term21,term22...term2N
-
isComposite
Returns true if term is an instance or subclass of CompositeContentBearingObject in kb, else returns false.- Parameters:
kb- The KB in which to check the definition of termterm- A SUO-KIF term- Returns:
- true or false
-
getRangeValueList
Returns an ArrayList of Strings extracted from the range argument (arg2) of the first retrieved statement formed with predicate. If no statement can be retrieved, the ArrayList will be empty.- Parameters:
kb- The KB from which to retrieve a statement with predicatepredicate-- Returns:
- An ArrayList of Strings, which could be empty.
-
setMetaDataFromKB
Tries to use the values obtained from kb and ontology to set some of the parameter values used for HTML generation.- Parameters:
kb- The KB from which to gather stated parameter valuesontology- The ontology from which to gather stated parameter values
-
getClientOntologyNames
Returns a List of the names of all client ontologies currently represented in any loaded KB. -
createCompositePage
public String createCompositePage(KB kb, String kbHref, String term, Map<String, Map<String, List<String>>> alphaList, int limit, String language, String formatToken) Create an HTML page that lists information about a particular composite term, which is a representation of an XML structure.- Parameters:
alphaList- a TreeMap of TreeMaps of ArrayLists. @see createAlphaList()
-
createPage
public String createPage(KB kb, String kbHref, String term, Map<String, Map<String, List<String>>> alphaList, int limit, String language, String formatToken) Create an HTML page that lists information about a particular term, with a limit on how many statements of each type should be displayed.- Parameters:
alphaList- a TreeMap of TreeMaps of ArrayLists.
-
getAllNamespaceDelimiters
Returns an ArrayList of namespace delimiter Strings gathered from all loaded KBs, obtained by collecting statements formed with the predicate docGenNamespaceDelimiter.- Returns:
- An ArrayList
of namespace delimiter tokens, which could be empty
-
generateHtmlDocStart
Returns a String of HTML markup for the start of a document, using title as the document title String.- Parameters:
title- A String to be used as the document title- Returns:
- A String of HTML markup encoding the start of an HTML document
-
isLegalForDisplay
Returns true if statements that include term and occur in the kb and ontology associated with this DocGen object may be displayed or output (at all, in any form).- Returns:
- true or false
-
getOntologyNamespaces
Returns a List of all SUO-KIF terms denoting those namespaces containing terms that are defined in, or occur in, statements in ontology. An association (correspondence) between a namespace and an ontology is represented by a statement formed with the SUO-KIF predicate ontologyNamespace.- Parameters:
kb- The KB in which ontologyNamespace statements will be soughtontology- The name of the ontology that will be checked- Returns:
- An ArrayList of SUO-KIF terms that denote namespaces and occur in statements formed with the predicate ontologyNamespace
-
getNamespaceDelimiters
Returns a List of all Strings used as namespace delimiters in terms defined or referred to in ontology, as specified by statements formed with the SUO-KIF predicate docGenNamespaceDelimiter.- Parameters:
kb- The KB that will be checked to find statements formed with docGenNamespaceDelimiterontology- The name of the ontology that will be checked- Returns:
- An ArrayList of tokens (Strings) that are used as delimiters between a qualified term name and the namespace prefix that qualifies the term
-
getNamespacePrefixes
Returns an ArrayList of all known namespace prefixes sorted by length, from longest to shortest.- Returns:
- A List of all known namespace prefixes
-
getNamespaces
Returns a List of all SUO-KIF terms that denote namespaces in any loaded KB, obtained by gathering statements formed with the predicates inNamespace and ontologyNamespace as well as explicit instance statements.- Returns:
- A List of all known SUO-KIF terms that denote namespaces
-
getNamespaces
Returns a List of all SUO-KIF terms denoting namespaces in kb or in ontology, using the predicates inNamespace and ontologyNamespace.- Parameters:
kb- The KB in which statements will be checkedontology- The name of the ontology that will be checkedforce- If true, this parameter will force the List of namespaces to be recomputed- Returns:
- A List of all the SUO-KIF terms that denote namespaces and occur in statements formed with inNamespace or ontologyNamespace
-
getNamespacePrefix
Returns the namespace prefix of term based on the namespaces known in kb, else returns the empty String if term appears to have no namespace prefix. -
stripNamespacePrefix
Returns term without its namespace prefix if it appears to have one in kb, else just returns term. -
toKifNamespace
Returns a SUO-KIF term denoting a namespace.- Parameters:
kb- The KB in which to determine if term is an namespaceterm- A String denoting a namespace, perhaps in W3C format- Returns:
- String A term denoting a namespace in SUO-KIF format, else just returns the input term if no syntactic transformation is warranted
-
removeLinkableNamespacePrefixes
Removes namespace prefixes from all SUO-KIF terms to be hyperlinked in text.- Parameters:
kb- The KB is use when checking for valid namespace prefixestext- The String in which all linkable SUO-KIF terms are to be transformed- Returns:
- A String with all linkable SUO-KIF terms have had their namespace prefixes removed
-
getPredicates
Collects and returns a List of all Predicates in kb.- Parameters:
kb- The KB from which to gather all terms that are instances of BinaryPredicate- Returns:
- A List of BinaryPredicates (Strings)
-
hasSubComponents
Returns true if term has syntactic subcomponents such as XML elements or XML attributes in kb, else returns false.- Parameters:
kb- The KB in which term is definedterm- A String denoting a SUO-KIF constant name- Returns:
- true or false
-
getSubComponents
Returns a List containing those terms that are immediate syntactic subordinates of term in kb.- Parameters:
kb- The KB in which term is definedterm- A String that is a SUO-KIF constant- Returns:
- A List of Strings that denote SUO-KIF constants, or an empty List
-
getSuperComponents
Returns a List containing those terms that are immediate syntactic superiors or "containers" of term in kb.- Parameters:
kb- The KB in which term is definedterm- A String, a SUO-KIF constant- Returns:
- A List of Strings that denote SUO-KIF constants, or an empty List
-
getFirstTermFormat
Returns a String that is the first termFormat value obtained for term in kb, else returns null if no termFormat value exists.- Parameters:
kb- The KB in which term is definedterm- A String that is a SUO-KIF constantcontexts- A List of namespaces or other terms that index context-specific termFormat statements- Returns:
- A List of Strings that denote SUO-KIF constants, or an empty List
-
getContextualDocumentation
Returns the first documentation String obtained for term in kb, using the List of namespaces or other contextualizing terms in contexts.- Parameters:
kb- The KB in which term is definedterm- A String that is a SUO-KIF constantcontexts- A List of namespaces or other terms that index context-specific documentation or comment statements- Returns:
- A documentation String, or an empty String if no documentation String can be found
-
getNearestContainingClass
Returns the first containing Class that can be found for term in kb.- Parameters:
kb- The KB in which term is definedterm- A String that is a SUO-KIF constant- Returns:
- A SUO-KIF term denoting a Class, or null if no Class can be found
-
getFirstSubsumingTerm
Returns the first purely "subsuming" entity that can be found for term in kb, assuming that term denotes a Class or a Relation.- Parameters:
kb- The KB in which term is definedterm- A String that denotes a SUO-KIF Class or Relation- Returns:
- A SUO-KIF term, or null if no subsuming term can be found
-
getFirstGeneralTerm
Returns the first containing, subsuming, or superordinate entity that can be found for term in kb.- Parameters:
kb- The KB in which term is definedterm- A String that is a SUO-KIF constant- Returns:
- A SUO-KIF term, or null if no more general term can be found
-
getFirstGeneralTerms
Returns a List of the first containing, subsuming, or superordinate entities found for term in kb.- Parameters:
kb- The KB in which term is definedterm- A String that denotes a SUO-KIF term- Returns:
- A List of SUO-KIF terms, or an empty List if no generalizations of term can be found
-
getFirstSpecificTerms
Returns a List of the first instances or syntactic subordinate entities that can be found for term in kb.- Parameters:
kb- The KB in which term is definedterm- A String that denotes a SUO-KIF term- Returns:
- A List of SUO-KIF terms, or an empty List
-
getSyntacticSubordinateTerms
Returns a List of the entities that are immediate syntactic subordinates of term in kb.- Parameters:
kb- The KB in which term is definedterm- A String that denotes a SUO-KIF term- Returns:
- A List of SUO-KIF terms, or an empty List
-
getFirstInstances
Returns a List of the entities that are immediate instances of term in kb.- Parameters:
kb- The KB in which term is definedterm- A String that denotes a SUO-KIF Class- Returns:
- A List of SUO-KIF terms, or an empty List
-
getFirstContainingClass
Returns a SUO-KIF constant that denotes the first containing Class of term obtained in kb.- Parameters:
kb- The KB in which term is definedterm- A String that denotes a SUO-KIF term- Returns:
- A String that denotes a SUO-KIF Class, or null
-
getFirstSubClasses
Returns a List containing the immediate SUO-KIF subclasses of term in kb.- Parameters:
kb- The KB in which term is definedterm- A String that denotes a SUO-KIF term- Returns:
- A List of SUO-KIF Classes, or an empty List
-
createDocs
Returns a String consisting of HTML markup for a documentation String for term obtained from kb and indexed by language.- Parameters:
kb- The KB in which term is definedkbHref- A String containing the constant parts of the href link for term, or an empty Stringterm- A String that denotes a SUO-KIF termlanguage- A String denoting a SUO-KIF namespace, a natural language, or other type of entity that indexes documentation Strings in kb- Returns:
- A String containing HTML markup, or an empty String if term is supposed to be suppressed for display
-
createComments
Returns a String containing the HTML markup for the Comment field in a page displaying the definition of term in kb.- Parameters:
kb- The KB in which term is definedkbHref- A String containing the constant parts of the href link for term, or an empty Stringterm- A String that denotes a SUO-KIF termlanguage- A String denoting a SUO-KIF namespace, a natural language, or other type of entity that indexes comment Strings in kb- Returns:
- A String containing HTML markup, or an empty String if term is supposed to be suppressed for display
-
createSynonyms
Returns a String containing HTML markup for the synonym field of an HTML page displaying the definition of term in kb.- Parameters:
kb- The KB in which term is definedkbHref- A String containing the constant parts of the href link for term, or an empty Stringterm- A String that denotes a SUO-KIF term- Returns:
- A String containing HTML markup, or an empty String if term is supposed to be suppressed for display
-
createDisplayNames
Returns a String containing HTML markup for the Display Labels field of an HTML page displaying statements about term in kb.- Parameters:
kb- The KB in which term is definedkbHref- A String containing the constant parts of the href link for term, or an empty Stringterm- A String that denotes a SUO-KIF termformatToken- A String token that partly determines the format of the output- Returns:
- A String containing HTML markup, or an empty String if term is supposed to be suppressed for display
-
createHasSameComponents
Returns a String containing HTML markup for the Has Same Components As field of an HTML page displaying the definition of term in kb.- Parameters:
kb- The KB in which term is definedkbHref- A String containing the constant parts of the href link for term, or an empty Stringterm- A String that denotes a SUO-KIF termlanguage- A String denoting a SUO-KIF namespace, a natural language, or other type of entity that indexes termFormat Strings in kb- Returns:
- A String containing HTML markup, or an empty String if term is supposed to be suppressed for display
-
createUsingSameComponents
Returns a String containing HTML markup for the Composites Using Same Components field of an HTML page displaying the definition of term in kb.- Parameters:
kb- The KB in which term is definedkbHref- A String containing the constant parts of the href link for term, or an empty Stringterm- A String that denotes a SUO-KIF termlanguage- A String denoting a SUO-KIF namespace, a natural language, or other type of entity that indexes termFormat Strings in kb- Returns:
- A String containing HTML markup, or an empty String if term is supposed to be suppressed for display
-
createParents
Returns a String containing HTML markup for the Parents field of an HTML page displaying the definition of term in kb.- Parameters:
kb- The KB in which term is definedkbHref- A String containing the constant parts of the href link for term, or an empty Stringterm- A String that denotes a SUO-KIF termlanguage- A String denoting a SUO-KIF namespace, a natural language, or other type of entity that indexes termFormat Strings in kbparentsSet- A Set for accumulating the parent terms of term- Returns:
- A String containing HTML markup, or an empty String if term is supposed to be suppressed for display
-
createChildren
Returns a String containing HTML markup for the Children field of an HTML page displaying the definition of term in kb.- Parameters:
kb- The KB in which term is definedkbHref- A String containing the constant parts of the href link for term, or an empty Stringterm- A String that denotes a SUO-KIF termlanguage- A String denoting a SUO-KIF namespace, a natural language, or other type of entity that indexes termFormat Strings in kb- Returns:
- A String containing HTML markup, or an empty String if term is supposed to be suppressed for display
-
createInstances
Returns a String containing HTML markup for the Instances section of an HTML page displaying the definition of term in kb.- Parameters:
kb- The KB in which term is definedkbHref- A String containing the constant parts of the href link for term, or an empty Stringterm- A String that denotes a SUO-KIF termlanguage- A String denoting a SUO-KIF namespace, a natural language, or other type of entity that indexes termFormat Strings in kbexcluded- A List of terms to be excluded from the display- Returns:
- A String containing HTML markup, or an empty String if term is supposed to be suppressed for display
-
createFormula
protected String createFormula(KB kb, String kbHref, String indentSeq, int level, String previousTerm, String currentTerm, String context) Returns a String containing HTML markup for a SUO-KIF Formula.- Parameters:
kb- The KB in which formula occurskbHref- A String containing the constant parts of the href link for the constants in formula, or an empty StringindentSeq- A character sequence that will be used as the indentation quantum for formulalevel- The current indentation levelpreviousTerm- A String, the term that occurs sequentially before currentTerm in the same level of nesting. The value of previousTerm aids in determining how a given Formula should be formatted, and could be null.currentTerm- A String denoting a SUO-KIF Formula or part of a Formulacontext- A String denoting a SUO-KIF namespace, a natural language, or other type of entity that indexes termFormat Strings in kb- Returns:
- A String containing HTML markup, or an empty String if formula cannot be processed
-
createRelations
protected String createRelations(KB kb, String kbHref, String term, String language, String formatToken) Returns a String containing HTML markup for the Relations section of an HTML page displaying the definition of term in kb.- Parameters:
kb- The KB in which term is definedkbHref- A String containing the constant parts of the href link for term, or an empty Stringterm- A String that denotes a SUO-KIF termlanguage- A String denoting a SUO-KIF namespace, a natural language, or other type of entity that indexes termFormat Strings in kb- Returns:
- A String containing HTML markup, or an empty String if term is supposed to be suppressed for display
-
showCardinalityCell
Returns a String containing HTML markup for the Cardinality field of an HTML page displaying the definition of term in kb.- Parameters:
kb- The KB in which term is definedkbHref- A String containing the constant parts of the href link for term, or an empty Stringterm- A String that denotes a SUO-KIF termcontext- A String denoting a SUO-KIF namespace, a natural language, or other type of entity that indexes termFormat Strings in kb -- this parameter is currently ignored, since LocalInstance terms are already highly specific- Returns:
- A String containing HTML markup, or an empty String if no markup can be generated
-
createCompositeComponentLine
protected String createCompositeComponentLine(KB kb, String kbHref, String term, int indent, String language) Returns a String containing HTML markup for a single table row in the Composite Component section of an HTML page displaying the partial definition of term in kb.- Parameters:
kb- The KB in which term is definedkbHref- A String containing the constant parts of the href link for term, or an empty Stringterm- A String that denotes a SUO-KIF termindent- A int value that determines the depth to which term will be indented when displayedlanguage- A String denoting a SUO-KIF namespace, a natural language, or other type of entity that indexes termFormat Strings in kb- Returns:
- A String containing HTML markup, or an empty String if term is supposed to be suppressed for display
-
showTermName
Returns the termFormat entry for term in kb and language, otherwise returns the termFormat entry for term in English, otherwise just returns the term name.- Parameters:
kb- The KB in which term is definedterm- A String that denotes a SUO-KIF termlanguage- A String denoting a SUO-KIF namespace, a natural language, or another type of entity that contextualizes or indexes termFormat Strings in kb- Returns:
- A String providing a context-specific name for term, possibly including HTML markup, or just term if no context-specific form can be found or produced
-
formatCompositeHierarchy
Returns a String containing HTML markup for a hierarchy or tree display of terms that denote nested composite components.- Parameters:
kb- The KB in which term is definedkbHref- A String containing the constant parts of the href link for term, or an empty Stringhier- A List containing term names and representing one sub-branch in a treelanguage- A String denoting a SUO-KIF namespace, a natural language, or other type of entity that indexes termFormat Strings in kb- Returns:
- A String containing HTML markup, or an empty String if no markup can be generated
-
createCompositeRecurse
Recursively computes and then returns a List that constitutes the graph containing those XML elements and attributes syntactically subordinate to term in kb.- Parameters:
kb- The KB in which term is definedterm- A String that denotes a SUO-KIF termisAttribute- If true, this parameter indicates that term denotes an XML attributeindent- An integer indicating the depth or level to which term should be indented when displayed- Returns:
- A List containing two Lists, the first of which is a List of terms that denote XML attributes, and the second of which is a list of terms that denote XML elements
-
isXmlAttribute
Returns a List that constitutes the graph containing those XML elements and attributes syntactically subordinate to term in kb.- Parameters:
kb- The KB in which term is definedterm- A String that denotes a SUO-KIF term- Returns:
- A String containing HTML markup, or an empty String if no markup can be generated
-
createContainingCompositeComponentLine
protected String createContainingCompositeComponentLine(KB kb, String kbHref, String containingComp, String instance, int indent, String language) Returns a String containing HTML markup for a row displaying a contained component in an HTML page displaying the partial definition of instance in kb.- Parameters:
kb- The KB in which term is definedkbHref- A String containing the constant parts of the href link for term, or an empty StringcontainingComp- A String that denotes the term that contains, or is syntactically superordinate to, instanceinstance- A String that denotes a SUO-KIF termindent- An int value that determines the depth to which instance will be indented when displayedlanguage- A String denoting a SUO-KIF namespace, a natural language, or other type of entity that indexes termFormat Strings in kb- Returns:
- A String containing HTML markup, or an empty String if no markup can be generated
-
formatContainingComposites
protected String formatContainingComposites(KB kb, String kbHref, List containing, String composite, String language) Given the SUO-KIF statements: (hasXmlElement PartyDescriptor LocalInstance_2_459) (datatype LocalInstance_2_459 PartyId) (documentation LocalInstance_2_459 PartyDescriptor "A Composite containing details...") show PartyDescriptor as one of the "containing composites" of PartyId, and show the documentation for the instance node next to the parent composite. -
isSkipNode
Returns true if term should be skipped over during printing, else returns false. -
getContainingComposites
Travels up the HasXmlElement and HasXmlAttribute relation hierarchies to collect all parents, and returns them in an ArrayList.- Returns:
- An ArrayList of terms, which could be empty
-
createBelongsToClass
protected String createBelongsToClass(KB kb, String kbHref, String term, String language, Set<String> parents) Returns a String containing HTML markup for the Belongs to Class section of an HTML page displaying the partial definition of term in kb.- Parameters:
kb- The KB in which term is definedkbHref- A String containing the constant parts of the href link for term, or an empty Stringterm- A String that denotes a SUO-KIF termlanguage- A String denoting a SUO-KIF namespace, a natural language, or other type of entity that indexes termFormat Strings in kbparents- A Set containing the terms displayed in the Parent field for term, to avoid duplication between the Parents field and the Belongs to Class field- Returns:
- A String containing HTML markup, or an empty String if no markup can be generated
-
createBelongsToClass
Returns a String containing HTML markup for the Belongs to Class section of an HTML page displaying the partial definition of term in kb.- Parameters:
kb- The KB in which term is definedkbHref- A String containing the constant parts of the href link for term, or an empty Stringterm- A String that denotes a SUO-KIF termlanguage- A String denoting a SUO-KIF namespace, a natural language, or other type of entity that indexes termFormat Strings in kb- Returns:
- A String containing HTML markup, or an empty String if no markup can be generated
-
findContainingComposites
Returns an ArrayList holding the composite entities (Elements) that contain term, or returns an empty ArrayList.- Parameters:
kb- The KB in which term is definedterm- A String that denotes a SUO-KIF term- Returns:
- An ArrayList containing the names of the Elements that contain term.
-
createAllStatements
Create an HTML page that lists information about a particular term, with a limit on how many statements of each type should be displayed. -
generateDynamicTOCHeader
Generate an alphabetic HTML list that points to the individual index pages (which collect all terms starting with a particular letter. -
generateTocHeader
protected String generateTocHeader(KB kb, Map<String, Map<String, List<String>>> alphaList, String allname) Generate an alphabetic HTML list that points to the individual index pages (which collect all terms or term formats) starting with a particular letter.- Parameters:
alphaList- a TreeMap of TreeMaps of ArrayLists. @see createAlphaList()
-
generateTOCPage
protected String generateTOCPage(KB kb, String firstLetter, Map<String, Map<String, List<String>>> alphaList, String language) Generate an HTML page that lists term name and its documentation- Parameters:
alphaList- a TreeMap of TreeMaps of ArrayLists. @see createAlphaList()
-
saveIndexPages
protected void saveIndexPages(KB kb, Map<String, Map<String, List<String>>> alphaList, String dir, String language) Generate and save all the index pages that link to the individual term pages.- Parameters:
alphaList- a TreeMap of TreeMaps of ArrayLists. @see createAlphaList()dir- is the directory in which to save the pages
-
printHTMLPages
Save pages below the KBs directory in a directory called HTML. If that already exists, use HTML1, HTML2 etc. -
makeOutputDir
Creates a subdirectory of SIGMA_HOME/files/, in which output files of the type specified by token are saved. token is also used, along with the value returned by this.getKB() and the current date, to create the directory name. Returns a File object representing the canonical pathname of the directory.- Parameters:
token- A token that indicates a type of output file- Returns:
- A File representing a directory
-
generateHTMLPages
protected Map<String,String> generateHTMLPages(KB kb, Map<String, Map<String, List<String>>> alphaList, String language, String formatToken) - Parameters:
alphaList- a TreeMap of TreeMaps of ArrayLists. @see createAlphaList()
-
generateHTML
Generate simplified HTML pages for all terms. Output is a set of HTML files sent to the directory specified in makeOutputDir()- Parameters:
simplified- Indicates whether to present a "simplified" view of terms, meaning using a termFormat or headword, rather than the term name itself
-
generateSingleHTML
public void generateSingleHTML(KB kb, String dir, Map<String, Map<String, List<String>>> alphaList, String language, boolean simplified) Generate a single HTML page showing all terms.- Parameters:
alphaList- a TreeMap of TreeMaps of ArrayLists. letter-> formattedTerm1->term11,term12...term1N formattedTerm2->term21,term22...term2Nsimplified- Indicates whether to present a "simplified" view of terms, meaning using a termFormat or headword, rather than the term name itself
-
generateSingleHTML
- Throws:
IOException
-
getSubordinateAttributes
Returns a List containing the subordinate XmlAttributes of kifTerm, else return an empty List. -
getSubordinateElements
Returns a List containing the subordinate XmlElements of kifTerm, else return an empty List. -
getSyntacticExtensionTerms
-
getSyntacticUnionTerms
-
getSyntacticCompositeTerms
-
getClosestXmlDataType
-
isInstanceOf
Returns true if i is an instance of c, else returns false.- Parameters:
kb- A KB objecti- A String denoting an instancec- A String denoting a Class- Returns:
- true or false
-
getFirstDatatype
-
getDatatypeTerms
-
isDataType
-
getTermPresentationName
-
getTermPresentationName
-
getTermPresentationName
-
sortByPresentationName
Sorts stringList in place by the presentation name of each its terms, which could be very different from the raw term name.- Parameters:
kb- The KB from which to obtain the presentation namesnamespaceTerm- A KIF term denoting a namespacestringList- The List of Strings to be sorted
-
sortByTermLength
Sorts the List terms by the length of the Strings it contains, from longest to shortest. -
getTermNamespace
-
processDocString
protected String processDocString(KB kb, String kbHref, String namespace, String docString, boolean isXmlDoc, boolean addHrefs) - Parameters:
isXmlDoc- If true, HTML character entities will be replaced with their ASCII equivalents, when possibleaddHrefs- If true, HTML anchor markup will be added for recognized terms
-
writeToStream
Writes a List of Strings to an OutputStream.- Parameters:
data- A List of String objectsstream- An OutputSteam object
-
emptyString
-
isNonEmptyString
-
readSpreadsheetFile
-
readSpreadsheetFile
public List<List<String>> readSpreadsheetFile(String inpath, char delimiter, int delimitersPerRow, List<String> rowFlags) Parses a file of delimited fields into an ArrayList of ArrayLists. If rowFlags contains any Strings, the method concatenates sequential lines that do not start with one of the Strings, else rowFlags is ignored.- Parameters:
delimiter- A char that delimits each field in a rowdelimitersPerRow- An int that indicates the number of expected delimiter chars per rowrowFlags- A List of the tokens (Strings) that indicate the start of a new row- Returns:
- An ArrayList of ArrayLists
-
convertRowStringsToLists
Converts a List of char-delimited Strings to a List of Lists (i.e., an array) representing a spreadsheet.- Parameters:
rows- A List of char-delimited Strings. The list is processed in place, and will contain only Lists when processing is finished.delimiter- A char that delimits each field in line.- Returns:
- void
-
countDelimiters
Counts the number of field delimiters in line and returns the count, ignoring delimiters that are inside Strings.- Parameters:
line- A line of data fields that are separated by occurrences of a delimiter char.delimiter- A char that delimits each field in line.- Returns:
- An int indicating the number of delimiters in line.
-
main
-