org.eclipse.rdf4j.query.impl

## Class BackgroundGraphResult

- java.lang.Object
- - org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration<E,X>
  - - org.eclipse.rdf4j.common.iteration.IterationWrapper<Statement,QueryEvaluationException>
    - - org.eclipse.rdf4j.query.impl.BackgroundGraphResult

- All Implemented Interfaces:
    AutoCloseable, Iterable<Statement>, Runnable, CloseableIteration<Statement,QueryEvaluationException>, Iteration<Statement,QueryEvaluationException>, GraphQueryResult, QueryResult<Statement>, RDFHandler
  Direct Known Subclasses:
    BackgroundGraphResult

      public class BackgroundGraphResult
      extends IterationWrapper<Statement,QueryEvaluationException>
      implements GraphQueryResult, Runnable, RDFHandler

  Provides concurrent access to statements as they are being parsed when instances of this class are run as Threads.
  Author:
    James Leigh

- - ### Field Summary

    - ### Fields inherited from class org.eclipse.rdf4j.common.iteration.IterationWrapper

      `wrappedIter`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BackgroundGraphResult(QueueCursor<Statement> queue, RDFParser parser, InputStream in, Charset charset, String baseURI)`
    `BackgroundGraphResult(RDFParser parser, InputStream in, Charset charset, String baseURI)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `endRDF()` Signals the end of the RDF data.
    `Map<String,String>` | `getNamespaces()` Retrieves relevant namespaces from the query result.
    `protected void` | `handleClose()` Closes this Iteration and also closes the wrapped Iteration if it is a `CloseableIteration`.
    `void` | `handleComment(String comment)` Handles a comment.
    `void` | `handleNamespace(String prefix, String uri)` Handles a namespace declaration/definition.
    `void` | `handleStatement(Statement st)` Handles a statement.
    `void` | `run()`
    `void` | `startRDF()` Signals the start of the RDF data.

    - ### Methods inherited from class org.eclipse.rdf4j.common.iteration.IterationWrapper

      `hasNext, next, remove`

    - ### Methods inherited from class org.eclipse.rdf4j.common.iteration.AbstractCloseableIteration

      `close, isClosed`

    - ### Methods inherited from class java.lang.Object

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

    - ### Methods inherited from interface org.eclipse.rdf4j.query.QueryResult

      `iterator`

    - ### Methods inherited from interface org.eclipse.rdf4j.common.iteration.CloseableIteration

      `close`

    - ### Methods inherited from interface org.eclipse.rdf4j.common.iteration.Iteration

      `hasNext, next, remove, stream`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach, spliterator`

- - ### Constructor Detail

    - #### BackgroundGraphResult

          public BackgroundGraphResult(RDFParser parser,
                                       InputStream in,
                                       Charset charset,
                                       String baseURI)

    - #### BackgroundGraphResult

          public BackgroundGraphResult(QueueCursor<Statement> queue,
                                       RDFParser parser,
                                       InputStream in,
                                       Charset charset,
                                       String baseURI)

  - ### Method Detail

    - #### handleClose

          protected void handleClose()
                              throws QueryEvaluationException

      Description copied from class: `IterationWrapper`
      Closes this Iteration and also closes the wrapped Iteration if it is a `CloseableIteration`.
      Overrides:
        `handleClose` in class `IterationWrapper<Statement,QueryEvaluationException>`
      Throws:
        `QueryEvaluationException`

    - #### run

          public void run()

      Specified by:
        `run` in interface `Runnable`

    - #### startRDF

          public void startRDF()
                        throws RDFHandlerException

      Description copied from interface: `RDFHandler`
      Signals the start of the RDF data. This method is called before any data is reported.
      Specified by:
        `startRDF` in interface `RDFHandler`
      Throws:
        `RDFHandlerException` - If the RDF handler has encountered an unrecoverable error.

    - #### getNamespaces

          public Map<String,String> getNamespaces()

      Description copied from interface: `GraphQueryResult`
      Retrieves relevant namespaces from the query result.
      The contents of the Map may be modified after it is returned, as the initial return may be performed when the first RDF Statement is encountered.
      Specified by:
        `getNamespaces` in interface `GraphQueryResult`
      Returns:
        a Map<String, String> object containing (prefix, namespace) pairs.

    - #### handleComment

          public void handleComment(String comment)
                             throws RDFHandlerException

      Description copied from interface: `RDFHandler`
      Handles a comment.
      Specified by:
        `handleComment` in interface `RDFHandler`
      Parameters:
        `comment` - The comment.
      Throws:
        `RDFHandlerException` - If the RDF handler has encountered an unrecoverable error.

    - #### handleNamespace

          public void handleNamespace(String prefix,
                                      String uri)
                               throws RDFHandlerException

      Description copied from interface: `RDFHandler`
      Handles a namespace declaration/definition. A namespace declaration associates a (short) prefix string with the namespace's URI. The prefix for default namespaces, which do not have an associated prefix, are represented as empty strings.
      Specified by:
        `handleNamespace` in interface `RDFHandler`
      Parameters:
        `prefix` - The prefix for the namespace, or an empty string in case of a default namespace.
        `uri` - The URI that the prefix maps to.
      Throws:
        `RDFHandlerException` - If the RDF handler has encountered an unrecoverable error.

    - #### handleStatement

          public void handleStatement(Statement st)
                               throws RDFHandlerException

      Description copied from interface: `RDFHandler`
      Handles a statement.
      Specified by:
        `handleStatement` in interface `RDFHandler`
      Parameters:
        `st` - The statement.
      Throws:
        `RDFHandlerException` - If the RDF handler has encountered an unrecoverable error.

    - #### endRDF

          public void endRDF()
                      throws RDFHandlerException

      Description copied from interface: `RDFHandler`
      Signals the end of the RDF data. This method is called when all data has been reported.
      Specified by:
        `endRDF` in interface `RDFHandler`
      Throws:
        `RDFHandlerException` - If the RDF handler has encountered an unrecoverable error.

Copyright © 2015-2022 Eclipse Foundation. All Rights Reserved.