Class SparqlQueryRunner


  • public class SparqlQueryRunner
    extends Object
    Execute SPARQL queries against a model. Take the model in the constructor. Then execute as many queries as desired, with the query contained in a String. Exceptions are handled in a tidy manner, and the query environment is closed properly in any case.
    • Constructor Detail

      • SparqlQueryRunner

        public SparqlQueryRunner​(org.apache.jena.rdf.model.Model model)
    • Method Detail

      • executeSelect

        public <T> T executeSelect​(SparqlQueryRunner.QueryParser<T> parser,
                                   String queryStr)
        Execute the SELECT query and parse the results, closing and cleaning up afterward. If an exception occurs, return the parser's default value.
      • executeConstruct

        public org.apache.jena.rdf.model.Model executeConstruct​(String queryStr)
        Execute the CONSTRUCT query and return the resulting model. If an exception occurs, return an empty model.
      • uriValue

        public static edu.cornell.mannlib.vitro.webapp.utils.SparqlQueryRunner.UriValue uriValue​(String name,
                                                                                                 String uri)