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 ofSelectQueryResultWriter
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 class
TextTableQueryResultWriter.TextTableQueryResultWriterFactory
-
Field Summary
Fields Modifier and Type Field Description static QueryResultFormat
FORMAT
The format to identify this writer with name "TEXT", mime type "text/plain" and file extension "txt".
-
Constructor Summary
Constructors Constructor Description TextTableQueryResultWriter(java.io.OutputStream theOut, Options theOptions)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.brsanthu.dataexporter.DataExporter
createExporter()
Creates the exporter and sets its optionsvoid
end()
Signal that query processing has completedlong
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
-
-
-
-
Field Detail
-
FORMAT
public static final QueryResultFormat FORMAT
The format to identify this writer with name "TEXT", mime type "text/plain" and file extension "txt".
-
-
Constructor Detail
-
TextTableQueryResultWriter
public TextTableQueryResultWriter(java.io.OutputStream theOut, @Nonnull Options theOptions)
-
-
Method Detail
-
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 interfaceQueryResultHandler<BindingSet>
- Specified by:
end
in interfaceQueryResultWriter<BindingSet>
- Overrides:
end
in classAbstractDataExporterQueryResultWriter
-
createExporter
protected com.brsanthu.dataexporter.DataExporter createExporter()
Creates the exporter and sets its options- Specified by:
createExporter
in classAbstractDataExporterQueryResultWriter
- Returns:
- a DataExporter object
-
-