Class SparqlQueryEvaluator

java.lang.Object
fr.inria.rules.integraal.storage.external.evaluator.SparqlQueryEvaluator
All Implemented Interfaces:
NativeQueryEvaluator<String, org.eclipse.rdf4j.query.TupleQueryResult>

public class SparqlQueryEvaluator extends Object implements NativeQueryEvaluator<String, org.eclipse.rdf4j.query.TupleQueryResult>
Evaluates a SPARQL query using the associated repository. This evaluator uses rdf4j RepositoryConnection to execute the query on the triple store The result is a TupleQueryResult which represents the list of all resulting tuples.
This evaluator also provides additional methods for inserting and updating data on the triple store.
  • Constructor Summary

    Constructors
    Constructor
    Description
    SparqlQueryEvaluator(org.eclipse.rdf4j.repository.Repository repo)
    Construct a new evaluator over the triple store represented by the given repository
  • Method Summary

    Modifier and Type
    Method
    Description
    Optional<org.eclipse.rdf4j.query.TupleQueryResult>
    Evaluate the given query and returns the result This should not do anymore work
    boolean
    insert(org.eclipse.rdf4j.model.Statement statement)
    Insert the given statement
    boolean
    insertBatch(List<org.eclipse.rdf4j.model.Statement> statements)
    Insert the given statements, using a batch insert and parameters for the query
    boolean
    update(String query)
    Executes the given SPARQL update query

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SparqlQueryEvaluator

      public SparqlQueryEvaluator(org.eclipse.rdf4j.repository.Repository repo)
      Construct a new evaluator over the triple store represented by the given repository
      Parameters:
      repo - representing the triple store to connect to
      Throws:
      org.eclipse.rdf4j.repository.RepositoryException - if the initial connection to the triple store cannot be performed
  • Method Details

    • evaluate

      public Optional<org.eclipse.rdf4j.query.TupleQueryResult> evaluate(String query)
      Description copied from interface: NativeQueryEvaluator
      Evaluate the given query and returns the result This should not do anymore work
      Specified by:
      evaluate in interface NativeQueryEvaluator<String, org.eclipse.rdf4j.query.TupleQueryResult>
      Parameters:
      query - to evaluate
      Returns:
      an optional which contains the results of the query if everything went right, an empty optional otherwise
    • insert

      public boolean insert(org.eclipse.rdf4j.model.Statement statement)
      Insert the given statement
      Parameters:
      statement - to insert
      Returns:
      true iff the query has been executed without problem
    • insertBatch

      public boolean insertBatch(List<org.eclipse.rdf4j.model.Statement> statements)
      Insert the given statements, using a batch insert and parameters for the query
      Parameters:
      statements - to insert
      Returns:
      true iff the queries have been executed without problem
    • update

      public boolean update(String query)
      Executes the given SPARQL update query
      Parameters:
      query - to evaluate
      Returns:
      true iff the query has been executed without problem