Package com.complexible.common.rdf.query.resultio

# Class TextTableQueryResultWriter

java.lang.Object
com.complexible.common.rdf.query.resultio.AbstractDataExporterQueryResultWriter
com.complexible.common.rdf.query.resultio.TextTableQueryResultWriter

All Implemented Interfaces:
  `QueryResultWriter<BindingSet>`, `SelectQueryResultWriter`, `QueryResultHandler<BindingSet>`, `SelectQueryResultHandler`

Direct Known Subclasses:
  `TextPathQueryResultWriter`, `TextTablePathQueryResultWriter`

public class TextTableQueryResultWriter extends AbstractDataExporterQueryResultWriter
Implementation of `SelectQueryResultWriter` interface to output a nice looking text table with many customization options. The column widths can be calculated by prefetching a specified amount of results with the possibility of specifying minimum and maximum widths to override automatically calculated values. Any value that overflows the column will be printed on multiple lines where the other values in the same row will be top-aligned.

Author:
  Evren Sirin

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static final class`
  `TextTableQueryResultWriter.TextTableQueryResultWriterFactory`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final QueryResultFormat`
  `FORMAT`
  The format to identify this writer with name "TEXT", mime type "text/plain" and file extension "txt".

  ### Fields inherited from class com.complexible.common.rdf.query.resultio.AbstractDataExporterQueryResultWriter

  `mColCount, mColumns, mExporter, mOut, mResult`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TextTableQueryResultWriter(OutputStream theOut, Options theOptions)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `protected com.brsanthu.dataexporter.DataExporter`
  `createExporter()`
  Creates the exporter and sets its options
  `void`
  `end()`
  Signal that query processing has completed
  `long`
  `getStartTime()`
  Gets the current start time that will be used to display query execution time if summary is shown at the end.
  `boolean`
  `isShowSummary()`
  Returns true if the number of results and query execution time will be shown at the end.
  `void`
  `setShowSummary(boolean mShowSummary)`
  Turns on showing query summary at the end of results which includes the number of results and query execution time.
  `void`
  `setStartTime(long theStartTime)`
  Sets the current start time that will be used to display query execution time if summary is shown at the end.

  ### Methods inherited from class com.complexible.common.rdf.query.resultio.AbstractDataExporterQueryResultWriter

  `addNamespaces, format, handle, links, namespace, start, variables`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### FORMAT

    public static final QueryResultFormat FORMAT
    The format to identify this writer with name "TEXT", mime type "text/plain" and file extension "txt".

- ## Constructor Details

  - ### TextTableQueryResultWriter

    public TextTableQueryResultWriter(OutputStream theOut, @Nonnull Options theOptions)

- ## Method Details

  - ### isShowSummary

    public boolean isShowSummary()
    Returns true if the number of results and query execution time will be shown at the end.
    Returns:
      a boolean indicating if the number of results will be shown

  - ### setShowSummary

    public void setShowSummary(boolean mShowSummary)
    Turns on showing query summary at the end of results which includes the number of results and query execution time.
    Parameters:
      `mShowSummary` - A boolean indicating if the number of results and query execution time should be displayed

  - ### getStartTime

    public long getStartTime()
    Gets the current start time that will be used to display query execution time if summary is shown at the end.
    Returns:
      the start time for query execution

  - ### setStartTime

    public void setStartTime(long theStartTime)
    Sets the current start time that will be used to display query execution time if summary is shown at the end.
    Parameters:
      `theStartTime` - the current start time of the query execution in the summary.

  - ### end

    public void end()
    Signal that query processing has completed
    Specified by:
      `end` in interface `QueryResultHandler<BindingSet>`
    Specified by:
      `end` in interface `QueryResultWriter<BindingSet>`
    Overrides:
      `end` in class `AbstractDataExporterQueryResultWriter`

  - ### createExporter

    protected com.brsanthu.dataexporter.DataExporter createExporter()
    Creates the exporter and sets its options
    Specified by:
      `createExporter` in class `AbstractDataExporterQueryResultWriter`
    Returns:
      a DataExporter object