本文整理了Java中org.eclipse.rdf4j.rio.ParserConfig.addNonFatalError()
方法的一些代码示例,展示了ParserConfig.addNonFatalError()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ParserConfig.addNonFatalError()
方法的具体详情如下:
包路径:org.eclipse.rdf4j.rio.ParserConfig
类名称:ParserConfig
方法名:addNonFatalError
[英]Add a non-fatal error to the set used by parsers to determine whether they should attempt to recover from a particular parsing error.
[中]向解析器使用的集合中添加一个非致命错误,以确定它们是否应该尝试从特定的解析错误中恢复。
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-http-server-spring
/**
* Obtain a new {@link RepositoryConnection} with suitable parser/writer configuration for handling the
* incoming HTTP request. The caller of this method is responsible for closing the connection.
*
* @param request
* the {@link HttpServletRequest} for which a {@link RepositoryConnection} is to be returned
* @return a configured {@link RepositoryConnection}
*/
public static RepositoryConnection getRepositoryConnection(HttpServletRequest request) {
Repository repo = getRepository(request);
RepositoryConnection conn = repo.getConnection();
conn.getParserConfig().addNonFatalError(BasicParserSettings.VERIFY_DATATYPE_VALUES);
conn.getParserConfig().addNonFatalError(BasicParserSettings.VERIFY_LANGUAGE_TAGS);
return conn;
}
}
代码示例来源:origin: ontop/ontop
ParserConfig config = parser.getParserConfig();
config.addNonFatalError(BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES);
config.addNonFatalError(BasicParserSettings.VERIFY_DATATYPE_VALUES);
config.addNonFatalError(BasicParserSettings.NORMALIZE_DATATYPE_VALUES);
config.set(BasicParserSettings.PRESERVE_BNODE_IDS, true);
代码示例来源:origin: eclipse/rdf4j
public SPARQLProtocolSession(HttpClient client, ExecutorService executor) {
this.httpClient = client;
this.httpContext = new HttpClientContext();
this.background = new BackgroundResultExecutor(executor);
valueFactory = SimpleValueFactory.getInstance();
httpContext.setCookieStore(new BasicCookieStore());
// parser used for processing server response data should be lenient
parserConfig.addNonFatalError(BasicParserSettings.VERIFY_DATATYPE_VALUES);
parserConfig.addNonFatalError(BasicParserSettings.VERIFY_LANGUAGE_TAGS);
// configure the maximum url length for SPARQL query GET requests
int maximumUrlLength = DEFAULT_MAXIMUM_URL_LENGTH;
String propertyValue = System.getProperty(MAXIMUM_URL_LENGTH_PARAM);
if (propertyValue != null) {
try {
maximumUrlLength = Integer.parseInt(propertyValue);
}
catch (NumberFormatException e) {
throw new RDF4JConfigException(
"integer value expected for property " + MAXIMUM_URL_LENGTH_PARAM, e);
}
}
this.maximumUrlLength = maximumUrlLength;
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-http-server-spring
/**
* Obtains a {@link RepositoryConnection} through the {@link ExecutorService}.
*
* @return A new {@link RepositoryConnection} to use for this Transaction.
* @throws InterruptedException
* If the execution of the task was interrupted.
* @throws ExecutionException
* If the execution of the task failed for any reason.
*/
private RepositoryConnection getTransactionConnection()
throws InterruptedException, ExecutionException
{
// create a new RepositoryConnection with correct parser settings
Future<RepositoryConnection> result = submit(() -> {
RepositoryConnection conn = rep.getConnection();
ParserConfig config = conn.getParserConfig();
config.set(BasicParserSettings.PRESERVE_BNODE_IDS, true);
config.addNonFatalError(BasicParserSettings.VERIFY_DATATYPE_VALUES);
config.addNonFatalError(BasicParserSettings.VERIFY_LANGUAGE_TAGS);
return conn;
});
return getFromFuture(result);
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-http-client
public SPARQLProtocolSession(HttpClient client, ExecutorService executor) {
this.httpClient = client;
this.httpContext = new HttpClientContext();
this.background = new BackgroundResultExecutor(executor);
valueFactory = SimpleValueFactory.getInstance();
httpContext.setCookieStore(new BasicCookieStore());
// parser used for processing server response data should be lenient
parserConfig.addNonFatalError(BasicParserSettings.VERIFY_DATATYPE_VALUES);
parserConfig.addNonFatalError(BasicParserSettings.VERIFY_LANGUAGE_TAGS);
// configure the maximum url length for SPARQL query GET requests
int maximumUrlLength = DEFAULT_MAXIMUM_URL_LENGTH;
String propertyValue = System.getProperty(MAXIMUM_URL_LENGTH_PARAM);
if (propertyValue != null) {
try {
maximumUrlLength = Integer.parseInt(propertyValue);
}
catch (NumberFormatException e) {
throw new RDF4JConfigException(
"integer value expected for property " + MAXIMUM_URL_LENGTH_PARAM, e);
}
}
this.maximumUrlLength = maximumUrlLength;
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
public SPARQLProtocolSession(HttpClient client, ExecutorService executor) {
this.httpClient = client;
this.httpContext = new HttpClientContext();
this.background = new BackgroundResultExecutor(executor);
valueFactory = SimpleValueFactory.getInstance();
httpContext.setCookieStore(new BasicCookieStore());
// parser used for processing server response data should be lenient
parserConfig.addNonFatalError(BasicParserSettings.VERIFY_DATATYPE_VALUES);
parserConfig.addNonFatalError(BasicParserSettings.VERIFY_LANGUAGE_TAGS);
// configure the maximum url length for SPARQL query GET requests
int maximumUrlLength = DEFAULT_MAXIMUM_URL_LENGTH;
String propertyValue = System.getProperty(MAXIMUM_URL_LENGTH_PARAM);
if (propertyValue != null) {
try {
maximumUrlLength = Integer.parseInt(propertyValue);
}
catch (NumberFormatException e) {
throw new RDF4JConfigException(
"integer value expected for property " + MAXIMUM_URL_LENGTH_PARAM, e);
}
}
this.maximumUrlLength = maximumUrlLength;
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-rio-api
@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);
}
}
代码示例来源:origin: ontop/ontop
private static void processRDF(AbstractRDFHandler rdfHandler, IRI graphURL) throws SemanticIndexException {
RDFFormat rdfFormat = Rio.getParserFormatForFileName(graphURL.toString()).get();
RDFParser rdfParser = Rio.createParser(rdfFormat);
ParserConfig config = rdfParser.getParserConfig();
// To emulate DatatypeHandling.IGNORE
config.addNonFatalError(BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES);
config.addNonFatalError(BasicParserSettings.VERIFY_DATATYPE_VALUES);
config.addNonFatalError(BasicParserSettings.NORMALIZE_DATATYPE_VALUES);
rdfParser.setRDFHandler(rdfHandler);
InputStream in = null;
try {
URL url = new URL(graphURL.toString());
in = url.openStream();
rdfParser.parse(in, graphURL.toString());
}
catch (IOException e) {
throw new SemanticIndexException(e.getMessage());
}
finally {
try {
if (in != null)
in.close();
}
catch (IOException e) {
throw new SemanticIndexException(e.getMessage());
}
}
}
代码示例来源:origin: eclipse/rdf4j
@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<>(getParserConfig().getNonFatalErrors());
set.remove(NTriplesParserSettings.FAIL_ON_NTRIPLES_INVALID_LINES);
getParserConfig().setNonFatalErrors(set);
}
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
@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);
}
}
代码示例来源:origin: net.sourceforge.owlapi/owlapi-rio
IOException {
final RDFParser createParser = Rio.createParser(owlFormatFactory.getRioFormat());
createParser.getParserConfig().addNonFatalError(BasicParserSettings.VERIFY_DATATYPE_VALUES);
createParser.getParserConfig().addNonFatalError(BasicParserSettings.VERIFY_LANGUAGE_TAGS);
createParser.getParserConfig().addNonFatalError(BasicParserSettings.VERIFY_URI_SYNTAX);
createParser.setRDFHandler(handler);
long rioParseStart = System.currentTimeMillis();
代码示例来源:origin: owlcs/owlapi
IOException {
final RDFParser createParser = Rio.createParser(owlFormatFactory.getRioFormat());
createParser.getParserConfig().addNonFatalError(BasicParserSettings.VERIFY_DATATYPE_VALUES);
createParser.getParserConfig().addNonFatalError(BasicParserSettings.VERIFY_LANGUAGE_TAGS);
createParser.getParserConfig().addNonFatalError(BasicParserSettings.VERIFY_URI_SYNTAX);
createParser.setRDFHandler(handler);
long rioParseStart = System.currentTimeMillis();
代码示例来源:origin: ontop/ontop
config.addNonFatalError(BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES);
config.addNonFatalError(BasicParserSettings.VERIFY_DATATYPE_VALUES);
config.addNonFatalError(BasicParserSettings.NORMALIZE_DATATYPE_VALUES);
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-repository-sail
parser.getParserConfig().addNonFatalError(BasicParserSettings.VERIFY_DATATYPE_VALUES);
parser.getParserConfig().addNonFatalError(BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES);
parser.getParserConfig().set(BasicParserSettings.SKOLEMIZE_ORIGIN, null);
try {
代码示例来源:origin: org.apache.any23/apache-any23-core
parser.getParserConfig().addNonFatalError(BasicParserSettings.FAIL_ON_UNKNOWN_DATATYPES);
parser.getParserConfig().set(BasicParserSettings.VERIFY_DATATYPE_VALUES, true);
parser.getParserConfig().addNonFatalError(BasicParserSettings.VERIFY_DATATYPE_VALUES);
parser.getParserConfig().set(BasicParserSettings.NORMALIZE_DATATYPE_VALUES, false);
parser.getParserConfig().addNonFatalError(BasicParserSettings.NORMALIZE_DATATYPE_VALUES);
内容来源于网络,如有侵权,请联系作者删除!