Class SPARQLSubstitutions


  • public class SPARQLSubstitutions
    extends Object
    Collects various helper algorithms currently used by the SPARQL execution language.
    Author:
    Holger Knublauch
    • Field Detail

      • useGraphPrefixes

        public static boolean useGraphPrefixes
    • Constructor Detail

      • SPARQLSubstitutions

        public SPARQLSubstitutions()
    • Method Detail

      • addMessageVarNames

        public static void addMessageVarNames​(String labelTemplate,
                                              Set<String> results)
      • createQueryExecution

        public static org.apache.jena.query.QueryExecution createQueryExecution​(org.apache.jena.query.Query query,
                                                                                org.apache.jena.query.Dataset dataset,
                                                                                org.apache.jena.query.QuerySolution bindings)
      • substitutePaths

        public static org.apache.jena.query.Query substitutePaths​(org.apache.jena.query.Query query,
                                                                  String pathString,
                                                                  org.apache.jena.rdf.model.Model model)
      • withSubstitutions

        public static org.apache.jena.rdf.model.Literal withSubstitutions​(org.apache.jena.rdf.model.Literal template,
                                                                          org.apache.jena.query.QuerySolution bindings,
                                                                          Function<org.apache.jena.rdf.model.RDFNode,​String> labelFunction)
      • withPrefixes

        public static String withPrefixes​(String str,
                                          org.apache.jena.rdf.model.Resource executable)
        Gets a parsable SPARQL string based on a fragment and prefix declarations. Depending on the setting of the flag useGraphPrefixes, this either uses the prefixes from the Jena graph of the given executable, or strictly uses sh:prefixes.
        Parameters:
        str - the query fragment (e.g. starting with SELECT)
        executable - the sh:SPARQLExecutable potentially holding the sh:prefixes
        Returns:
        the parsable SPARQL string