Class RewriterConfig

java.lang.Object
de.wwu.scdh.annotation.selection.RewriterConfig

public class RewriterConfig extends Object
A record for configuration parameters of a Rewriter. The parameters are documented in the constructor.
  • Constructor Details

    • RewriterConfig

      public RewriterConfig(Mode mode, boolean escaped, String xpath, boolean rewritesTraceLeaf, boolean removeEmptyNamespaces)
      Make a new RewriterConfig.
      Parameters:
      mode - a Mode used to cope with referential ambiguity
      escaped - whether the output has to be escaped for XML
      xpath - an XPath expression which will be evaluated on the context node for normalization
      rewritesTraceLeaf - - whether a Q{http://wwu.de/scdh/selection-engine/node-tracing}text segment has to be rewritten with text()
      removeEmptyNamespaces - - whether a Q{} in a path expression (XPath segment) is to be removed.
    • RewriterConfig

      public RewriterConfig(Mode mode, boolean escaped, String xpath, boolean rewritesTraceLeaf, boolean removeEmptyNamespaces, Map<Class<? extends Point>,Class<? extends Point>> pointClassMap, boolean writeBackErrorMessages)
      Make a new RewriterConfig.
      Parameters:
      mode - a Mode used to cope with referential ambiguity
      escaped - whether the output has to be escaped for XML
      xpath - an XPath expression which will be evaluated on the context node for normalization
      rewritesTraceLeaf - - whether a Q{http://wwu.de/scdh/selection-engine/node-tracing}text segment has to be rewritten with text()
      removeEmptyNamespaces - - whether a Q{} in a path expression (XPath segment) is to be removed.
      pointClassMap - - a mapping of point classes for requesting replacement of point classes (key) in the output by different point classes (value). See static methods of RewriterConfig for conveniently getting such mappings.
  • Method Details

    • withMode

      public static RewriterConfig withMode(RewriterConfig config, Mode mode)
      Clone the RewriterConfig, but set a new Mode.
    • getMode

      public Mode getMode()
    • getEscaped

      public boolean getEscaped()
    • getXPath

      public String getXPath()
    • rewritesTraceLeaf

      public boolean rewritesTraceLeaf()
    • removeEmptyNamespaces

      public boolean removeEmptyNamespaces()
    • getPointClassMap

      public Map<Class<? extends Point>,Class<? extends Point>> getPointClassMap()
      Gets the mapping of given point types to requested point types in the output.
    • forwardDOMToTextPointClassMap

      public static Map<Class<? extends Point>,Class<? extends Point>> forwardDOMToTextPointClassMap()
      Returns mapping of point classes suitable for forwarding XML to plain text selectors.
      Returns:
      a mapping of point classes.
    • backwardDOMToTextPointClassMap

      public static Map<Class<? extends Point>,Class<? extends Point>> backwardDOMToTextPointClassMap()
      Returns mapping of point classes suitable for forwarding XML to plain text selectors.
      Returns:
      a mapping of point classes.
    • getPointClassMapForXslt

      public static Map<Class<? extends Point>,Class<? extends Point>> getPointClassMapForXslt(ResourceBuilder.OutputMethod method, Rewriter.Direction direction)
      Returns a mapping of point classes for an XSLT output method and a pointer rewriting direction.
      Parameters:
      method - - a valid method string as defined in OutputKeys.METHOD.
      direction - - either "forward" or "backward"
      Returns:
      a mapping of point classes
    • writesBackErrorMessages

      public boolean writesBackErrorMessages()
      Whether error messages should be written back to the model when a rewriting error occurs.