Class RdfTurtleReader

  • Direct Known Subclasses:
    RdfN3Reader

    public class RdfTurtleReader
    extends RdfNTriplesReader
    Handler of RDF content according to the RDF Turtle notation.
    • Field Detail

      • blankNodeId

        private int blankNodeId
        Increment used to identify inner blank nodes.
      • context

        private Context context
        The current context object.
    • Constructor Detail

      • RdfTurtleReader

        public RdfTurtleReader​(Representation rdfN3Representation,
                               GraphHandler graphHandler)
                        throws java.io.IOException
        Constructor.
        Parameters:
        rdfRepresentation - The representation to read.
        graphHandler - The graph handler invoked during the parsing.
        Throws:
        java.io.IOException
    • Method Detail

      • getContext

        protected Context getContext()
        Returns the current context.
        Returns:
        The current context.
      • getPredicate

        private Reference getPredicate​(LexicalUnit lexicalUnit)
        Returns the given lexical unit as a predicate.
        Parameters:
        lexicalUnit - The lexical unit to get as a predicate.
        Returns:
        A RDF URI reference of the predicate.
      • isDelimiter

        protected boolean isDelimiter​(int c)
        Returns true if the given character is a delimiter.
        Overrides:
        isDelimiter in class RdfNTriplesReader
        Parameters:
        c - The given character to check.
        Returns:
        true if the given character is a delimiter.
      • link

        protected void link​(java.lang.Object source,
                            Reference typeRef,
                            java.lang.Object target)
        Callback method used when a link is parsed or written.
        Parameters:
        source - The source or subject of the link.
        typeRef - The type reference of the link.
        target - The target or object of the link.
      • newBlankNodeId

        protected java.lang.String newBlankNodeId()
        Returns the identifier of a new blank node.
        Returns:
        The identifier of a new blank node.
      • parse

        public void parse()
                   throws java.io.IOException
        Parses the current representation.
        Overrides:
        parse in class RdfNTriplesReader
        Throws:
        java.io.IOException
      • parseBlankNode

        protected void parseBlankNode​(BlankNodeToken blankNode)
                               throws java.io.IOException
        Parse the given blank node.
        Parameters:
        blankNode - The blank node to parse.
        Throws:
        java.io.IOException
      • parseDirective

        protected void parseDirective​(Context context)
                               throws java.io.IOException
        Parse the current directive and update the context according to the kind of directive ("base", "prefix", etc).
        Parameters:
        context - The context to update.
        Throws:
        java.io.IOException
      • parseList

        protected void parseList​(ListToken listToken)
                          throws java.io.IOException
        Parse the given list token.
        Parameters:
        listToken - The list token to parse.
        Throws:
        java.io.IOException
      • parseStatement

        protected void parseStatement​(Context context)
                               throws java.io.IOException
        Reads the current statement until its end, and parses it.
        Parameters:
        context - The current context.
        Throws:
        java.io.IOException
      • parseString

        protected void parseString​(StringToken stringToken)
                            throws java.io.IOException
        Parse the given String token.
        Parameters:
        stringToken - The String token to parse.
        Throws:
        java.io.IOException
      • parseToken

        protected void parseToken​(Token token)
                           throws java.io.IOException
        Parses the given token.
        Parameters:
        token - The token to parse.
        Throws:
        java.io.IOException
      • parseUri

        protected void parseUri​(UriToken uriToken)
                         throws java.io.IOException
        Parses the given URI token.
        Parameters:
        token - The URI token to parse.
        Throws:
        java.io.IOException