Interface GraphQlFieldExec<K>
- All Superinterfaces:
AutoCloseable,GraphQlExecCore
- All Known Implementing Classes:
GraphQlFieldExecImpl
Execution for producing the results for a field and its sub-tree in a graphql document.
In the initial design, this interface was intended for generating the results for a top-level field,
but now it is also used for producing all results for a document.
(The document is strictly speaking not a field in graphql terminology, so perhaps it should be renamed to GraphQlNodeExec).
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T> Iterator<T>asIterator(ObjectNotationWriterInMemory<T, K, org.apache.jena.graph.Node> inMemoryWriter) Return an iterator over objects based onsendNextItemToWriter(ObjectNotationWriter).Return the processor from which this instance was created.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 interface org.aksw.jenax.graphql.sparql.v2.exec.api.low.GraphQlExecCore
abort, close, isSingle
-
Method Details
-
getProcessor
GraphQlProcessor<K> getProcessor()Return the processor from which this instance was created. -
sendNextItemToWriter
boolean sendNextItemToWriter(ObjectNotationWriter<K, org.apache.jena.graph.Node> writer) throws IOExceptionSend the next item to the writer. IfGraphQlExecCore.isSingle()is true then the whole response will be streamed.- Parameters:
writer- The object notation writer.- Returns:
- True iff any data was sent to the writer, false otherwise.
- Throws:
IOException
-
sendRemainingItemsToWriter
long sendRemainingItemsToWriter(ObjectNotationWriter<K, org.apache.jena.graph.Node> writer) throws IOExceptionThis method is likely to be more efficient because it can use Iterator.forEachRemaining.- Throws:
IOException
-
writeExtensions
void writeExtensions(ObjectNotationWriter<K, org.apache.jena.graph.Node> writer, Function<String, throws IOExceptionK> stringToKey) 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 * { ... }" } }- Parameters:
writer- The writer in object state - i.e..beginObject()must have been called.- Throws:
IOException
-
asIterator
default <T> Iterator<T> asIterator(ObjectNotationWriterInMemory<T, K, org.apache.jena.graph.Node> inMemoryWriter) Return an iterator over objects based onsendNextItemToWriter(ObjectNotationWriter). The input data is materalized using the in-memory writer and the produced objects are those returned by the iterator.
-