org.eclipse.rdf4j.workbench.util

## Class TupleResultBuilder

- java.lang.Object
- - org.eclipse.rdf4j.workbench.util.TupleResultBuilder

-     public class TupleResultBuilder
      extends Object

  A small wrapper around `QueryResultWriter` to make it easier to generate results in servlets.
  Author:
    peter

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TupleResultBuilder(QueryResultWriter writer, ValueFactory valueFactory)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `TupleResultBuilder` | `bool(boolean result)`
    `TupleResultBuilder` | `end()` This must be called if `start(String...)` is used, after all results are generated using either `namedResult(String, Object)` or `result(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 calling `namedResult(String, Object)` or `result(Object...)`.
    `TupleResultBuilder` | `startBoolean()`
    `TupleResultBuilder` | `transform(String path, String xsl)`
    `TupleResultBuilder` | `variables(String... names)`

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

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

- - ### 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 calling `namedResult(String, Object)` or `result(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 names
        `result` - 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 if `start(String...)` is used, after all results are generated using either `namedResult(String, Object)` or `result(Object...)`.

      This must not be called if `bool(boolean)` or `endBoolean()` have been called.

      Returns:
        This object, for chaining with other calls.
      Throws:
        `QueryResultHandlerException`

    - #### endBoolean

          public TupleResultBuilder endBoolean()

    - #### flush

          public void flush()

Copyright © 2015-2021 Eclipse Foundation. All Rights Reserved.