Package org.eclipse.rdf4j.repository.sparql.query

## Class QueryStringUtil

- java.lang.Object
- - org.eclipse.rdf4j.repository.sparql.query.QueryStringUtil

-     public class QueryStringUtil
      extends Object

  Utility class to perfom query string manipulations as used in `SPARQLTupleQuery`, `SPARQLGraphQuery` and `SPARQLBooleanQuery`.
  Author:
    Andreas Schwarte
  See Also:
    `SPARQLTupleQuery`, `SPARQLGraphQuery`, `SPARQLBooleanQuery`

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `QueryStringUtil()` |

  - ### Method Summary

    All Methods Static Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static StringBuilder` | `appendValueAsString​(StringBuilder sb, Value value)` | Converts a value to its SPARQL string representation and appends it to a StringBuilder.
    `static String` | `getBooleanQueryString​(String queryString, BindingSet bindings)` | Retrieve a modified queryString into which all bindings of the given argument are replaced with their value.
    `static String` | `getGraphQueryString​(String queryString, BindingSet bindings)` | Retrieve a modified queryString into which all bindings of the given argument are replaced with their value.
    `static String` | `getQueryString​(String queryString, BindingSet bindings)` | Deprecated. since 2.0.use `getTupleQueryString(String, BindingSet)`
    `static String` | `getTupleQueryString​(String queryString, BindingSet bindings)` | Retrieve a modified queryString into which all bindings of the given argument are replaced, with the binding names included in the SELECT clause.
    `static String` | `getUpdateString​(String queryString, BindingSet bindings)` | Retrieve a modified queryString into which all bindings of the given argument are replaced with their value.
    `static String` | `valueToString​(Value value)` | Converts a value to its SPARQL string representation.

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

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

- - ### Constructor Detail

    - #### QueryStringUtil

          public QueryStringUtil()

  - ### Method Detail

    - #### getQueryString

          @Deprecated
          public static String getQueryString​(String queryString,
                                              BindingSet bindings)

      Deprecated.
      since 2.0.use `getTupleQueryString(String, BindingSet)`
      Retrieve a modified queryString into which all bindings of the given argument are replaced.
      Parameters:
        `queryString` -
        `bindings` -
      Returns:
        the modified queryString

    - #### getTupleQueryString

          public static String getTupleQueryString​(String queryString,
                                                   BindingSet bindings)

      Retrieve a modified queryString into which all bindings of the given argument are replaced, with the binding names included in the SELECT clause.
      Parameters:
        `queryString` -
        `bindings` -
      Returns:
        the modified queryString

    - #### getUpdateString

          public static String getUpdateString​(String queryString,
                                               BindingSet bindings)

      Retrieve a modified queryString into which all bindings of the given argument are replaced with their value.
      Parameters:
        `queryString` -
        `bindings` -
      Returns:
        the modified queryString

    - #### getBooleanQueryString

          public static String getBooleanQueryString​(String queryString,
                                                     BindingSet bindings)

      Retrieve a modified queryString into which all bindings of the given argument are replaced with their value.
      Parameters:
        `queryString` -
        `bindings` -
      Returns:
        the modified queryString

    - #### getGraphQueryString

          public static String getGraphQueryString​(String queryString,
                                                   BindingSet bindings)

      Retrieve a modified queryString into which all bindings of the given argument are replaced with their value.
      Parameters:
        `queryString` -
        `bindings` -
      Returns:
        the modified queryString

    - #### valueToString

          public static String valueToString​(Value value)

      Converts a value to its SPARQL string representation. Null will be converted to UNDEF (may be used in VALUES only).
      Parameters:
        `value` - the value to convert
      Returns:
        the converted value as a string

    - #### appendValueAsString

          public static StringBuilder appendValueAsString​(StringBuilder sb,
                                                          Value value)

      Converts a value to its SPARQL string representation and appends it to a StringBuilder. Null will be converted to UNDEF (may be used in VALUES only).
      Parameters:
        `sb` - StringBuilder to append to
        `value` - the value to convert
      Returns:
        the provided StringBuilder