Package org.restlet.ext.rdf.internal.n3
Class RdfN3Reader
- java.lang.Object
-
- org.restlet.ext.rdf.internal.RdfReader
-
- org.restlet.ext.rdf.internal.ntriples.RdfNTriplesReader
-
- org.restlet.ext.rdf.internal.turtle.RdfTurtleReader
-
- org.restlet.ext.rdf.internal.n3.RdfN3Reader
-
public class RdfN3Reader extends RdfTurtleReader
Handler of RDF content according to the N3 notation.
-
-
Field Summary
-
Fields inherited from class org.restlet.ext.rdf.internal.ntriples.RdfNTriplesReader
EOF
-
-
Constructor Summary
Constructors Constructor Description RdfN3Reader(Representation rdfN3Representation, GraphHandler graphHandler)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidgenerateLinks(java.util.List<LexicalUnit> lexicalUnits)Loops over the given list of lexical units and generates the adequat calls to link* methods.private ReferencegetPredicate(LexicalUnit lexicalUnit)Returns the given lexical unit as a predicate.protected booleanisDelimiter(int c)Returns true if the given character is a delimiter.protected booleanisPath(LexicalUnit lexicalUnit)Returns true if the given lexical unit is a "path" shorthand.protected voidlink(java.lang.Object source, Reference typeRef, java.lang.Object target)Callback method used when a link is parsed or written.protected voidparseBlankNode(BlankNodeToken blankNode)Parse the given blank node.protected voidparseFormula(FormulaToken formulaToken)Parses the given formula token.protected voidparseList(ListToken listToken)Parse the given list token.protected voidparseStatement(Context context)Reads the current statement until its end, and parses it.-
Methods inherited from class org.restlet.ext.rdf.internal.turtle.RdfTurtleReader
getContext, newBlankNodeId, parse, parseDirective, parseString, parseToken, parseUri
-
Methods inherited from class org.restlet.ext.rdf.internal.ntriples.RdfNTriplesReader
consumeStatement, consumeWhiteSpaces, discard, getChar, getCurrentToken, getParsingMessage, getParsingMessage, isAlphaNum, isEndOfFile, isWhiteSpace, parseComment, parseStatement, parseToken, parseUri, step, step, stepBack, stepBack
-
Methods inherited from class org.restlet.ext.rdf.internal.RdfReader
getGraphHandler, getRdfRepresentation
-
-
-
-
Constructor Detail
-
RdfN3Reader
public RdfN3Reader(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
-
generateLinks
protected void generateLinks(java.util.List<LexicalUnit> lexicalUnits)
Description copied from class:RdfTurtleReaderLoops over the given list of lexical units and generates the adequat calls to link* methods.- Overrides:
generateLinksin classRdfTurtleReader- Parameters:
lexicalUnits- The list of lexical units used to generate the links.- See Also:
GraphHandler.link(Graph, Reference, Reference),GraphHandler.link(Reference, Reference, Literal),GraphHandler.link(Reference, Reference, Reference)
-
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)
Description copied from class:RdfTurtleReaderReturns true if the given character is a delimiter.- Overrides:
isDelimiterin classRdfTurtleReader- Parameters:
c- The given character to check.- Returns:
- true if the given character is a delimiter.
-
isPath
protected boolean isPath(LexicalUnit lexicalUnit)
Returns true if the given lexical unit is a "path" shorthand.- Parameters:
lexicalUnit- The lexical unit to analyse.- Returns:
- True if the given lexical unit is a "path" shorthand.
-
link
protected void link(java.lang.Object source, Reference typeRef, java.lang.Object target)Callback method used when a link is parsed or written.- Overrides:
linkin classRdfTurtleReader- Parameters:
source- The source or subject of the link.typeRef- The type reference of the link.target- The target or object of the link.
-
parseBlankNode
protected void parseBlankNode(BlankNodeToken blankNode) throws java.io.IOException
Description copied from class:RdfTurtleReaderParse the given blank node.- Overrides:
parseBlankNodein classRdfTurtleReader- Parameters:
blankNode- The blank node to parse.- Throws:
java.io.IOException
-
parseFormula
protected void parseFormula(FormulaToken formulaToken) throws java.io.IOException
Parses the given formula token.- Parameters:
formulaToken- The formula token to parse.- Throws:
java.io.IOException
-
parseList
protected void parseList(ListToken listToken) throws java.io.IOException
Description copied from class:RdfTurtleReaderParse the given list token.- Overrides:
parseListin classRdfTurtleReader- Parameters:
listToken- The list token to parse.- Throws:
java.io.IOException
-
parseStatement
protected void parseStatement(Context context) throws java.io.IOException
Description copied from class:RdfTurtleReaderReads the current statement until its end, and parses it.- Overrides:
parseStatementin classRdfTurtleReader- Parameters:
context- The current context.- Throws:
java.io.IOException
-
-