Package org.eclipse.rdf4j.queryrender
Class RenderUtils
java.lang.Object
org.eclipse.rdf4j.queryrender.RenderUtils
Utility methods for rendering (parts of) SPARQL query strings.
- Author:
- Michael Grove
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
Properly escape out any special characters in the query string.static String
Return the SPARQL query string rendering of theValue
static StringBuilder
toSPARQL
(Value value, StringBuilder builder) Append the SPARQL query string rendering of theValue
to the suppliedStringBuilder
.
-
Method Details
-
toSPARQL
Return the SPARQL query string rendering of theValue
- Parameters:
theValue
- the value to render- Returns:
- the value rendered in its SPARQL query string representation
-
toSPARQL
Append the SPARQL query string rendering of theValue
to the suppliedStringBuilder
.- Parameters:
value
- the value to renderbuilder
- theStringBuilder
to append to- Returns:
- the original
StringBuilder
with the value appended.
-
escape
Properly escape out any special characters in the query string. Replaces unescaped double quotes with \" and replaces slashes '\' which are not a valid escape sequence such as \t or \n with a double slash '\\' so they are unescaped correctly by a SPARQL parser.- Parameters:
theString
- the query string to escape chars in- Returns:
- the escaped query string
-