Package com.stardog.stark.io

# Class RDFParsers

java.lang.Object
com.stardog.stark.io.RDFParsers

public final class RDFParsers extends Object

Utilities for working with `RDFParser`

Since:
  1.0
Version:
  1.0
Author:
  Michael Grove
See Also:
  - `RDFFormat`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Optional<RDFParser>`
  `forFormat(RDFFormat theFormat)`
  Return the `parser` associated with the given format
  `static Set<Statement>`
  `read(InputStream theStream, RDFFormat theFormat)`
  Parse the RDF from the `input` and return the resulting statements
  `static Set<Statement>`
  `read(InputStream theStream, RDFFormat theFormat, Options theOptions)`
  Parse the RDF from the `input` and return the resulting statements
  `static <T> T`
  `read(InputStream theStream, RDFFormat theFormat, Options theOptions, CollectingRDFHandler<T> theHandler)`
  Parse the RDF from the specified stream
  `static void`
  `read(InputStream theStream, RDFFormat theFormat, Options theOptions, RDFHandler theHandler)`
  Parse the RDF from the specified stream
  `static Set<Statement>`
  `read(String theInput, RDFFormat theFormat)`
  Parse the RDF from the given `String` input and return the resulting statements using the default parsing options
  `static Set<Statement>`
  `read(String theInput, RDFFormat theFormat, Options theOptions)`
  Parser the RDF from the given `String` input and return the resulting statements.
  `static Set<Statement>`
  `read(Path thePath)`
  Parse the RDF in the specified file and return the resulting statements.
  `static Set<Statement>`
  `read(Path thePath, RDFFormat theFormat)`
  Parse the RDF in the specified file and return the resulting statements.
  `static Set<Statement>`
  `read(Path thePath, RDFFormat theFormat, Options theOptions)`
  Parse the RDF in the specified file and return the resulting statements
  `static <T> T`
  `read(Path thePath, RDFFormat theFormat, Options theOptions, CollectingRDFHandler<T> theHandler)`
  Parse the RDF in the specified file
  `static void`
  `register(RDFParser theParser)`

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

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

- ## Method Details

  - ### register

    public static void register(RDFParser theParser)

  - ### forFormat

    @Nonnull public static Optional<RDFParser> forFormat(@Nonnull RDFFormat theFormat)
    Return the `parser` associated with the given format
    Parameters:
      `theFormat` - the format you wish to parse
    Returns:
      the parser for the format

  - ### read

    @Nonnull public static Set<Statement> read(@Nonnull InputStream theStream, @Nonnull RDFFormat theFormat) throws IOException
    Parse the RDF from the `input` and return the resulting statements
    Parameters:
      `theStream` - the `InputStream` to read from
      `theFormat` - the format of the RDF
    Returns:
      the parsed RDF
    Throws:
      `IOException` - if there was an error while reading from the stream
      `InvalidRDF` - if the RDF syntax was invalid wrt to the `format`
      `IllegalArgumentException` - if there is no known parser for the `RDFFormat`

  - ### read

    @Nonnull public static Set<Statement> read(@Nonnull String theInput, @Nonnull RDFFormat theFormat) throws IOException
    Parse the RDF from the given `String` input and return the resulting statements using the default parsing options
    Parameters:
      `theInput` - the RDF input
      `theFormat` - the format for the RDF
    Returns:
      the parsed statements
    Throws:
      `IOException` - if there was an error while reading from the stream
      `InvalidRDF` - if the RDF syntax was invalid wrt to the `format`
      `IllegalArgumentException` - if there is no known parser for the `RDFFormat`

  - ### read

    @Nonnull public static Set<Statement> read(@Nonnull String theInput, @Nonnull RDFFormat theFormat, @Nonnull Options theOptions) throws IOException
    Parser the RDF from the given `String` input and return the resulting statements.
    Parameters:
      `theInput` - the RDF input
      `theFormat` - the format for the RDF
      `theOptions` - the parser options
    Returns:
      the parsed statements
    Throws:
      `IOException` - if there was an error while reading from the stream
      `InvalidRDF` - if the RDF syntax was invalid wrt to the `format`
      `IllegalArgumentException` - if there is no known parser for the `RDFFormat`

  - ### read

    @Nonnull public static Set<Statement> read(@Nonnull InputStream theStream, @Nonnull RDFFormat theFormat, @Nonnull Options theOptions) throws IOException
    Parse the RDF from the `input` and return the resulting statements
    Parameters:
      `theStream` - the `InputStream` to read from
      `theFormat` - the format of the RDF
      `theOptions` - the parser options
    Returns:
      the parsed RDF
    Throws:
      `IOException` - if there was an error while reading from the stream
      `InvalidRDF` - if the RDF syntax was invalid wrt to the `format`
      `IllegalArgumentException` - if there is no known parser for the `RDFFormat`

  - ### read

    @Nonnull public static Set<Statement> read(@Nonnull Path thePath) throws IOException
    Parse the RDF in the specified file and return the resulting statements.
    Parameters:
      `thePath` - the file to read from
    Returns:
      the parsed statements
    Throws:
      `IOException` - if there is an error opening or reading from the file
      `InvalidRDF` - if the RDF syntax was invalid wrt to the `format`
      `IllegalArgumentException` - if there is no known parser for the `RDFFormat` or the file uses an unknown RDF format

  - ### read

    @Nonnull public static Set<Statement> read(@Nonnull Path thePath, @Nonnull RDFFormat theFormat) throws IOException
    Parse the RDF in the specified file and return the resulting statements.
    Parameters:
      `thePath` - the file to read from
      `theFormat` - the RDF format
    Returns:
      the parsed statements
    Throws:
      `IOException` - if there is an error opening or reading from the file
      `InvalidRDF` - if the RDF syntax was invalid wrt to the `format`
      `IllegalArgumentException` - if there is no known parser for the `RDFFormat` or the file uses an unknown RDF format

  - ### read

    @Nonnull public static Set<Statement> read(@Nonnull Path thePath, @Nonnull RDFFormat theFormat, @Nonnull Options theOptions) throws IOException
    Parse the RDF in the specified file and return the resulting statements
    Parameters:
      `thePath` - the file to read from
      `theFormat` - the RDF format
      `theOptions` - the parser options
    Returns:
      the parsed statements
    Throws:
      `IOException` - if there is an error opening or reading from the file
      `InvalidRDF` - if the RDF syntax was invalid wrt to the `format`
      `IllegalArgumentException` - if there is no known parser for the `RDFFormat`

  - ### read

    public static <T> T read(@Nonnull Path thePath, @Nonnull RDFFormat theFormat, @Nonnull Options theOptions, @Nonnull CollectingRDFHandler<T> theHandler) throws IOException
    Parse the RDF in the specified file
    Parameters:
      `thePath` - the file whose contents should be parse
      `theFormat` - the RDF format of the file
      `theOptions` - the parser options
      `theHandler` - the handler of the parsed results
    Returns:
      the result
    Throws:
      `IOException` - if there is an error opening or reading from the file
      `InvalidRDF` - if the RDF syntax was invalid wrt to the `format`
      `IllegalArgumentException` - if there is no known parser for the `RDFFormat`

  - ### read

    public static <T> T read(@Nonnull InputStream theStream, @Nonnull RDFFormat theFormat, @Nonnull Options theOptions, @Nonnull CollectingRDFHandler<T> theHandler) throws IOException
    Parse the RDF from the specified stream
    Parameters:
      `theStream` - the stream whose contents should be parsed
      `theFormat` - the RDF format of the file
      `theOptions` - the parser options
      `theHandler` - the handler of the parsed results
    Returns:
      the result
    Throws:
      `IOException` - if there is an error opening or reading from the file
      `InvalidRDF` - if the RDF syntax was invalid wrt to the `format`
      `IllegalArgumentException` - if there is no known parser for the `RDFFormat`

  - ### read

    public static void read(@Nonnull InputStream theStream, @Nonnull RDFFormat theFormat, @Nonnull Options theOptions, @Nonnull RDFHandler theHandler) throws IOException
    Parse the RDF from the specified stream
    Parameters:
      `theStream` - the stream whose contents should be parsed
      `theFormat` - the RDF format of the file
      `theOptions` - the parser options
      `theHandler` - the handler of the parsed results
    Throws:
      `IOException` - if there is an error opening or reading from the file
      `InvalidRDF` - if the RDF syntax was invalid wrt to the `format`
      `IllegalArgumentException` - if there is no known parser for the `RDFFormat`