Class SparqlBuilderUtils
java.lang.Object
org.eclipse.rdf4j.sparqlbuilder.util.SparqlBuilderUtils
Utility functions for the SparqlBuilder
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidappendAndNewlineIfPresent(Optional<? extends QueryElement> elementOptional, StringBuilder builder) static voidappendQueryElementIfPresent(Optional<? extends QueryElement> queryElementOptional, StringBuilder builder, String prefix, String suffix) static voidappendStringIfPresent(Optional<String> stringOptional, StringBuilder builder, String prefix, String suffix) static StringgetBracedString(String contents) static StringgetBracketedString(String contents) private static StringgetEnclosedString(String open, String close, String contents) private static StringgetEnclosedString(String open, String close, String contents, boolean pad) static StringgetEscapedString(String value) Escape the specified String value according to the SPARQL 1.1 Spec https://www.w3.org/TR/2013/REC-sparql11-query-20130321/#grammarEscapesstatic StringgetLongQuotedString(String contents) For string literals that contain single- or double-quotesstatic <O> Optional<O> getOrCreateAndModifyOptional(Optional<O> optional, Supplier<O> getter, UnaryOperator<O> operator) static StringgetParenthesizedString(String contents) static StringgetQuotedString(String contents)
-
Field Details
-
PAD
- See Also:
-
-
Constructor Details
-
SparqlBuilderUtils
public SparqlBuilderUtils()
-
-
Method Details
-
getOrCreateAndModifyOptional
public static <O> Optional<O> getOrCreateAndModifyOptional(Optional<O> optional, Supplier<O> getter, UnaryOperator<O> operator) -
appendAndNewlineIfPresent
public static void appendAndNewlineIfPresent(Optional<? extends QueryElement> elementOptional, StringBuilder builder) -
appendQueryElementIfPresent
public static void appendQueryElementIfPresent(Optional<? extends QueryElement> queryElementOptional, StringBuilder builder, String prefix, String suffix) -
appendStringIfPresent
public static void appendStringIfPresent(Optional<String> stringOptional, StringBuilder builder, String prefix, String suffix) -
getBracedString
-
getBracketedString
-
getParenthesizedString
-
getQuotedString
-
getLongQuotedString
-
getEnclosedString
-
getEnclosedString
-
getEscapedString
Escape the specified String value according to the SPARQL 1.1 Spec https://www.w3.org/TR/2013/REC-sparql11-query-20130321/#grammarEscapesNote that there is no special handling for Codepoint escape sequences as described by https://www.w3.org/TR/2013/REC-sparql11-query-20130321/#codepointEscape
- Parameters:
value- The String to escape- Returns:
- the escaped String
-