Interface RDFStream

All Superinterfaces:
AutoCloseable, Closeable
All Known Implementing Classes:
DelegatingRDFStream, RandomStream, RDFStreamBase

public interface RDFStream extends Closeable
A simple interface for representing a stream for RDF input. An RDF stream is typically backed by an input stream and parsed with an RDFParser but a specific stream implementation might use different means to generate statements.
Since:
1.1
Version:
6.0
Author:
Evren Sirin
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Supposed to return the number currently parsed.
    long
    Estimated size of statements.
    Returns the default context associated with this stream or null if there is no default context.
    Returns the name of this stream.
    boolean
    Returns true either if this stream has a non-null context or the statements generated by this stream has contexts.
    long
     
    void
    parse(RDFHandler theHandler)
    Parses the stream and passes the statements to the given handler.

    Methods inherited from interface java.io.Closeable

    close
  • Method Details

    • parse

      void parse(RDFHandler theHandler) throws IOException, InvalidRDF, RDFHandlerException
      Parses the stream and passes the statements to the given handler.
      Throws:
      IOException
      InvalidRDF
      RDFHandlerException
    • getContext

      Resource getContext()
      Returns the default context associated with this stream or null if there is no default context. Note that, the statements that will be sent to the handler may not be using this context and the user of this stream should make sure the context information is used correctly.
    • hasContext

      boolean hasContext()
      Returns true either if this stream has a non-null context or the statements generated by this stream has contexts.
    • getName

      String getName()
      Returns the name of this stream. If the stream is backed by a file this will return the file's name. Otherwise it might be an auto-generated name or some other (not necessarily unique) name.
    • bytesRead

      long bytesRead()
      Supposed to return the number currently parsed. Can be used for progress reporting from RDFHandler
      Returns:
      Number of bytes parsed
    • length

      long length()
      Returns:
      Length in bytes of underlying data
    • estimatedCount

      long estimatedCount()
      Estimated size of statements. Might be accurate or calculate only from the data size. Given N bytes in an RDFStream, the estimated number of statements depends on the RDF format. RDF stream may or may not be compressed, which also impacts the bytes-to-statements ratio.
      Returns:
      estimated size of statements.