Package com.stardog.stark.io.turtle

# Class TurtleParser

java.lang.Object
com.stardog.stark.io.turtle.TurtleParser

All Implemented Interfaces:
  `RDFParser`

Direct Known Subclasses:
  `TrigParser`

public class TurtleParser extends Object implements RDFParser

Default parser for the Turtle RDF syntax

Since:
  1.0
Version:
  1.0
Author:
  Michael Grove, Arjohn Kampman
Implementation Notes:
  This class is non-final due to reuse of the parser for TriG parsing

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TurtleParser()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `RDFFormat`
  `format()`
  The format this parser can parse
  `void`
  `parse(InputStream theStream, RDFHandler theHandler, Options theOptions)`
  Parse the content
  `protected void`
  `parseBase(IOParserContext theContext)`
  `protected Resource`
  `parseCollection(TurtleParserContext theContext)`
  `protected boolean`
  `parseDirective(TurtleParserContext theContext, String directive)`
  `protected Statement`
  `parseEmbeddedTriple(IOParserContext theContext)`
  Parse an embedded triple, allowing subsequent predicate-object pairs to annotate this statement.
  `protected Resource`
  `parseImplicitBlank(TurtleParserContext theContext)`
  `protected String`
  `parseLongString(IOParserContext theContext, int closingCharacter)`
  `protected BNode`
  `parseNodeID(IOParserContext theContext)`
  `protected Literal`
  `parseNumber(IOParserContext theContext)`
  `protected void`
  `parseObject(TurtleParserContext theContext)`
  `protected void`
  `parseObjectList(TurtleParserContext theContext)`
  `protected IRI`
  `parsePredicate(IOParserContext theContext)`
  `protected void`
  `parsePredicateObjectList(TurtleParserContext theContext)`
  `protected IRI`
  `parsePredicateWithEdgeProperties(TurtleParserContext theContext)`
  `protected void`
  `parsePrefixID(IOParserContext theContext)`
  `protected Value`
  `parseQNameOrBoolean(IOParserContext theContext)`
  `protected Literal`
  `parseQuotedLiteral(IOParserContext theContext)`
  `protected String`
  `parseQuotedString(IOParserContext theContext)`
  `protected void`
  `parseStatement(TurtleParserContext theContext)`
  `protected String`
  `parseString(IOParserContext theContext, int closingCharacter)`
  `protected void`
  `parseSubject(TurtleParserContext theContext)`
  `protected Resource`
  `parseSubjectResource(IOParserContext theContext)`
  `protected void`
  `parseTriples(TurtleParserContext theContext)`
  `protected IRI`
  `parseURI(IOParserContext theContext)`
  `protected Value`
  `parseValue(IOParserContext theContext)`
  `protected void`
  `processComment(IOParserContext theContext)`
  `protected int`
  `skipWSC(IOParserContext theContext)`

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

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

  ### Methods inherited from interface com.stardog.stark.io.RDFParser

  `parse`

- ## Constructor Details

  - ### TurtleParser

    public TurtleParser()

- ## Method Details

  - ### format

    @Nonnull public RDFFormat format()
    The format this parser can parse
    Specified by:
      `format` in interface `RDFParser`
    Returns:
      the format

  - ### parse

    public void parse(@Nonnull InputStream theStream, @Nonnull RDFHandler theHandler, @Nonnull Options theOptions) throws IOException
    Parse the content
    Specified by:
      `parse` in interface `RDFParser`
    Parameters:
      `theStream` - the stream to read from
      `theHandler` - the handler to pass parse events to
      `theOptions` - the parsing options
    Throws:
      `IOException` - if there was an error while reading from the stream

  - ### parseStatement

    protected void parseStatement(TurtleParserContext theContext) throws IOException, InvalidRDF, RDFHandlerException
    Throws:
      `IOException`
      `InvalidRDF`
      `RDFHandlerException`

  - ### parseTriples

    protected void parseTriples(@Nonnull TurtleParserContext theContext) throws IOException, InvalidRDF, RDFHandlerException
    Throws:
      `IOException`
      `InvalidRDF`
      `RDFHandlerException`

  - ### parseEmbeddedTriple

    protected Statement parseEmbeddedTriple(IOParserContext theContext) throws IOException, InvalidRDF, RDFHandlerException
    Parse an embedded triple, allowing subsequent predicate-object pairs to annotate this statement.
    Returns:
      the Statement found.
    Throws:
      `IOException`
      `InvalidRDF`
      `RDFHandlerException`

  - ### parsePredicateObjectList

    protected void parsePredicateObjectList(@Nonnull TurtleParserContext theContext) throws IOException, InvalidRDF, RDFHandlerException
    Throws:
      `IOException`
      `InvalidRDF`
      `RDFHandlerException`

  - ### parsePredicateWithEdgeProperties

    protected IRI parsePredicateWithEdgeProperties(@Nonnull TurtleParserContext theContext) throws IOException, InvalidRDF
    Throws:
      `IOException`
      `InvalidRDF`

  - ### parsePredicate

    protected IRI parsePredicate(@Nonnull IOParserContext theContext) throws IOException, InvalidRDF
    Throws:
      `IOException`
      `InvalidRDF`

  - ### parseObjectList

    protected void parseObjectList(@Nonnull TurtleParserContext theContext) throws IOException, InvalidRDF, RDFHandlerException
    Throws:
      `IOException`
      `InvalidRDF`
      `RDFHandlerException`

  - ### parseSubject

    protected void parseSubject(@Nonnull TurtleParserContext theContext) throws IOException, InvalidRDF, RDFHandlerException
    Throws:
      `IOException`
      `InvalidRDF`
      `RDFHandlerException`

  - ### parseSubjectResource

    protected Resource parseSubjectResource(@Nonnull IOParserContext theContext) throws IOException
    Throws:
      `IOException`

  - ### parseObject

    protected void parseObject(@Nonnull TurtleParserContext theContext) throws IOException, InvalidRDF, RDFHandlerException
    Throws:
      `IOException`
      `InvalidRDF`
      `RDFHandlerException`

  - ### parseCollection

    protected Resource parseCollection(@Nonnull TurtleParserContext theContext) throws IOException, InvalidRDF, RDFHandlerException
    Throws:
      `IOException`
      `InvalidRDF`
      `RDFHandlerException`

  - ### parseImplicitBlank

    protected Resource parseImplicitBlank(@Nonnull TurtleParserContext theContext) throws IOException, InvalidRDF, RDFHandlerException
    Throws:
      `IOException`
      `InvalidRDF`
      `RDFHandlerException`

  - ### parseValue

    protected Value parseValue(@Nonnull IOParserContext theContext) throws IOException, InvalidRDF
    Throws:
      `IOException`
      `InvalidRDF`

  - ### parseURI

    protected IRI parseURI(@Nonnull IOParserContext theContext) throws IOException, InvalidRDF
    Throws:
      `IOException`
      `InvalidRDF`

  - ### parseQNameOrBoolean

    protected Value parseQNameOrBoolean(@Nonnull IOParserContext theContext) throws IOException, InvalidRDF
    Throws:
      `IOException`
      `InvalidRDF`

  - ### parseNodeID

    protected BNode parseNodeID(@Nonnull IOParserContext theContext) throws IOException, InvalidRDF
    Throws:
      `IOException`
      `InvalidRDF`

  - ### parseQuotedLiteral

    protected Literal parseQuotedLiteral(@Nonnull IOParserContext theContext) throws IOException, InvalidRDF
    Throws:
      `IOException`
      `InvalidRDF`

  - ### parseQuotedString

    protected String parseQuotedString(@Nonnull IOParserContext theContext) throws IOException, InvalidRDF
    Throws:
      `IOException`
      `InvalidRDF`

  - ### parseString

    protected String parseString(@Nonnull IOParserContext theContext, int closingCharacter) throws IOException, InvalidRDF
    Throws:
      `IOException`
      `InvalidRDF`

  - ### parseLongString

    protected String parseLongString(@Nonnull IOParserContext theContext, int closingCharacter) throws IOException, InvalidRDF
    Throws:
      `IOException`
      `InvalidRDF`

  - ### parseNumber

    protected Literal parseNumber(@Nonnull IOParserContext theContext) throws IOException, InvalidRDF
    Throws:
      `IOException`
      `InvalidRDF`

  - ### parseDirective

    protected boolean parseDirective(TurtleParserContext theContext, String directive) throws IOException
    Throws:
      `IOException`

  - ### parsePrefixID

    protected void parsePrefixID(@Nonnull IOParserContext theContext) throws IOException, InvalidRDF, RDFHandlerException
    Throws:
      `IOException`
      `InvalidRDF`
      `RDFHandlerException`

  - ### parseBase

    protected void parseBase(@Nonnull IOParserContext theContext) throws IOException, InvalidRDF, RDFHandlerException
    Throws:
      `IOException`
      `InvalidRDF`
      `RDFHandlerException`

  - ### skipWSC

    protected int skipWSC(IOParserContext theContext) throws RDFHandlerException, IOException
    Throws:
      `RDFHandlerException`
      `IOException`

  - ### processComment

    protected void processComment(IOParserContext theContext) throws RDFHandlerException, IOException
    Throws:
      `RDFHandlerException`
      `IOException`