public class RDFParserHelper extends Object
RDFParser implementations.
 
 This class contains reference implementations of the workflows for ParseErrorListener,
 RDFParseException, ParserConfig, DatatypeHandler and LanguageHandler related methods
| Modifier | Constructor and Description | 
|---|---|
| protected  | RDFParserHelper()Protected constructor to prevent direct instantiation. | 
| Modifier and Type | Method and Description | 
|---|---|
| static Literal | createLiteral(String label,
             String lang,
             IRI datatype,
             ParserConfig parserConfig,
             ParseErrorListener errListener,
             ValueFactory valueFactory)Create a literal using the given parameters, including iterative verification and normalization by any
  DatatypeHandlerorLanguageHandlerimplementations that are found in theParserConfig. | 
| static Literal | createLiteral(String label,
             String lang,
             IRI datatype,
             ParserConfig parserConfig,
             ParseErrorListener errListener,
             ValueFactory valueFactory,
             long lineNo,
             long columnNo)Create a literal using the given parameters, including iterative verification and normalization by any
  DatatypeHandlerorLanguageHandlerimplementations that are found in theParserConfig. | 
| static void | reportError(Exception e,
           long lineNo,
           long columnNo,
           RioSetting<Boolean> relevantSetting,
           ParserConfig parserConfig,
           ParseErrorListener errListener)Reports an error with associated line- and column number to the registered ParseErrorListener, if the given
 setting has been set to true. | 
| static void | reportError(String msg,
           long lineNo,
           long columnNo,
           RioSetting<Boolean> relevantSetting,
           ParserConfig parserConfig,
           ParseErrorListener errListener)Reports an error with associated line- and column number to the registered ParseErrorListener, if the given
 setting has been set to true. | 
| static void | reportError(String msg,
           RioSetting<Boolean> relevantSetting,
           ParserConfig parserConfig,
           ParseErrorListener errListener)Reports an error with associated line- and column number to the registered ParseErrorListener, if the given
 setting has been set to true. | 
| static void | reportFatalError(Exception e,
                long lineNo,
                long columnNo,
                ParseErrorListener errListener)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. | 
| static void | reportFatalError(Exception e,
                ParseErrorListener errListener)Reports a fatal error to the registered ParseErrorListener, if any, and throws a ParseException
 afterwards. | 
| static void | reportFatalError(String message,
                Exception e,
                long lineNo,
                long columnNo,
                ParseErrorListener errListener)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. | 
| static void | reportFatalError(String msg,
                long lineNo,
                long columnNo,
                ParseErrorListener errListener)Reports a fatal error with associated line- and column number to the registered ParseErrorListener, if any, and
 throws a ParseException afterwards. | 
| static void | reportFatalError(String msg,
                ParseErrorListener errListener)Reports a fatal error to the registered ParseErrorListener, if any, and throws a ParseException
 afterwards. | 
protected RDFParserHelper()
public static final Literal createLiteral(String label, String lang, IRI datatype, ParserConfig parserConfig, ParseErrorListener errListener, ValueFactory valueFactory) throws RDFParseException
DatatypeHandler or LanguageHandler implementations that are found in the ParserConfig.label - The value for Literal.getLabel(), which may be iteratively normalized.lang - If this is not null, and the datatype is either not null, or is equal to
                     RDF.LANGSTRING, then a language literal will be created.datatype - If datatype is not null, and the datatype is not equal to RDF.LANGSTRING with a
                     non-null lang, then a datatype literal will be created.parserConfig - The source of parser settings, including the desired list of DatatypeHandler and
                     LanguageHandlers to use for verification and normalization of datatype and language
                     literals respectively.errListener - The ParseErrorListener to use for signalling errors. This will be called if a setting
                     is enabled by setting it to true in the ParserConfig, after which the error may
                     trigger an RDFParseException if the setting is not present in
                     ParserConfig.getNonFatalErrors().valueFactory - The ValueFactory to use for creating new Literals using this method.Literal created based on the given parameters.RDFParseException - If there was an error during the process that could not be recovered from, based on
                           settings in the given parser config.public static final Literal createLiteral(String label, String lang, IRI datatype, ParserConfig parserConfig, ParseErrorListener errListener, ValueFactory valueFactory, long lineNo, long columnNo) throws RDFParseException
DatatypeHandler or LanguageHandler implementations that are found in the ParserConfig.label - The value for Literal.getLabel(), which may be iteratively normalized.lang - If this is not null, and the datatype is either not null, or is equal to
                     RDF.LANGSTRING, then a language literal will be created.datatype - If datatype is not null, and the datatype is not equal to RDF.LANGSTRING with a
                     non-null lang, then a datatype literal will be created.parserConfig - The source of parser settings, including the desired list of DatatypeHandler and
                     LanguageHandlers to use for verification and normalization of datatype and language
                     literals respectively.errListener - The ParseErrorListener to use for signalling errors. This will be called if a setting
                     is enabled by setting it to true in the ParserConfig, after which the error may
                     trigger an RDFParseException if the setting is not present in
                     ParserConfig.getNonFatalErrors().valueFactory - The ValueFactory to use for creating new Literals using this method.lineNo - Optional line number, should default to setting this as -1 if not known. Used for
                     ParseErrorListener.error(String, long, long) and for
                     RDFParseException.RDFParseException(String, long, long).columnNo - Optional column number, should default to setting this as -1 if not known. Used for
                     ParseErrorListener.error(String, long, long) and for
                     RDFParseException.RDFParseException(String, long, long).Literal created based on the given parameters.RDFParseException - If there was an error during the process that could not be recovered from, based on
                           settings in the given parser config.public static void reportError(String msg, RioSetting<Boolean> relevantSetting, ParserConfig parserConfig, ParseErrorListener errListener) throws RDFParseException
 This method also throws an RDFParseException when the given setting has been set to true and it
 is not a nonFatalError.
msg - The message to use for ParseErrorListener.error(String, long, long) and for
                        RDFParseException.RDFParseException(String, long, long).relevantSetting - The boolean setting that will be checked to determine if this is an issue that we need to
                        look at at all. If this setting is true, then the error listener will receive the error,
                        and if ParserConfig.isNonFatalError(RioSetting) returns true an exception will be
                        thrown.parserConfig - The ParserConfig to use for determining if the error is first sent to the
                        ParseErrorListener, and whether it is then also non-fatal to avoid throwing an
                        RDFParseException.errListener - The ParseErrorListener that will be sent messages about errors that are enabled.RDFParseException - If RioConfig.get(RioSetting) returns true, and
                           ParserConfig.isNonFatalError(RioSetting) returns true for the given setting.public static void reportError(String msg, long lineNo, long columnNo, RioSetting<Boolean> relevantSetting, ParserConfig parserConfig, ParseErrorListener errListener) throws RDFParseException
 This method also throws an RDFParseException when the given setting has been set to true and it
 is not a nonFatalError.
msg - The message to use for ParseErrorListener.error(String, long, long) and for
                        RDFParseException.RDFParseException(String, long, long).lineNo - Optional line number, should default to setting this as -1 if not known. Used for
                        ParseErrorListener.error(String, long, long) and for
                        RDFParseException.RDFParseException(String, long, long).columnNo - Optional column number, should default to setting this as -1 if not known. Used for
                        ParseErrorListener.error(String, long, long) and for
                        RDFParseException.RDFParseException(String, long, long).relevantSetting - The boolean setting that will be checked to determine if this is an issue that we need to
                        look at at all. If this setting is true, then the error listener will receive the error,
                        and if ParserConfig.isNonFatalError(RioSetting) returns true an exception will be
                        thrown.parserConfig - The ParserConfig to use for determining if the error is first sent to the
                        ParseErrorListener, and whether it is then also non-fatal to avoid throwing an
                        RDFParseException.errListener - The ParseErrorListener that will be sent messages about errors that are enabled.RDFParseException - If RioConfig.get(RioSetting) returns true, and
                           ParserConfig.isNonFatalError(RioSetting) returns true for the given setting.public static void reportError(Exception e, long lineNo, long columnNo, RioSetting<Boolean> relevantSetting, ParserConfig parserConfig, ParseErrorListener errListener) throws RDFParseException
 This method also throws an RDFParseException when the given setting has been set to true and it
 is not a nonFatalError.
e - The exception whose message to use for
                        ParseErrorListener.error(String, long, long) and for
                        RDFParseException.RDFParseException(String, long, long).lineNo - Optional line number, should default to setting this as -1 if not known. Used for
                        ParseErrorListener.error(String, long, long) and for
                        RDFParseException.RDFParseException(String, long, long).columnNo - Optional column number, should default to setting this as -1 if not known. Used for
                        ParseErrorListener.error(String, long, long) and for
                        RDFParseException.RDFParseException(String, long, long).relevantSetting - The boolean setting that will be checked to determine if this is an issue that we need to
                        look at at all. If this setting is true, then the error listener will receive the error,
                        and if ParserConfig.isNonFatalError(RioSetting) returns true an exception will be
                        thrown.parserConfig - The ParserConfig to use for determining if the error is first sent to the
                        ParseErrorListener, and whether it is then also non-fatal to avoid throwing an
                        RDFParseException.errListener - The ParseErrorListener that will be sent messages about errors that are enabled.RDFParseException - If RioConfig.get(RioSetting) returns true, and
                           ParserConfig.isNonFatalError(RioSetting) returns true for the given setting.public static void reportFatalError(String msg, ParseErrorListener errListener) throws RDFParseException
reportFatalError(String, long, long, ParseErrorListener) supplying
 -1 for the line- and column number.RDFParseExceptionpublic static void reportFatalError(String msg, long lineNo, long columnNo, ParseErrorListener errListener) throws RDFParseException
RDFParseExceptionpublic static void reportFatalError(Exception e, ParseErrorListener errListener) throws RDFParseException
RDFParseException; in
 that case the supplied exception is not wrapped in another ParseException and the error message is not reported
 to the ParseErrorListener, assuming that it has already been reported when the original ParseException was
 thrown.
 
 This method simply calls reportFatalError(Exception, long, long, ParseErrorListener) supplying
 -1 for the line- and column number.
RDFParseExceptionpublic static void reportFatalError(Exception e, long lineNo, long columnNo, ParseErrorListener errListener) throws RDFParseException
RDFParseException; in that case the supplied exception is not wrapped
 in another ParseException and the error message is not reported to the ParseErrorListener, assuming that it has
 already been reported when the original ParseException was thrown.RDFParseExceptionpublic static void reportFatalError(String message, Exception e, long lineNo, long columnNo, ParseErrorListener errListener) throws RDFParseException
RDFParseException; in that case the supplied exception is not wrapped
 in another ParseException and the error message is not reported to the ParseErrorListener, assuming that it has
 already been reported when the original ParseException was thrown.RDFParseExceptionCopyright © 2015-2020 Eclipse Foundation. All Rights Reserved.