• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java UpdateExecutionFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: runSparqlUpdate

import org.apache.jena.update.UpdateExecutionFactory; //导入依赖的package包/类
/**
 * @param sparql
 * @return
 */
public boolean runSparqlUpdate(String sparql) {

  if (logger.isDebugEnabled())
    logger.debug("run SPARQL update: {}", sparql);

  HttpClientBuilder clientBuilder = HttpClientBuilder.create();

  setCloudAuthHeaderIfConfigured(clientBuilder);

  if (proxyHost != null && proxyPort != null) {
    HttpHost proxy = new HttpHost(proxyHost, proxyPort);
    clientBuilder.setProxy(proxy);
  }

  try (CloseableHttpClient client = clientBuilder.build()) {
    UpdateRequest update = UpdateFactory.create(sparql, Syntax.syntaxARQ);
    UpdateProcessor processor = UpdateExecutionFactory.createRemoteForm(update, buildSPARQLUrl().toString(), client);
    processor.execute();
  } catch (IOException ioe) {
    throw new RuntimeException("IOException.", ioe);
  }
  return true;
}
 
开发者ID:Smartlogic-Semaphore-Limited,项目名称:Java-APIs,代码行数:28,代码来源:OEModelEndpoint.java


示例2: generateIndividual

import org.apache.jena.update.UpdateExecutionFactory; //导入依赖的package包/类
@Override
public void generateIndividual(VirtualEntity virtualEntity) {

    Model model = createIndividual(new VirtualEntity());
    
    String id = UUID.randomUUID().toString();
    System.out.println(String.format("Adding %s", id));
    UpdateProcessor upp = UpdateExecutionFactory.createRemote(
            UpdateFactory.create(String.format(UPDATE_TEMPLATE, id)),
            "http://localhost:3030/pswot/update");
    upp.execute();
    //Query the collection, dump output
    QueryExecution qe = QueryExecutionFactory.sparqlService(
            "http://localhost:3030/pswot/query",
            "SELECT * WHERE {?x ?r ?y}");
    ResultSet results = qe.execSelect();
    ResultSetFormatter.out(System.out, results);
    qe.close();

}
 
开发者ID:nailtonvieira,项目名称:cloudsemanticwot,代码行数:21,代码来源:DataConnectorImpl.java


示例3: runModifySparql

import org.apache.jena.update.UpdateExecutionFactory; //导入依赖的package包/类
private void runModifySparql(String sparql, String[] idxVals) throws Exception {
	String updateService = Utils.getSdaProperty("com.pineone.icbms.sda.knowledgebase.sparql.endpoint") + "/update";

	String madeQl = makeSparql(sparql, idxVals);
	UpdateRequest ur = UpdateFactory.create(madeQl);
	UpdateProcessor up = UpdateExecutionFactory.createRemote(ur, updateService);
	up.execute();
}
 
开发者ID:iotoasis,项目名称:SDA,代码行数:9,代码来源:SparqlService.java


示例4: sendUpdateQuery

import org.apache.jena.update.UpdateExecutionFactory; //导入依赖的package包/类
@Override
public boolean sendUpdateQuery(String query) {
    if (query == null) {
        LOGGER.error("Can not send an update query that is null. Returning false.");
        return false;
    }
    UpdateRequest update = UpdateFactory.create(query);
    UpdateProcessor up = UpdateExecutionFactory.create(update, dataset);
    up.execute();
    // DatasetGraph dg = up.getDatasetGraph();
    // return
    // ModelFactory.createModelForGraph(dg.getGraph(NodeFactory.createURI(graphUri)));
    return true;
}
 
开发者ID:hobbit-project,项目名称:platform,代码行数:15,代码来源:ChallengePublicationTest.java


示例5: run

import org.apache.jena.update.UpdateExecutionFactory; //导入依赖的package包/类
private void run() {
    dsg.clear();
    
    String insertData = "PREFIX foaf: <http://xmlns.com/foaf/0.1/> "
            + "PREFIX : <http://example.org/> "
            +"INSERT DATA {GRAPH :g1 {"
            + ":charles a foaf:Person ; "
            + "        foaf:name \"Charles\" ;"
            + "        foaf:knows :jim ."
            + ":jim    a foaf:Person ;"
            + "        foaf:name \"Jim\" ;"
            + "        foaf:knows :charles ."
            + "} }";
    
    System.out.println("Running SPARQL update");
    
    UpdateRequest update = UpdateFactory.create(insertData);
    UpdateProcessor processor = UpdateExecutionFactory.create(update, dsg);
    processor.execute();
    
    System.out.println("Examine the data as JSON-LD");
    RDFDataMgr.write(System.out, dsg.getGraph(NodeFactory.createURI("http://example.org/g1")), RDFFormat.JSONLD_PRETTY);
    
    System.out.println("Remove it.");
    
    update = UpdateFactory.create("PREFIX : <http://example.org/> DROP GRAPH :g1");
    processor = UpdateExecutionFactory.create(update, dsg);
    processor.execute();
    dsg.close();
}
 
开发者ID:marklogic,项目名称:marklogic-jena,代码行数:31,代码来源:SPARQLUpdateExample.java


示例6: getTimeForQueryMs

import org.apache.jena.update.UpdateExecutionFactory; //导入依赖的package包/类
@Override
public Long getTimeForQueryMs(String query, String queryID) {
	UpdateRequest update = UpdateFactory.create(query);

	// Set update timeout
	RequestConfig requestConfig = RequestConfig.custom().setConnectionRequestTimeout(this.timeOut.intValue())
			.setConnectTimeout(this.timeOut.intValue()).setSocketTimeout(this.timeOut.intValue()).build();
	CloseableHttpClient client = HttpClientBuilder.create().setDefaultRequestConfig(requestConfig).build();

	// create Update Processor and use timeout config
	UpdateProcessor exec = UpdateExecutionFactory.createRemote(update, service, client);
	setCredentials(exec);

	try {
		long start = System.currentTimeMillis();
		// Execute Update
		exec.execute();
		long end = System.currentTimeMillis();
		LOGGER.debug("Worker[{{}} : {{}}]: Update with ID {{}} took {{}}.", this.workerType, this.workerID, queryID,
				end - start);
		// Return time
		return end - start;
	} catch (Exception e) {
		LOGGER.warn("Worker[{{}} : {{}}]: Could not execute the following update\n{{}}\n due to", this.workerType,
				this.workerID, query, e);
	}
	// Exception was thrown, return error
	return -1L;
}
 
开发者ID:dice-group,项目名称:IGUANA,代码行数:30,代码来源:UPDATEWorker.java


示例7: createUpdateProcessor

import org.apache.jena.update.UpdateExecutionFactory; //导入依赖的package包/类
@Override
protected UpdateProcessor createUpdateProcessor(UpdateRequest update) {
    if (this.getOptions().getEnsureAbsoluteURIs()) {
        if (!update.explicitlySetBaseURI()) update.setBaseURI((String)null);
    }
    return UpdateExecutionFactory.create(update, this.getGraphStore(this.getOptions()));
}
 
开发者ID:rvesse,项目名称:sparql-query-bm,代码行数:8,代码来源:AbstractInMemoryUpdateCallable.java


示例8: createUpdateProcessor

import org.apache.jena.update.UpdateExecutionFactory; //导入依赖的package包/类
@Override
protected UpdateProcessor createUpdateProcessor(UpdateRequest update) {
    if (this.getOptions().getEnsureAbsoluteURIs()) {
        if (!update.explicitlySetBaseURI()) update.setBaseURI((String)null);
    }
    return UpdateExecutionFactory.createRemote(update, this.getOptions().getUpdateEndpoint(), this.getOptions()
            .getAuthenticator());
}
 
开发者ID:rvesse,项目名称:sparql-query-bm,代码行数:9,代码来源:AbstractRemoteUpdateCallable.java


示例9: runModifySparql

import org.apache.jena.update.UpdateExecutionFactory; //导入依赖的package包/类
public void  runModifySparql(String sparql, String[] idxVals, String dest) throws Exception {
	String madeQl = makeFinal(sparql, idxVals);
	
	if(dest.equals("ALL") || dest.equals("DW")) {
		String updateService = Utils.getSdaProperty("com.pineone.icbms.sda.knowledgebase.dw.sparql.endpoint") + "/update";
		//String madeQl = makeFinal(sparql, idxVals);
		UpdateRequest ur = UpdateFactory.create(madeQl);
		UpdateProcessor up;
		
		//log.debug("sparql of "+dest+" in runModifySparql ===> "+madeQl);
		log.debug("runModifySparql() on DatWarehouse server start.................................. ");
	
		try {
			log.debug("try (first).................................. ");
			up = UpdateExecutionFactory.createRemote(ur, updateService);
			up.execute();
		} catch (Exception e) {
			int waitTime = 15*1000;
			log.debug("Exception message in runModifySparql() =====> "+e.getMessage());  // HTTP 500 error making the query: java.lang.StackOverflowError or...
			
			try {
				// 일정시간 대기 했다가 다시 수행함
				log.debug("sleeping.(first).................................. in "+waitTime);
				Thread.sleep(waitTime);
				
				log.debug("try (second).................................. ");
				up = UpdateExecutionFactory.createRemote(ur, updateService);
				up.execute();
			} catch (Exception ee) {
				log.debug("Exception 1====>"+ee.getMessage());
				waitTime = 30*1000;
				if(ee.getMessage().contains("Service Unavailable") || ee.getMessage().contains("java.net.ConnectException")			
						 // || ee.getMessage().contains("500 - Server Error") || ee.getMessage().contains("HTTP 500 error") 
						 ) {
					try {
						// restart fuseki
						Utils.restartFuseki();
						
						// 일정시간을 대기 한다.
						log.debug("sleeping (final)................................. in "+waitTime);
						Thread.sleep(waitTime);
						
						// 마지막으로 다시한번 시도한다.
						log.debug("try (final).................................. ");
						up = UpdateExecutionFactory.createRemote(ur, updateService);
						up.execute();
					} catch (Exception eee) {
						log.debug("Exception 2====>"+eee.getMessage());
						throw eee;
					}
				}
				throw ee;
			} // 두번째 try
		} // 첫번째 try
		
		log.debug("runModifySparql() on DataWarehouse server end.................................. ");
	}
	
	if(dest.equals("ALL") || dest.equals("DM")) {
		//동일한(delete or insert) sparql를 DM서버에도 수행함(최근값 혹은 추론결과, subscription값등을 등록한다.)
		log.debug("runModifySparql() on DataMart server start.................................. ");
		//String madeQl = makeFinal(sparql, idxVals);
		String updateService2 = Utils.getSdaProperty("com.pineone.icbms.sda.knowledgebase.dm.sparql.endpoint") + "/update";
		UpdateRequest ur2 = UpdateFactory.create(madeQl);
		
		//log.debug("sparql of "+dest+" in runModifySparql ===> "+madeQl2);
		
		//log.debug("madeQl2  ============>"+ madeQl2);
		//log.debug("query  ============>"+ ur2.toString());
		
		UpdateProcessor up2 = UpdateExecutionFactory.createRemote(ur2, updateService2);
		up2.execute();
		log.debug("runModifySparql() on DataMart server end.................................. ");
	}
}
 
开发者ID:iotoasis,项目名称:SDA,代码行数:76,代码来源:SparqlFusekiQueryImpl.java


示例10: execUpdate

import org.apache.jena.update.UpdateExecutionFactory; //导入依赖的package包/类
public static void execUpdate(String sparqlUpdateString, GraphStore graphStore)
{
    UpdateRequest request = UpdateFactory.create(sparqlUpdateString) ;
    UpdateProcessor proc = UpdateExecutionFactory.create(request, graphStore) ;
    proc.execute() ;
}
 
开发者ID:xcurator,项目名称:xcurator,代码行数:7,代码来源:ExTDB_Txn2.java



注:本文中的org.apache.jena.update.UpdateExecutionFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DefaultElementLocatorFactory类代码示例发布时间:2022-05-22
下一篇:
Java FrameworkSupportModel类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap