Class SparqlQueryUtils
- java.lang.Object
-
- edu.cornell.mannlib.vitro.webapp.utils.sparql.SparqlQueryUtils
-
public class SparqlQueryUtils extends Object
Some utility methods that help when dealing with SPARQL queries.
-
-
Field Summary
Fields Modifier and Type Field Description static List<org.apache.jena.query.Syntax>SUPPORTED_SYNTAXESA list of SPARQL syntaxes to try when parsing queries
-
Constructor Summary
Constructors Constructor Description SparqlQueryUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.apache.jena.query.Querycreate(String queryString)A convenience method to attempt parsing a query string with various syntaxesstatic StringescapeForRegex(String raw)Escape any regex special characters in the string.
-
-
-
Field Detail
-
SUPPORTED_SYNTAXES
public static final List<org.apache.jena.query.Syntax> SUPPORTED_SYNTAXES
A list of SPARQL syntaxes to try when parsing queries
-
-
Method Detail
-
escapeForRegex
public static String escapeForRegex(String raw)
Escape any regex special characters in the string. Note that the SPARQL parser requires two backslashes, in order to pass a single backslash to the REGEX function. Also escape a single quote ('), but only with a single backslash, since this one is for the SPARQL parser itself (single quote is not a special character to REGEX).
-
create
public static org.apache.jena.query.Query create(String queryString)
A convenience method to attempt parsing a query string with various syntaxes- Parameters:
queryString- Query String- Returns:
- Query
-
-