Class SPARQLUpdateDataBlockParser
java.lang.Object
org.eclipse.rdf4j.rio.helpers.AbstractRDFParser
org.eclipse.rdf4j.rio.turtle.TurtleParser
org.eclipse.rdf4j.rio.trig.TriGParser
org.eclipse.rdf4j.rio.trigstar.TriGStarParser
org.eclipse.rdf4j.query.parser.sparql.SPARQLUpdateDataBlockParser
- All Implemented Interfaces:
RDFParser
- Direct Known Subclasses:
SPARQLUpdateDataBlockParser
An extension of
TriGStarParser that processes data in the format specified in the SPARQL 1.1 grammar for Quad
data (assuming no variables, as is the case for INSERT DATA and DELETE DATA operations). This format is almost
completely compatible with TriG, except for three differences:
- it introduces the 'GRAPH' keyword in front of each named graph identifier
- it does not allow the occurrence of blank nodes.
- it does not require curly braces around the default graph.
- it adds support for RDF-star triples (from TriG-star).
- Author:
- Jeen Broekstra
- See Also:
-
Field Summary
Fields inherited from class TurtleParser
object, predicate, subjectFields inherited from class AbstractRDFParser
rdfHandler, valueFactoryModifier and TypeFieldDescriptionprotected RDFHandlerThe RDFHandler that will handle the parsed RDF.protected ValueFactoryThe ValueFactory to use for creating RDF model objects. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new parser that will use aSimpleValueFactoryto create RDF model objects.SPARQLUpdateDataBlockParser(ValueFactory valueFactory) Creates a new parser that will use the supplied ValueFactory to create RDF model objects. -
Method Summary
Modifier and TypeMethodDescriptionprotected intGets the RDF format that this parser can parse.booleanprotected voidprotected ResourceParses an implicit blank node.protected ResourceParses a blank node ID, e.g.voidsetAllowBlankNodes(boolean allowBlankNodes) voidsetLineNumberOffset(int lineNumberOffset) Methods inherited from class TriGStarParser
parseValue, setContextModifier and TypeMethodDescriptionprotected ValueParses an RDF value.protected voidsetContext(Resource context) Methods inherited from class TriGParser
getContext, parseStatement, parseTriples, reportStatementModifier and TypeMethodDescriptionprotected Resourceprotected voidprotected voidprotected voidreportStatement(Resource subj, IRI pred, Value obj) Methods inherited from class TurtleParser
getSupportedSettings, parse, parse, parseAnnotation, parseBase, parseCollection, parseDirective, parseLongString, parseNumber, parseObject, parseObjectList, parsePredicate, parsePredicateObjectList, parsePrefixID, parseQNameOrBoolean, parseQuotedLiteral, parseQuotedString, parseString, parseSubject, parseTripleValue, parseURI, peekCodePoint, peekIsTripleValue, processComment, readCodePoint, reportError, reportFatalError, reportFatalError, reportLocation, reportWarning, skipWSC, throwEOFException, unread, unread, verifyCharacterOrFailModifier and TypeMethodDescriptionCollection<RioSetting<?>> voidparse(InputStream in, String baseURI) Parses the data from the supplied InputStream, using the supplied baseURI to resolve any relative URI references.voidParses the data from the supplied Reader, using the supplied baseURI to resolve any relative URI references.protected voidprotected voidprotected ResourceParses a collection, e.g.protected voidparseDirective(String directive) protected StringparseLongString(int closingCharacter) Parses a """long string""".protected Literalprotected voidParse an objectprotected voidprotected IRIprotected voidprotected voidprotected ValueParses qnames and boolean values, which have equivalent starting characters.protected LiteralParses a quoted string, optionally followed by a language tag or datatype.protected StringParses a quoted string, which is either a "normal string" or a """long string""".protected StringparseString(int closingCharacter) Parses a "normal string".protected voidprotected TripleParser an RDF-star triple value and returns it.protected IRIparseURI()protected intPeeks at the next Unicode code point without advancing the reader, and returns its value.protected booleanPeeks at the next two Unicode code points without advancing the reader and returns true if they indicate the start of an RDF-star triple value.protected voidConsumes characters from reader until the first EOL has been read.protected intReads the next Unicode code point.protected voidreportError(String msg, RioSetting<Boolean> setting) OverridesAbstractRDFParser.reportError(String, RioSetting), adding line number information to the error.protected voidOverridesAbstractRDFParser.reportFatalError(Exception), adding line number information to the error.protected voidreportFatalError(String msg) OverridesAbstractRDFParser.reportFatalError(String), adding line number information to the error.protected voidprotected voidreportWarning(String msg) OverridesAbstractRDFParser.reportWarning(String), adding line number information to the error.protected intskipWSC()Consumes any white space characters (space, tab, line feed, newline) and comments (#-style) from reader.protected voidprotected voidunread(int codePoint) Pushes back a single code point by copying it to the front of the buffer.protected voidPushes back the supplied string by copying it to the front of the buffer.protected voidverifyCharacterOrFail(int codePoint, String expected) Verifies that the supplied character code point codePoint is one of the expected characters specified in expected.Methods inherited from class AbstractRDFParser
clear, clearBNodeIDMap, createBNode, createBNode, createLiteral, createLiteral, createLiteral, createNode, createNode, createStatement, createStatement, createURI, getNamespace, getParseErrorListener, getParseLocationListener, getParserConfig, getRDFHandler, initializeNamespaceTableFromConfiguration, preserveBNodeIDs, reportError, reportError, reportError, reportError, reportFatalError, reportFatalError, reportFatalError, reportLocation, reportWarning, resolveURI, set, setBaseURI, setBaseURI, setNamespace, setParseErrorListener, setParseLocationListener, setParserConfig, setPreserveBNodeIDs, setRDFHandler, setValueFactoryModifier and TypeMethodDescriptionprotected voidclear()Clears any information that has been collected while parsing.protected voidDeprecated.protected BNodeDeprecated.protected BNodecreateBNode(String nodeID) Deprecated.protected LiteralcreateLiteral(String label, String lang, CoreDatatype datatype, long lineNo, long columnNo) Creates aLiteralobject with the supplied parameters, using the lineNo and columnNo to enhance error messages or exceptions that may be generated during the creation of the literal.protected LiteralcreateLiteral(String label, String lang, IRI datatype) Creates aLiteralobject with the supplied parameters.protected LiteralcreateLiteral(String label, String lang, IRI datatype, long lineNo, long columnNo) Creates aLiteralobject with the supplied parameters, using the lineNo and columnNo to enhance error messages or exceptions that may be generated during the creation of the literal.protected Resourceprotected ResourcecreateNode(String nodeID) protected StatementcreateStatement(Resource subj, IRI pred, Value obj) Creates a newStatementobject with the supplied components.protected StatementcreateStatement(Resource subj, IRI pred, Value obj, Resource context) Creates a newStatementobject with the supplied components.protected IRICreates aIRIobject for the specified URI-string.protected StringgetNamespace(String prefix) Gets the namespace that is associated with the specified prefix or throws anRDFParseException.Retrieves the current parser configuration as a single object.protected voidbooleanprotected voidreportError(Exception e, long lineNo, long columnNo, RioSetting<Boolean> relevantSetting) Reports an error with associated line- and column number to the registered ParseErrorListener, if the given setting has been set to true.protected voidreportError(Exception e, RioSetting<Boolean> relevantSetting) Reports an error with associated line- and column number to the registered ParseErrorListener, if the given setting has been set to true.protected voidreportError(String msg, long lineNo, long columnNo, RioSetting<Boolean> relevantSetting) Reports an error with associated line- and column number to the registered ParseErrorListener, if the given setting has been set to true.protected voidreportError(String msg, Exception e, long lineNo, long columnNo, RioSetting<Boolean> relevantSetting) Reports an error with associated line- and column number to the registered ParseErrorListener, if the given setting has been set to true.protected voidreportFatalError(Exception e, long lineNo, long columnNo) Reports a fatal error with associated line- and column number to the registered ParseErrorListener, if any, and throws a ParseException wrapped the supplied exception afterwards.protected voidreportFatalError(String msg, long lineNo, long columnNo) Reports a fatal error with associated line- and column number to the registered ParseErrorListener, if any, and throws a ParseException afterwards.protected voidreportFatalError(String message, Exception e, long lineNo, long columnNo) Reports a fatal error with associated line- and column number to the registered ParseErrorListener, if any, and throws a ParseException wrapped the supplied exception afterwards.protected voidreportLocation(long lineNo, long columnNo) Reports the specified line- and column number to the registeredParseLocationListener, if any.protected voidreportWarning(String msg, long lineNo, long columnNo) Reports a warning with associated line- and column number to the registered ParseErrorListener, if any.protected IRIresolveURI(String uriSpec) Resolves a URI-string against the base URI and creates aIRIobject for it.<T> RDFParserset(RioSetting<T> setting, T value) Set a setting on the parser, and return this parser object to allow chaining.protected voidsetBaseURI(String uriSpec) Parses the supplied URI-string and sets it as the base URI for resolving relative URIs.protected voidsetBaseURI(ParsedIRI baseURI) Sets the base URI for resolving relative URIs.protected voidsetNamespace(String prefix, String namespace) Associates the specified prefix to the specified namespace.Sets the ParseErrorListener that will be notified of any errors that this parser finds during parsing.Sets the ParseLocationListener that will be notified of the parser's progress during the parse process.setParserConfig(ParserConfig config) Sets all supplied parser configuration options.voidsetPreserveBNodeIDs(boolean preserveBNodeIDs) Set whether the parser should preserve bnode identifiers specified in the source (default is false).setRDFHandler(RDFHandler handler) Sets the RDFHandler that will handle the parsed RDF data.setValueFactory(ValueFactory valueFactory) Sets the ValueFactory that the parser will use to create Value objects for the parsed RDF data.
-
Constructor Details
-
SPARQLUpdateDataBlockParser
public SPARQLUpdateDataBlockParser()Creates a new parser that will use aSimpleValueFactoryto create RDF model objects. -
SPARQLUpdateDataBlockParser
Creates a new parser that will use the supplied ValueFactory to create RDF model objects.- Parameters:
valueFactory- A ValueFactory.
-
-
Method Details
-
getRDFFormat
Description copied from interface:RDFParserGets the RDF format that this parser can parse.- Specified by:
getRDFFormatin interfaceRDFParser- Overrides:
getRDFFormatin classTriGStarParser
-
parseGraph
- Overrides:
parseGraphin classTriGParser- Throws:
RDFParseExceptionRDFHandlerExceptionIOException
-
parseImplicitBlank
Description copied from class:TurtleParserParses an implicit blank node. This method parses the token [] and predicateObjectLists that are surrounded by square brackets.- Overrides:
parseImplicitBlankin classTurtleParser- Throws:
IOExceptionRDFParseExceptionRDFHandlerException
-
parseNodeID
Description copied from class:TurtleParserParses a blank node ID, e.g. _:node1.- Overrides:
parseNodeIDin classTurtleParser- Throws:
IOExceptionRDFParseException
-
isAllowBlankNodes
public boolean isAllowBlankNodes()- Returns:
- Returns the allowBlankNodes.
-
setAllowBlankNodes
public void setAllowBlankNodes(boolean allowBlankNodes) - Parameters:
allowBlankNodes- The allowBlankNodes to set.
-
getLineNumber
protected int getLineNumber()- Overrides:
getLineNumberin classTurtleParser
-
setLineNumberOffset
public void setLineNumberOffset(int lineNumberOffset) - Parameters:
lineNumberOffset-
-
AbstractRDFParser.clear()instead.