Package com.stardog.stark.io

# Class RDFFormats

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

public final class RDFFormats extends Object

Utilities for `RDFFormat`

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

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final RDFFormat`
  `BINARY`
  Binary RDF
  `static final RDFFormat`
  `JSONLD`
  [JSON-LD](ttp://www.w3.org/TR/json-ld/)
  `static final RDFFormat`
  `N3`
  [Notation 3](http://www.w3.org/TeamSubmission/n3/)
  `static final RDFFormat`
  `NQUADS`
  [NQuads](http://www.w3.org/TR/n-quads/)
  `static final RDFFormat`
  `NTRIPLES`
  [N-triples](http://www.w3.org/TR/n-triples/)
  `static final RDFFormat`
  `PRETTY_TURTLE`
  `static final RDFFormat`
  `RDFJSON`
  [RDF/JSON](http://www.w3.org/TR/rdf-json/)
  `static final RDFFormat`
  `RDFXML`
  [RDF/XML](http://www.w3.org/TR/rdf-syntax-grammar/)
  `static final RDFFormat`
  `TRIG`
  [TriG](http://www.w3.org/TR/trig)
  `static final RDFFormat`
  `TURTLE`
  Format denoting [Turtle](https://www.w3.org/TR/turtle/)
  `static RDFFormat`
  `UNKNOWN_BASE_FORMAT`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static RDFFormat`
  `baseFormat(RDFFormat theFormat)`
  Returns the `base format` of the given format if it is a `compressed format` or the given format otherwise.
  `static RDFFormat`
  `compressedFormat(RDFFormat theFormat, FileFormat.Compression theCompression)`
  `static RDFFormat`
  `compressedForName(RDFFormat theFormat, String theName)`
  Return the `compressed RDFFormat` for the given name, with the provided base format.
  `static FileFormat.Compression`
  `compressionOf(RDFFormat theFormat)`
  Returns the `compression` of given format if it is a `compressed format` or `FileFormat.Compression.NONE` otherwise.
  `static RDFFormat`
  `forFile(File theFile, RDFFormat theBaseFormat)`
  `static Optional<RDFFormat>`
  `forFile(String theFileName)`
  `static RDFFormat`
  `forFile(String theFileName, RDFFormat theBaseFormat)`
  `static Optional<RDFFormat>`
  `forFile(Path thePath)`
  Return the `format` for the file denoted by the given `Path`.
  `static Optional<RDFFormat>`
  `forMime(String theMime)`
  Return the `format` which supports the given mimetype
  `static Optional<RDFFormat>`
  `forName(String theName)`
  Return the `format` with the provided name
  `static RDFFormat`
  `register(String theName, IRI theId, List<String> theMimetypes, List<String> theFileExtensions)`
  Create a new `RDFFormats.RDFFormatImpl`
  `static RDFFormat.BinaryRDFFormat`
  `registerBinary(String theName, IRI theId, List<String> theMimetypes, List<String> theFileExtensions)`
  Create a new `RDFFormat.BinaryRDFFormat`
  `static boolean`
  `supportsContexts(RDFFormat theFormat)`
  Return whether or not the format is capable of serializing the context information for a `Statement`.

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

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

- ## Field Details

  - ### UNKNOWN_BASE_FORMAT

    public static RDFFormat UNKNOWN_BASE_FORMAT

  - ### TURTLE

    public static final RDFFormat TURTLE
    Format denoting [Turtle](https://www.w3.org/TR/turtle/)

  - ### PRETTY_TURTLE

    public static final RDFFormat PRETTY_TURTLE

  - ### NTRIPLES

    public static final RDFFormat NTRIPLES
    [N-triples](http://www.w3.org/TR/n-triples/)

  - ### NQUADS

    public static final RDFFormat NQUADS
    [NQuads](http://www.w3.org/TR/n-quads/)

  - ### RDFXML

    public static final RDFFormat RDFXML
    [RDF/XML](http://www.w3.org/TR/rdf-syntax-grammar/)

  - ### N3

    public static final RDFFormat N3
    [Notation 3](http://www.w3.org/TeamSubmission/n3/)

  - ### TRIG

    public static final RDFFormat TRIG
    [TriG](http://www.w3.org/TR/trig)

  - ### RDFJSON

    public static final RDFFormat RDFJSON
    [RDF/JSON](http://www.w3.org/TR/rdf-json/)

  - ### BINARY

    public static final RDFFormat BINARY
    Binary RDF

  - ### JSONLD

    public static final RDFFormat JSONLD
    [JSON-LD](ttp://www.w3.org/TR/json-ld/)

- ## Method Details

  - ### forFile

    @Nonnull public static Optional<RDFFormat> forFile(@Nonnull Path thePath)
    Return the `format` for the file denoted by the given `Path`. If none can be determined
    Parameters:
      `thePath` - the file to be parsed
    Returns:
      the RDF format

  - ### forName

    @Nonnull public static Optional<RDFFormat> forName(@Nonnull String theName)
    Return the `format` with the provided name
    Parameters:
      `theName` - the name of the format
    Returns:
      the `format`

  - ### forMime

    @Nonnull public static Optional<RDFFormat> forMime(@Nonnull String theMime)
    Return the `format` which supports the given mimetype
    Parameters:
      `theMime` - the mimetype
    Returns:
      the `format` that supports the mimetype
    Implementation Notes:
      The default mimetypes are checked for _all_ formats before the full set of mimetypes for each format are considered.

  - ### compressedForName

    @Nonnull public static RDFFormat compressedForName(RDFFormat theFormat, String theName)
    Return the `compressed RDFFormat` for the given name, with the provided base format.
    Parameters:
      `theFormat` -
      `theName` -
    Returns:

  - ### compressedFormat

    @Nonnull public static RDFFormat compressedFormat(RDFFormat theFormat, FileFormat.Compression theCompression)

  - ### forFile

    public static RDFFormat forFile(File theFile, RDFFormat theBaseFormat)

  - ### forFile

    public static Optional<RDFFormat> forFile(String theFileName)

  - ### forFile

    public static RDFFormat forFile(String theFileName, RDFFormat theBaseFormat)

  - ### baseFormat

    public static RDFFormat baseFormat(RDFFormat theFormat)
    Returns the `base format` of the given format if it is a `compressed format` or the given format otherwise.
    Parameters:
      `theFormat` - input format
    Returns:
      the `base format` of the given format if it is a `compressed format` or the given format otherwise.

  - ### compressionOf

    @Nonnull public static FileFormat.Compression compressionOf(RDFFormat theFormat)
    Returns the `compression` of given format if it is a `compressed format` or `FileFormat.Compression.NONE` otherwise.
    Parameters:
      `theFormat` - input format
    Returns:
      the `compression` of given format if it is a `compressed format` or `FileFormat.Compression.NONE` otherwise.

  - ### supportsContexts

    public static boolean supportsContexts(@Nonnull RDFFormat theFormat)
    Return whether or not the format is capable of serializing the context information for a `Statement`.
    Parameters:
      `theFormat` - the format
    Returns:
      `true` if the format can serialize quads, `false` otherwise

  - ### register

    public static RDFFormat register(@Nonnull String theName, @Nonnull IRI theId, @Nonnull List<String> theMimetypes, @Nonnull List<String> theFileExtensions)
    Create a new `RDFFormats.RDFFormatImpl`
    Parameters:
      `theName` - the human-friendly name of the format
      `theId` - the IRI of the format
      `theMimetypes` - the list of supported mimetypes. There must be *at least* `1`, and the first element in the list is taken to be the default mimetype
      `theFileExtensions` - the list of supported extensions. There must be *at least* `1`, and the first element in the list is taken to be the default extension

  - ### registerBinary

    public static RDFFormat.BinaryRDFFormat registerBinary(@Nonnull String theName, @Nonnull IRI theId, @Nonnull List<String> theMimetypes, @Nonnull List<String> theFileExtensions)
    Create a new `RDFFormat.BinaryRDFFormat`
    Parameters:
      `theName` - the human-friendly name of the format
      `theId` - the IRI of the format
      `theMimetypes` - the list of supported mimetypes. There must be *at least* `1`, and the first element in the list is taken to be the default mimetype
      `theFileExtensions` - the list of supported extensions. There must be *at least* `1`, and the first element in the list is taken to be the default extension