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
  • 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