Class GraphQlFieldExecImpl<K>
java.lang.Object
org.aksw.jenax.graphql.sparql.v2.exec.api.low.GraphQlFieldExecImpl<K>
- All Implemented Interfaces:
AutoCloseable,GraphQlExecCore,GraphQlFieldExec<K>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AccStateDriver<org.apache.jena.sparql.engine.binding.Binding,org.apache.jena.sparql.function.FunctionEnv, K, org.apache.jena.graph.Node> protected org.apache.jena.sparql.function.FunctionEnvprotected booleanprotected booleanprotected GraphQlProcessor<K>protected final org.apache.jena.query.Queryprotected final org.apache.jena.sparql.exec.QueryExecprotected QueryMapping<K>protected final org.apache.jena.sparql.exec.RowSet -
Constructor Summary
ConstructorsConstructorDescriptionGraphQlFieldExecImpl(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) -
Method Summary
Modifier and TypeMethodDescriptionvoidabort()voidclose()Return the processor from which this instance was created.org.apache.jena.query.QuerygetQuery()org.apache.jena.sparql.exec.QueryExecGet the underlying JenaQueryExec.booleanisSingle()Whether this provider is expected to yield at most 1 result.booleansendNextItemToWriter(ObjectNotationWriter<K, org.apache.jena.graph.Node> writer) Send the next item to the writer.longsendRemainingItemsToWriter(ObjectNotationWriter<K, org.apache.jena.graph.Node> writer) This method is likely to be more efficient because it can use Iterator.forEachRemaining.voidwriteExtensions(ObjectNotationWriter<K, org.apache.jena.graph.Node> writer, Function<String, K> stringToKey) Write out data for the extension block of a graphql response.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.aksw.jenax.graphql.sparql.v2.exec.api.low.GraphQlFieldExec
asIterator
-
Field Details
-
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
-
driver
protected AccStateDriver<org.apache.jena.sparql.engine.binding.Binding,org.apache.jena.sparql.function.FunctionEnv, driverK, org.apache.jena.graph.Node> -
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
Description copied from interface:GraphQlFieldExecReturn the processor from which this instance was created.- Specified by:
getProcessorin interfaceGraphQlFieldExec<K>
-
isSingle
public boolean isSingle()Description copied from interface:GraphQlExecCoreWhether 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 @one 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:
isSinglein interfaceGraphQlExecCore
-
getQueryExec
public org.apache.jena.sparql.exec.QueryExec getQueryExec()Get the underlying JenaQueryExec. -
sendRemainingItemsToWriter
public long sendRemainingItemsToWriter(ObjectNotationWriter<K, org.apache.jena.graph.Node> writer) throws IOExceptionDescription copied from interface:GraphQlFieldExecThis method is likely to be more efficient because it can use Iterator.forEachRemaining.- Specified by:
sendRemainingItemsToWriterin interfaceGraphQlFieldExec<K>- Throws:
IOException
-
sendNextItemToWriter
public boolean sendNextItemToWriter(ObjectNotationWriter<K, org.apache.jena.graph.Node> writer) throws IOExceptionDescription copied from interface:GraphQlFieldExecSend the next item to the writer. IfGraphQlExecCore.isSingle()is true then the whole response will be streamed.- Specified by:
sendNextItemToWriterin interfaceGraphQlFieldExec<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, throws IOExceptionK> stringToKey) Description copied from interface:GraphQlFieldExecWrite 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:
writeExtensionsin interfaceGraphQlFieldExec<K>- Parameters:
writer- The writer in object state - i.e..beginObject()must have been called.- Throws:
IOException
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceGraphQlExecCore
-
abort
public void abort()- Specified by:
abortin interfaceGraphQlExecCore
-