Class SparqlQueryRunner


  • public final class SparqlQueryRunner
    extends Object
    A conversational tool for handling SPARQL queries.
     Examples:
       List values = createSelectQueryContext(rdfService, queryString)
                                 .bindVariableToUri("uri", uri)
                                                   .execute()
                                                   .toStringFields("partner")
                                                   .flatten();
    
       QueryHolder qh = queryHolder(queryString)
                                 .bindToUri("uri", uri));
       List map = createSelectQueryContext(model, qh)
                                 .execute()
                                 .toStringFields();
     
    The query context can come from either an RDFService or a Model. The execute() method does not actually execute the query: it merely sets it up syntactically. If you don't supply any field names to toStringFields(), you get all of them. Any string value that returns a blank or empty string is omitted from the results. Any row that returns no values is omitted from the results.