Package com.complexible.common.rdf

# Class StatementSources

java.lang.Object
com.complexible.common.rdf.StatementSources

public final class StatementSources extends Object

Utility class for working with StatementSources

Since:
  0.8
Version:
  6.0
Author:
  Michael Grove

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `StatementSources.RDFStreamStatementSource`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `closeQuietly(StatementSource theSource)`
  Quietly close the statement source, ignoring an exceptions and simply logging them rather than re-throwing.
  `static StatementSource`
  `concat(StatementSource theSource, StatementSource theOther, StatementSource... theRest)`
  `static StatementSource`
  `concat(Iterable<StatementSource> theSource)`
  `static StatementSource`
  `copyContext(StatementSource theSrc, Resource theSourceContext, Resource theTargetContext)`
  `static StatementSource`
  `empty()`
  `static StatementSource`
  `filter(StatementSource theSource, Predicate<Statement> theFilter)`
  `static StatementSource`
  `obfuscated(StatementSource theSource, RDFObfuscator theObfuscator)`
  `static long`
  `size(StatementSource theSrc)`
  Return the size (number of triples) in the StatementSource
  `static Set<Statement>`
  `toModel(StatementSource theSrc)`
  Read the contents of a StatementSource into a graph.
  `static StatementSource`
  `usingContext(StatementSource theSrc, Resource theContext)`
  `static StatementSource`
  `virtual(StatementSource theSource)`
  `static StatementSource`
  `withFallbackContext(StatementSource theSrc, Resource theContext)`
  `static long`
  `write(StatementSource theSource, RDFFormat theFormat, OutputStream theOutputStream, ProgressReporter theReporter)`
  Write the contents of the StatementSource in the specified format to the output stream
  `static long`
  `write(StatementSource theSource, RDFWriter theWriter, ProgressReporter theReporter)`
  Write the contents of the StatementSource to the Rio writer
  `static long`
  `write(StatementSource theSource, Optional<Iterable<Namespace>> theNamespaces, RDFWriter theWriter, ProgressReporter theReporter)`

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

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

- ## Method Details

  - ### closeQuietly

    public static void closeQuietly(StatementSource theSource)
    Quietly close the statement source, ignoring an exceptions and simply logging them rather than re-throwing.
    Parameters:
      `theSource` - the source to close.

  - ### empty

    public static StatementSource empty()

  - ### concat

    public static StatementSource concat(Iterable<StatementSource> theSource)

  - ### concat

    public static StatementSource concat(StatementSource theSource, StatementSource theOther, StatementSource... theRest)

  - ### copyContext

    public static StatementSource copyContext(StatementSource theSrc, Resource theSourceContext, Resource theTargetContext)

  - ### usingContext

    public static StatementSource usingContext(StatementSource theSrc, Resource theContext)

  - ### withFallbackContext

    public static StatementSource withFallbackContext(StatementSource theSrc, Resource theContext)

  - ### toModel

    public static Set<Statement> toModel(StatementSource theSrc) throws IOException
    Read the contents of a StatementSource into a graph. Be careful when calling this method as this will put the entire contents of the StatementSource into memory as a Graph, so large StatementSources could cause OOM errors.
    Parameters:
      `theSrc` - the source to read into a graph
    Returns:
      the contents of the source as a graph
    Throws:
      `IOException` - if there was an error while reading from the source

  - ### size

    public static long size(StatementSource theSrc) throws IOException
    Return the size (number of triples) in the StatementSource
    Parameters:
      `theSrc` - the source
    Returns:
      the size in triples
    Throws:
      `IOException` - if there was an error reading from the source

  - ### write

    public static long write(StatementSource theSource, RDFFormat theFormat, OutputStream theOutputStream, ProgressReporter theReporter) throws IOException
    Write the contents of the StatementSource in the specified format to the output stream
    Parameters:
      `theSource` - the source whose contents should be written
      `theFormat` - the RDF format to use when writing
      `theOutputStream` - the stream to write to
    Throws:
      `IOException` - if there was an error getting a statement from the source

  - ### write

    public static long write(StatementSource theSource, RDFWriter theWriter, ProgressReporter theReporter) throws IOException
    Write the contents of the StatementSource to the Rio writer
    Parameters:
      `theSource` - the source to write
      `theWriter` - the writer to write the source to
    Throws:
      `IOException` - if there is an error while writing

  - ### write

    public static long write(StatementSource theSource, Optional<Iterable<Namespace>> theNamespaces, RDFWriter theWriter, ProgressReporter theReporter) throws IOException
    Throws:
      `IOException`

  - ### filter

    public static StatementSource filter(StatementSource theSource, Predicate<Statement> theFilter)

  - ### obfuscated

    public static StatementSource obfuscated(StatementSource theSource, RDFObfuscator theObfuscator)

  - ### virtual

    public static StatementSource virtual(StatementSource theSource)