Class GraphQlFieldExecImpl<K>

java.lang.Object
org.aksw.jenax.graphql.sparql.v2.exec.api.low.GraphQlFieldExecImpl<K>
All Implemented Interfaces:
AutoCloseable, GraphQlExecCore, GraphQlFieldExec<K>

public class GraphQlFieldExecImpl<K> extends Object implements GraphQlFieldExec<K>
  • Field Details

    • processor

      protected GraphQlProcessor<K> processor
    • query

      protected final org.apache.jena.query.Query query
    • queryExec

      protected final org.apache.jena.sparql.exec.QueryExec queryExec
    • rs

      protected final org.apache.jena.sparql.exec.RowSet rs
    • functionEnv

      protected org.apache.jena.sparql.function.FunctionEnv functionEnv
    • isSingle

      protected boolean isSingle
    • stateVarMap

      protected Map<?,Map<org.apache.jena.sparql.core.Var,org.apache.jena.sparql.core.Var>> stateVarMap
    • driver

      protected AccStateDriver<org.apache.jena.sparql.engine.binding.Binding,org.apache.jena.sparql.function.FunctionEnv,K,org.apache.jena.graph.Node> driver
    • queryMapping

      protected QueryMapping<K> queryMapping
    • isFinished

      protected boolean isFinished
  • Constructor Details

    • GraphQlFieldExecImpl

      public GraphQlFieldExecImpl(GraphQlProcessor<K> processor, boolean isSingle, org.apache.jena.query.Query query, org.apache.jena.sparql.exec.QueryExec queryExec, Map<?,Map<org.apache.jena.sparql.core.Var,org.apache.jena.sparql.core.Var>> stateVarMap, AccStateDriver<org.apache.jena.sparql.engine.binding.Binding,org.apache.jena.sparql.function.FunctionEnv,K,org.apache.jena.graph.Node> driver, QueryMapping<K> queryMapping)
      Parameters:
      isSingle -
      query - The query. We don't rely on QueryExec to support accessing the query.
      queryExec -
      stateVarMap -
      driver -
  • Method Details

    • getQuery

      public org.apache.jena.query.Query getQuery()
    • getProcessor

      public GraphQlProcessor<K> getProcessor()
      Description copied from interface: GraphQlFieldExec
      Return the processor from which this instance was created.
      Specified by:
      getProcessor in interface GraphQlFieldExec<K>
    • isSingle

      public boolean isSingle()
      Description copied from interface: GraphQlExecCore
      Whether this provider is expected to yield at most 1 result. The client can use this information to e.g. omit starting an array in the output. However, the data provider may not necessarily know whether this information is truthful, because it may rely on user provided mapping information: For example, a field might be tagged with &#064one but during execution bindings amounting to multiple values are encountered; If a violation is encountered during runtime then an exception should be raised.
      Specified by:
      isSingle in interface GraphQlExecCore
    • getQueryExec

      public org.apache.jena.sparql.exec.QueryExec getQueryExec()
      Get the underlying Jena QueryExec.
    • sendRemainingItemsToWriter

      public long sendRemainingItemsToWriter(ObjectNotationWriter<K,org.apache.jena.graph.Node> writer) throws IOException
      Description copied from interface: GraphQlFieldExec
      This method is likely to be more efficient because it can use Iterator.forEachRemaining.
      Specified by:
      sendRemainingItemsToWriter in interface GraphQlFieldExec<K>
      Throws:
      IOException
    • sendNextItemToWriter

      public boolean sendNextItemToWriter(ObjectNotationWriter<K,org.apache.jena.graph.Node> writer) throws IOException
      Description copied from interface: GraphQlFieldExec
      Send the next item to the writer. If GraphQlExecCore.isSingle() is true then the whole response will be streamed.
      Specified by:
      sendNextItemToWriter in interface GraphQlFieldExec<K>
      Parameters:
      writer - The object notation writer.
      Returns:
      True iff any data was sent to the writer, false otherwise.
      Throws:
      IOException
    • writeExtensions

      public void writeExtensions(ObjectNotationWriter<K,org.apache.jena.graph.Node> writer, Function<String,K> stringToKey) throws IOException
      Description copied from interface: GraphQlFieldExec
      Write out data for the extension block of a graphql response. This can be used to expose additional information, such as the underlying SPARQL query.
       {
         "data": ...
         "extensions": {
            "sparqlQuery": "SELECT * { ... }"
         }
       }
       
      Specified by:
      writeExtensions in interface GraphQlFieldExec<K>
      Parameters:
      writer - The writer in object state - i.e. .beginObject() must have been called.
      Throws:
      IOException
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface GraphQlExecCore
    • abort

      public void abort()
      Specified by:
      abort in interface GraphQlExecCore