Class QueryExecutionBaseSelect

java.lang.Object
org.aksw.jenax.dataaccess.sparql.execution.query.QueryExecutionWrapperBase<org.apache.jena.query.QueryExecution>
org.aksw.jena_sparql_api.core.QueryExecutionBaseSelect
All Implemented Interfaces:
AutoCloseable, org.aksw.jenax.dataaccess.sparql.execution.query.QueryExecutionWrapper, org.apache.jena.query.QueryExecution
Direct Known Subclasses:
QueryExecutionAlwaysFail, QueryExecutionSelect

public abstract class QueryExecutionBaseSelect extends org.aksw.jenax.dataaccess.sparql.execution.query.QueryExecutionWrapperBase<org.apache.jena.query.QueryExecution> implements org.apache.jena.query.QueryExecution
A Sparqler-class that implements ask, describe, and construct based on the executeCoreSelect(Query) method. Also, works on String and Query level. Some of the code has been taken from org.apache.jena.sparql.engine.QueryExecutionBase, which is a class with a similar purpose but not as reusable as this one (This class reduces all operations to a single executeCoreSelect call) NOTE: executeCoreSelect will close this query execution once the ResultSet is consumed.
Author:
raven
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected org.aksw.jenax.dataaccess.sparql.factory.execution.query.QueryExecutionFactory
     
    protected org.apache.jena.query.Query
     

    Fields inherited from class org.aksw.jenax.dataaccess.sparql.execution.query.QueryExecutionWrapperBase

    decoratee
  • Constructor Summary

    Constructors
    Constructor
    Description
    QueryExecutionBaseSelect(org.apache.jena.query.Query query, org.aksw.jenax.dataaccess.sparql.factory.execution.query.QueryExecutionFactory subFactory)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.apache.jena.rdf.model.Model
    createModel(Iterator<org.apache.jena.graph.Triple> it)
     
    static org.apache.jena.rdf.model.Model
    createModel(org.apache.jena.rdf.model.Model result, Iterator<org.apache.jena.graph.Triple> it)
     
    boolean
     
    org.apache.jena.rdf.model.Model
     
    org.apache.jena.rdf.model.Model
    execConstruct(org.apache.jena.rdf.model.Model result)
     
    Iterator<org.apache.jena.graph.Triple>
     
    org.apache.jena.rdf.model.Model
     
    org.apache.jena.rdf.model.Model
    execDescribe(org.apache.jena.rdf.model.Model result)
    A describe query is translated into a construct query.
    Iterator<org.apache.jena.graph.Triple>
    We use this query execution for retrieving the result set of the where clause, but we neet the subFactory to describe the individual resources then.
    org.apache.jena.atlas.json.JsonArray
     
    Iterator<org.apache.jena.atlas.json.JsonObject>
     
    org.apache.jena.query.ResultSet
     
    protected Iterator<org.apache.jena.graph.Triple>
    executeConstructStreaming(org.apache.jena.query.Query query)
     
    protected org.apache.jena.query.ResultSetCloseable
    executeCoreSelect(org.apache.jena.query.Query query)
     
    protected abstract org.apache.jena.query.QueryExecution
    executeCoreSelectX(org.apache.jena.query.Query query)
     
    void
    executeUpdate(org.apache.jena.update.UpdateRequest updateRequest)
     
    static org.apache.jena.graph.Node
    extractDescribeNode(org.apache.jena.query.Query query)
     
    org.apache.jena.query.Query
     

    Methods inherited from class org.aksw.jenax.dataaccess.sparql.execution.query.QueryExecutionWrapperBase

    afterExec, beforeExec, execConstructDataset, execConstructDataset, execConstructQuads, getDelegate, getQueryString, onException

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.apache.jena.query.QueryExecution

    execConstructDataset, execConstructDataset, execConstructQuads, getQueryString

    Methods inherited from interface org.aksw.jenax.dataaccess.sparql.execution.query.QueryExecutionWrapper

    abort, close, getContext, getDataset, getTimeout1, getTimeout2, isClosed, tryGetDelegate, unwrap
  • Field Details

    • query

      protected org.apache.jena.query.Query query
    • parentFactory

      protected org.aksw.jenax.dataaccess.sparql.factory.execution.query.QueryExecutionFactory parentFactory
  • Constructor Details

    • QueryExecutionBaseSelect

      public QueryExecutionBaseSelect(org.apache.jena.query.Query query, org.aksw.jenax.dataaccess.sparql.factory.execution.query.QueryExecutionFactory subFactory)
  • Method Details

    • createModel

      public static org.apache.jena.rdf.model.Model createModel(Iterator<org.apache.jena.graph.Triple> it)
    • createModel

      public static org.apache.jena.rdf.model.Model createModel(org.apache.jena.rdf.model.Model result, Iterator<org.apache.jena.graph.Triple> it)
    • executeCoreSelectX

      protected abstract org.apache.jena.query.QueryExecution executeCoreSelectX(org.apache.jena.query.Query query)
    • executeCoreSelect

      protected org.apache.jena.query.ResultSetCloseable executeCoreSelect(org.apache.jena.query.Query query)
    • execAsk

      public boolean execAsk()
      Specified by:
      execAsk in interface org.apache.jena.query.QueryExecution
      Overrides:
      execAsk in class org.aksw.jenax.dataaccess.sparql.execution.query.QueryExecutionWrapperBase<org.apache.jena.query.QueryExecution>
    • execDescribe

      public org.apache.jena.rdf.model.Model execDescribe()
      Specified by:
      execDescribe in interface org.apache.jena.query.QueryExecution
      Overrides:
      execDescribe in class org.aksw.jenax.dataaccess.sparql.execution.query.QueryExecutionWrapperBase<org.apache.jena.query.QueryExecution>
    • extractDescribeNode

      public static org.apache.jena.graph.Node extractDescribeNode(org.apache.jena.query.Query query)
    • execDescribeTriples

      public Iterator<org.apache.jena.graph.Triple> execDescribeTriples()
      We use this query execution for retrieving the result set of the where clause, but we neet the subFactory to describe the individual resources then.
      Specified by:
      execDescribeTriples in interface org.apache.jena.query.QueryExecution
      Overrides:
      execDescribeTriples in class org.aksw.jenax.dataaccess.sparql.execution.query.QueryExecutionWrapperBase<org.apache.jena.query.QueryExecution>
      Returns:
    • execDescribe

      public org.apache.jena.rdf.model.Model execDescribe(org.apache.jena.rdf.model.Model result)
      A describe query is translated into a construct query. Lets see... Describe ?a ?b ... <x><y> Where Pattern { ... } becomes ...? Construct { ?a ?ap ?ao . ?b ?bp ?bo . } Where Pattern { } Union {} Ah, lets just query every resource individually for now TODO Add support for concise bounded descriptions...
      Specified by:
      execDescribe in interface org.apache.jena.query.QueryExecution
      Overrides:
      execDescribe in class org.aksw.jenax.dataaccess.sparql.execution.query.QueryExecutionWrapperBase<org.apache.jena.query.QueryExecution>
      Parameters:
      result -
      Returns:
    • executeConstructStreaming

      protected Iterator<org.apache.jena.graph.Triple> executeConstructStreaming(org.apache.jena.query.Query query)
    • execConstruct

      public org.apache.jena.rdf.model.Model execConstruct(org.apache.jena.rdf.model.Model result)
      Specified by:
      execConstruct in interface org.apache.jena.query.QueryExecution
      Overrides:
      execConstruct in class org.aksw.jenax.dataaccess.sparql.execution.query.QueryExecutionWrapperBase<org.apache.jena.query.QueryExecution>
    • execConstruct

      public org.apache.jena.rdf.model.Model execConstruct()
      Specified by:
      execConstruct in interface org.apache.jena.query.QueryExecution
      Overrides:
      execConstruct in class org.aksw.jenax.dataaccess.sparql.execution.query.QueryExecutionWrapperBase<org.apache.jena.query.QueryExecution>
    • execConstructTriples

      public Iterator<org.apache.jena.graph.Triple> execConstructTriples()
      Specified by:
      execConstructTriples in interface org.apache.jena.query.QueryExecution
      Overrides:
      execConstructTriples in class org.aksw.jenax.dataaccess.sparql.execution.query.QueryExecutionWrapperBase<org.apache.jena.query.QueryExecution>
    • execSelect

      public org.apache.jena.query.ResultSet execSelect()
      Specified by:
      execSelect in interface org.apache.jena.query.QueryExecution
      Overrides:
      execSelect in class org.aksw.jenax.dataaccess.sparql.execution.query.QueryExecutionWrapperBase<org.apache.jena.query.QueryExecution>
    • getQuery

      public org.apache.jena.query.Query getQuery()
      Specified by:
      getQuery in interface org.apache.jena.query.QueryExecution
      Specified by:
      getQuery in interface org.aksw.jenax.dataaccess.sparql.execution.query.QueryExecutionWrapper
    • executeUpdate

      public void executeUpdate(org.apache.jena.update.UpdateRequest updateRequest)
    • execJson

      public org.apache.jena.atlas.json.JsonArray execJson()
      Specified by:
      execJson in interface org.apache.jena.query.QueryExecution
      Overrides:
      execJson in class org.aksw.jenax.dataaccess.sparql.execution.query.QueryExecutionWrapperBase<org.apache.jena.query.QueryExecution>
    • execJsonItems

      public Iterator<org.apache.jena.atlas.json.JsonObject> execJsonItems()
      Specified by:
      execJsonItems in interface org.apache.jena.query.QueryExecution
      Overrides:
      execJsonItems in class org.aksw.jenax.dataaccess.sparql.execution.query.QueryExecutionWrapperBase<org.apache.jena.query.QueryExecution>