Class SparqlQueryUtils


  • public class SparqlQueryUtils
    extends Object
    Some utility methods that help when dealing with SPARQL queries.
    • 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
    • Constructor Detail

      • SparqlQueryUtils

        public SparqlQueryUtils()
    • 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