Class NDJSONLDParser

All Implemented Interfaces:
RDFParser

public class NDJSONLDParser extends JSONLDParser
Introduce a parser capable of parsing Newline Delimited JSON-LD, where each line is a serialized JSON-LD record. The format is inspired by Newline Delimited JSON formathttp://ndjson.org/. Even though each line is a separate JSON-LD document, the whole document is treated as a single RDF document, having one single BNodes context to preserve BNodes identifiers.
Author:
Desislava Hristova
  • Constructor Details

    • NDJSONLDParser

      public NDJSONLDParser()
      Default constructor
    • NDJSONLDParser

      public NDJSONLDParser(ValueFactory valueFactory)
      Creates a RDF4J NDJSONLD Parser using the given ValueFactory to create new Values.
      Parameters:
      valueFactory - The ValueFactory to use
  • Method Details

    • getRDFFormat

      public RDFFormat getRDFFormat()
      Description copied from interface: RDFParser
      Gets the RDF format that this parser can parse.
      Specified by:
      getRDFFormat in interface RDFParser
      Overrides:
      getRDFFormat in class JSONLDParser
    • getDocument

      protected no.hasmac.jsonld.document.Document getDocument(InputStream in, Reader reader) throws no.hasmac.jsonld.JsonLdError, IOException
      Description copied from class: JSONLDParser
      This method is overridden by the NDJSONLDParser
      Overrides:
      getDocument in class JSONLDParser
      Parameters:
      in -
      reader -
      Returns:
      Throws:
      no.hasmac.jsonld.JsonLdError
      IOException
    • parse

      public void parse(InputStream in, String baseURI) throws RDFParseException, RDFHandlerException, IOException
      Description copied from interface: RDFParser
      Parses the data from the supplied InputStream, using the supplied baseURI to resolve any relative URI references.
      Specified by:
      parse in interface RDFParser
      Overrides:
      parse in class JSONLDParser
      Parameters:
      in - The InputStream from which to read the data.
      baseURI - The URI associated with the data in the InputStream. May be null. Parsers for syntax formats that do not support relative URIs will ignore this argument.

      Note that if the data contains an embedded base URI, that embedded base URI will overrule the value supplied here (see RFC 3986 section 5.1 for details).

      Throws:
      RDFParseException - If the parser has found an unrecoverable parse error.
      RDFHandlerException - If the configured statement handler has encountered an unrecoverable error.
      IOException - If an I/O error occurred while data was read from the InputStream.