Class SPARQLQueries
java.lang.Object
org.eclipse.rdf4j.query.parser.sparql.SPARQLQueries
Utility functions for working with SPARQL query strings.
- Author:
 - Jeen Broekstra
 
- 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionstatic StringEscape the supplied string with backslashes for any special characters, so it can be used as a string literal value in a SPARQL query.static StringgetPrefixClauses(Iterable<Namespace> namespaces) Creates a string representing of the suppliednamespacesas SPARQL prefix declarations.static StringUn-escapes a backslash-escaped SPARQL literal value string. 
- 
Constructor Details
- 
SPARQLQueries
public SPARQLQueries() 
 - 
 - 
Method Details
- 
getPrefixClauses
Creates a string representing of the suppliednamespacesas SPARQL prefix declarations. This can be used when composing a SPARQL query string in code, for example:String query = SPARQLQueries.getPrefixClauses(connection.getNamespaces()) + "SELECT * WHERE { ?s ex:myprop ?o }";- Parameters:
 namespaces- one or moreNamespaceobjects.- Returns:
 - one or more SPARQL prefix declarations (each separated by a newline), as a String.
 - Since:
 - 3.6.0
 
 - 
escape
 - 
unescape
Un-escapes a backslash-escaped SPARQL literal value string. Any recognized \-escape sequences are substituted with their un-escaped value.- Parameters:
 s- An SPARQL literal string with backslash escapes.- Returns:
 - The un-escaped string.
 - Throws:
 IllegalArgumentException- If the supplied string is not a correctly escaped SPARQL string.- Since:
 - 3.6.0
 - See Also:
 
 
 -