Package org.eclipse.rdf4j.workbench.util
Class TupleResultBuilder
- java.lang.Object
-
- org.eclipse.rdf4j.workbench.util.TupleResultBuilder
-
public class TupleResultBuilder extends Object
A small wrapper aroundQueryResultWriter
to make it easier to generate results in servlets.- Author:
- peter
-
-
Constructor Summary
Constructors Constructor Description TupleResultBuilder(QueryResultWriter writer, ValueFactory valueFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TupleResultBuilder
bool(boolean result)
TupleResultBuilder
end()
This must be called ifstart(String...)
is used, after all results are generated using eithernamedResult(String, Object)
orresult(Object...)
.TupleResultBuilder
endBoolean()
void
flush()
TupleResultBuilder
link(List<String> url)
TupleResultBuilder
namedResult(String name, Object result)
start(String...)
must be called before using this method.void
prefix(String prefix, String namespace)
TupleResultBuilder
result(Object... result)
start(String...)
must be called before using this method.TupleResultBuilder
start(String... variables)
This must be called before callingnamedResult(String, Object)
orresult(Object...)
.TupleResultBuilder
startBoolean()
TupleResultBuilder
transform(String path, String xsl)
TupleResultBuilder
variables(String... names)
-
-
-
Constructor Detail
-
TupleResultBuilder
public TupleResultBuilder(QueryResultWriter writer, ValueFactory valueFactory)
-
-
Method Detail
-
prefix
public void prefix(String prefix, String namespace) throws QueryResultHandlerException
- Throws:
QueryResultHandlerException
-
transform
public TupleResultBuilder transform(String path, String xsl) throws QueryResultHandlerException
- Throws:
QueryResultHandlerException
-
start
public TupleResultBuilder start(String... variables) throws QueryResultHandlerException
This must be called before callingnamedResult(String, Object)
orresult(Object...)
.- Parameters:
variables
- one or more variable names- Returns:
- this builder, for the convenience of chaining calls
- Throws:
QueryResultHandlerException
-
startBoolean
public TupleResultBuilder startBoolean()
-
variables
public TupleResultBuilder variables(String... names) throws QueryResultHandlerException
- Throws:
QueryResultHandlerException
-
link
public TupleResultBuilder link(List<String> url) throws QueryResultHandlerException
- Throws:
QueryResultHandlerException
-
bool
public TupleResultBuilder bool(boolean result) throws QueryResultHandlerException
- Throws:
QueryResultHandlerException
-
result
public TupleResultBuilder result(Object... result) throws QueryResultHandlerException
start(String...)
must be called before using this method.- Parameters:
result
- a single result, one value for each variable, in the same order as the variable names were provided- Returns:
- this builder, for the convenience of chaining calls
- Throws:
QueryResultHandlerException
-
namedResult
public TupleResultBuilder namedResult(String name, Object result) throws QueryResultHandlerException
start(String...)
must be called before using this method.- Parameters:
name
- the variable name, from the set of provided variable namesresult
- the result value associated with the given variable name- Returns:
- this builder, for the convenience of chaining calls
- Throws:
QueryResultHandlerException
-
end
public TupleResultBuilder end() throws QueryResultHandlerException
This must be called ifstart(String...)
is used, after all results are generated using eithernamedResult(String, Object)
orresult(Object...)
.This must not be called if
bool(boolean)
orendBoolean()
have been called.- Returns:
- This object, for chaining with other calls.
- Throws:
QueryResultHandlerException
-
endBoolean
public TupleResultBuilder endBoolean()
-
flush
public void flush()
-
-