org.eclipse.rdf4j.rio.hdt

## Class HDTParser

- java.lang.Object
- - org.eclipse.rdf4j.rio.helpers.AbstractRDFParser
  - - org.eclipse.rdf4j.rio.hdt.HDTParser

- All Implemented Interfaces:
    RDFParser

      public class HDTParser
      extends AbstractRDFParser

  RDF parser for HDT v1.0 files. This parser is not thread-safe, therefore its public methods are synchronized. Unfortunately the draft specification is not entirely clear and probably slightly out of date, since the open source reference implementation HDT-It seems to implement a slightly different version. This parser tries to be compatible with HDT-It 1.0. The most important parts are the Dictionaries containing the actual values (S, P, O part of a triple), and the Triples containing the numeric references to construct the triples. Since objects in one triple are often subjects in another triple, these "shared" parts are stored in a shared Dictionary, which may significantly reduce the file size. File structure:

       +---------------------+
       | Global              |
       | Header              |
       | Dictionary (Shared) |
       | Dictionary (S)      |
       | Dictionary (P)      |
       | Dictionary (O)      |
       | Triples             |
       +---------------------+

  Author:
    Bart Hanssens
  See Also:
    HDT draft (2015), W3C Member Submission (2011)

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.eclipse.rdf4j.rio.RDFParser

      `RDFParser.DatatypeHandling`

  - ### Field Summary

    - ### Fields inherited from class org.eclipse.rdf4j.rio.helpers.AbstractRDFParser

      `rdfHandler, valueFactory`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HDTParser()` Creates a new HDTParser that will use a `SimpleValueFactory` to create RDF model objects.
    `HDTParser(ValueFactory valueFactory)` Creates a new HDTParser that will use the supplied ValueFactory to create RDF model objects.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `RDFFormat` | `getRDFFormat()` Gets the RDF format that this parser can parse.
    `Collection<RioSetting<?>>` | `getSupportedSettings()`
    `void` | `parse(InputStream in, String baseURI)` Implementation of the `parse(InputStream, String)` method defined in the RDFParser interface.
    `void` | `parse(Reader reader, String baseURI)` Not supported, since HDT is a binary format.

    - ### Methods inherited from class org.eclipse.rdf4j.rio.helpers.AbstractRDFParser

      `clear, clearBNodeIDMap, createBNode, createBNode, createLiteral, createLiteral, createNode, createNode, createStatement, createStatement, createURI, datatypeHandling, getNamespace, getParseErrorListener, getParseLocationListener, getParserConfig, getRDFHandler, initializeNamespaceTableFromConfiguration, preserveBNodeIDs, reportError, reportError, reportError, reportError, reportError, reportFatalError, reportFatalError, reportFatalError, reportFatalError, reportFatalError, reportLocation, reportWarning, reportWarning, resolveURI, set, setBaseURI, setBaseURI, setDatatypeHandling, setNamespace, setParseErrorListener, setParseLocationListener, setParserConfig, setPreserveBNodeIDs, setRDFHandler, setStopAtFirstError, setValueFactory, setVerifyData, stopAtFirstError, verifyData`

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

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

- - ### Constructor Detail

    - #### HDTParser

          public HDTParser()

      Creates a new HDTParser that will use a `SimpleValueFactory` to create RDF model objects.

    - #### HDTParser

          public HDTParser(ValueFactory valueFactory)

      Creates a new HDTParser that will use the supplied ValueFactory to create RDF model objects.
      Parameters:
        `valueFactory` - A ValueFactory.

  - ### Method Detail

    - #### getRDFFormat

          public RDFFormat getRDFFormat()

      Description copied from interface: `RDFParser`
      Gets the RDF format that this parser can parse.

    - #### getSupportedSettings

          public Collection<RioSetting<?>> getSupportedSettings()

      Specified by:
        `getSupportedSettings` in interface `RDFParser`
      Overrides:
        `getSupportedSettings` in class `AbstractRDFParser`
      Returns:
        A collection of `RioSetting`s that are supported by this RDFParser.

    - #### parse

          public void parse(InputStream in,
                            String baseURI)
                     throws IOException,
                            RDFParseException,
                            RDFHandlerException

      Implementation of the `parse(InputStream, String)` method defined in the RDFParser interface.
      Parameters:
        `in` - The InputStream from which to read the data, must not be `null`.
        `baseURI` - The URI associated with the data in the InputStream, must not be `null`.
      Throws:
        `IOException` - If an I/O error occurred while data was read from the InputStream.
        `RDFParseException` - If the parser has found an unrecoverable parse error.
        `RDFHandlerException` - If the configured statement handler encountered an unrecoverable error.
        `IllegalArgumentException` - If the supplied input stream or base URI is `null`.

    - #### parse

          public void parse(Reader reader,
                            String baseURI)
                     throws IOException,
                            RDFParseException,
                            RDFHandlerException

      Not supported, since HDT is a binary format.
      Parameters:
        `reader` - The Reader from which to read the data.
        `baseURI` - The URI associated with the data in the InputStream.
      Throws:
        `IOException` - If an I/O error occurred while data was read from the InputStream.
        `RDFParseException` - If the parser has found an unrecoverable parse error.
        `RDFHandlerException` - If the configured statement handler has encountered an unrecoverable error.

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