org.tm4j.topicmap.utils.extractors .TopicNameExtractor

Description

An extractor function which takes a Topic as input and returns a String as output. The string returned will be one of the base name strings for the input Topic. This function provides a number of configuration options for controlling the selection and transformation of the returned string.

The base name returned is selected as follows:

  1. First the BaseName which has the most preferred themes in its scope is selected. If there is a tie, then an arbitrary selection is made.
  2. If the BaseName has some variants and the list of preferred variant parameters is not empty, then the variant name that has the most preferred parameters and has a resourceData (string) value rather than a resourceRef (Locator) value is selected. In the case of a tie, an arbitrary selection is made.
  3. If no item is selected by the above two steps, the string "[no name]" is returned.
  4. If step (2) above selected a Variant, then the data value of the Variant's VariantName is returned.
  5. If step(2) does not select a Variant but step (1) selected a BaseName, then the BaseName's baseNameString value is returned.

Prior to being returned, the string value may be folded to lower case and/or have special XML characters escaped.

Inheritance Hierarchy

Method Summary
java.lang.Object _extract(java.lang.Object in)
void addPreferredTheme(org.tm4j.topicmap.Topic theme)
Adds a Topic to the list of scope themes that are preferred for the returned name string.
void addPreferredVariant(org.tm4j.topicmap.Topic v)
Adds a Topic to the list of variant parameters that are preferred for the returned name string.
void clearPreferredThemes()
Clears the set of scope themes that are preferred for the returned name string.
void clearPreferredVariants()
Clears the set of variant parameters that are preferred for the returned name string.
java.lang.Object fn(java.lang.Object in,java.lang.Object arg)
void removePreferredVariant(org.tm4j.topicmap.Topic v)
Removes a Topic from the list of variant parameters that are preferred for the returned name string.
void setCaseFolding(boolean foldCase)
Sets the case-folding flag.
void setXmlEscaping(boolean xmlEscape)
Sets the XML escaping flag.