@Override public <T> RDFParser set(RioSetting<T> setting, T value) { getParserConfig().set(setting, value); return this; }
@Deprecated @Override public void setStopAtFirstError(boolean stopAtFirstError) { getParserConfig().set(NTriplesParserSettings.FAIL_ON_NTRIPLES_INVALID_LINES, stopAtFirstError); if (!stopAtFirstError) { getParserConfig().addNonFatalError(NTriplesParserSettings.FAIL_ON_NTRIPLES_INVALID_LINES); } else { // TODO: Add a ParserConfig.removeNonFatalError function to avoid // this Set<RioSetting<?>> set = new HashSet<RioSetting<?>>(getParserConfig().getNonFatalErrors()); set.remove(NTriplesParserSettings.FAIL_ON_NTRIPLES_INVALID_LINES); getParserConfig().setNonFatalErrors(set); } }
/** * Creates a {@link Literal} object with the supplied parameters. */ protected Literal createLiteral(String label, String lang, IRI datatype) throws RDFParseException { return RDFParserHelper.createLiteral(label, lang, datatype, getParserConfig(), getParseErrorListener(), valueFactory); }
protected void initializeNamespaceTableFromConfiguration() { for (Namespace aNS : getParserConfig().get(BasicParserSettings.NAMESPACES)) { namespaceTable.put(aNS.getPrefix(), aNS.getName()); } }
/** * Creates a {@link Literal} object 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. * * @since 2.7.4 * @see org.openrdf.rio.helpers.RDFParserHelper#createLiteral(String, String, * IRI, ParserConfig, ParseErrorListener, ValueFactory, long, long) */ protected Literal createLiteral(String label, String lang, IRI datatype, long lineNo, long columnNo) throws RDFParseException { return RDFParserHelper.createLiteral(label, lang, datatype, getParserConfig(), getParseErrorListener(), valueFactory, lineNo, columnNo); }
/** * Reports an error with associated line- and column number to the registered * ParseErrorListener, if the given setting has been set to true. * <p> * This method also throws an {@link RDFParseException} when the given * setting has been set to <tt>true</tt> and it is not a nonFatalError. * * @param msg * The message to use for * {@link ParseErrorListener#error(String, long, long)} and for * {@link RDFParseException#RDFParseException(String, long, long)}. * @param 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 * {@link ParserConfig#isNonFatalError(RioSetting)} returns true an * exception will be thrown. * @throws RDFParseException * If {@link ParserConfig#get(RioSetting)} returns true, and * {@link ParserConfig#isNonFatalError(RioSetting)} returns true for * the given setting. */ protected void reportError(String msg, RioSetting<Boolean> relevantSetting) throws RDFParseException { RDFParserHelper.reportError(msg, relevantSetting, getParserConfig(), getParseErrorListener()); }
throws RDFParseException RDFParserHelper.reportError(msg, lineNo, columnNo, relevantSetting, getParserConfig(), getParseErrorListener());
throws RDFParseException RDFParserHelper.reportError(e, lineNo, columnNo, relevantSetting, getParserConfig(), getParseErrorListener());
/** * Resolves a URI-string against the base URI and creates a {@link IRI} * object for it. */ protected IRI resolveURI(String uriSpec) throws RDFParseException { // Resolve relative URIs against base URI ParsedURI uri = new ParsedURI(uriSpec); if (uri.isRelative()) { if (baseURI == null) { reportFatalError("Unable to resolve URIs, no base URI has been set"); } if (getParserConfig().get(BasicParserSettings.VERIFY_RELATIVE_URIS)) { if (uri.isRelative() && !uri.isSelfReference() && baseURI.isOpaque()) { reportError("Relative URI '" + uriSpec + "' cannot be resolved using the opaque base URI '" + baseURI + "'", BasicParserSettings.VERIFY_RELATIVE_URIS); } } uri = baseURI.resolve(uri); } return createURI(uri.toString()); }