• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java QueryExceptionHTTP类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中com.hp.hpl.jena.sparql.engine.http.QueryExceptionHTTP的典型用法代码示例。如果您正苦于以下问题:Java QueryExceptionHTTP类的具体用法?Java QueryExceptionHTTP怎么用?Java QueryExceptionHTTP使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

QueryExceptionHTTP类属于com.hp.hpl.jena.sparql.engine.http包,在下文中一共展示了QueryExceptionHTTP类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: executeSparqlQuery

点赞 3

import com.hp.hpl.jena.sparql.engine.http.QueryExceptionHTTP; //导入依赖的package包/类
@Override
public ResultSet executeSparqlQuery(Query query) throws ServiceException {
  logQuery(query);
  QueryExecution queryExecution = QueryExecutionFactory.sparqlService(sparqlEndpointUrl, query);
  try {
    ResultSet result = queryExecution.execSelect();
    logResult(query, result);
    return result;
  }
  catch (QueryExceptionHTTP exception) {
    StringBuilder builder = new StringBuilder();
    builder.append('[').append(query.hashCode()).append(']');
    builder.append(" Error in Request to SPARQL endpoint. Response-Code: "); //$NON-NLS-1$
    builder.append(exception.getResponseCode());
    appendMessage(builder, exception.getResponseMessage());
    appendMessage(builder, exception.getLocalizedMessage());
    LOGGER.error(builder.toString());
    throw SparqlExceptionFactory.wrap(sparqlEndpointUrl, exception);
  }
}
 

开发者ID:eENVplus,
项目名称:tf-exploitation-server,
代码行数:21,
代码来源:ThesaurusSparqlConnector.java

示例2: harvest

点赞 3

import com.hp.hpl.jena.sparql.engine.http.QueryExceptionHTTP; //导入依赖的package包/类
/**
 * Add data to ES given a query execution service
 * @param qExec query execution service
 */
private void harvest(QueryExecution qExec) {
	boolean retry;
	do {
		retry = false;
		try {
			Model model = getModel(qExec);
			addModelToES(model, client.prepareBulk(), true);
		} catch (QueryExceptionHTTP e) {
			if (e.getResponseCode() >= 500) {
				retry = true;
				logger.error("Encountered an internal server error "
				             + "while harvesting. Retrying!");
			} else {
				throw e;
			}
		}
	} while (retry);
}
 

开发者ID:eea,
项目名称:eea.elasticsearch.river.rdf,
代码行数:23,
代码来源:Harvester.java

示例3: wrap

点赞 2

import com.hp.hpl.jena.sparql.engine.http.QueryExceptionHTTP; //导入依赖的package包/类
public static ServiceException wrap(String address, QueryExceptionHTTP jenaException) {
  switch (jenaException.getResponseCode()) {
    case HttpStatus.SC_FORBIDDEN:
      return new ForbiddenServiceException(jenaException);
    case HttpStatus.SC_NOT_FOUND:
      return new UnreachableServiceException(address, jenaException);
    default:
      return new ServiceException(jenaException);
  }
}
 

开发者ID:eENVplus,
项目名称:tf-exploitation-server,
代码行数:11,
代码来源:SparqlExceptionFactory.java

示例4: testEndpoint

点赞 2

import com.hp.hpl.jena.sparql.engine.http.QueryExceptionHTTP; //导入依赖的package包/类
public void testEndpoint ( String endpoint )
{
	String queryASK = "ASK { }";
   	Query query = QueryFactory.create(queryASK);
   	QueryExecution qe = QueryExecutionFactory.sparqlService(endpoint, query);
       try {
           if (qe.execAsk()) { System.out.println( endpoint + " is UP" ); } 
       }   catch (QueryExceptionHTTP e) {
           System.out.println( endpoint + " is DOWN");
           System.out.println( e );
       } finally { qe.close(); } 
}
 

开发者ID:narock,
项目名称:earthcube-EAGER,
代码行数:13,
代码来源:Endpoints.java


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)