当前位置: 首页>>代码示例>>Java>>正文


Java UpdateRequest类代码示例

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


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

示例1: save

import com.hp.hpl.jena.update.UpdateRequest; //导入依赖的package包/类
public void save(Observation o) {
    cache.add(o);
    batchSize++;

    if (batchSize >= CONFIG.sparqlMaxBatchSize()) {
        try {
            logger.debug("Flushing the cache...");
            UpdateRequest request = UpdateFactory.create(modelToQuery(cache));
            UpdateExecutionFactory.createRemote(
                    request, endpoint, authenticator).execute();
            batchSize = 0;
            cache.clear();
        } catch (IOException ex) {
            logger.warn(ex.getMessage(), ex);
        }
    }
}
 
开发者ID:ailabitmo,项目名称:DAAFSE,代码行数:18,代码来源:Store.java

示例2: entailSKOSModel

import com.hp.hpl.jena.update.UpdateRequest; //导入依赖的package包/类
private void entailSKOSModel() {
  GraphStore graphStore = GraphStoreFactory.create(skosModel) ;
  String sparqlQuery = StringUtils.join(new String[]{
      "PREFIX skos: <http://www.w3.org/2004/02/skos/core#>",
      "PREFIX skos-ehri: <http://data.ehri-project.eu/skos-extension#>",
      "PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>",
      "INSERT { ?subject rdf:type skos:Concept }",
      "WHERE {",
        "{ ?subject skos:prefLabel ?text } UNION",
        "{ ?subject skos:altLabel ?text } UNION",
        "{ ?subject skos-ehri:prefMaleLabel ?text } UNION",
        "{ ?subject skos-ehri:prefFemaleLabel ?text } UNION",
        "{ ?subject skos-ehri:prefNeuterLabel ?text } UNION",
        "{ ?subject skos-ehri:altMaleLabel ?text } UNION",
        "{ ?subject skos-ehri:altFemaleLabel ?text } UNION",
        "{ ?subject skos-ehri:altNeuterLabel ?text } UNION",
        "{ ?subject skos:hiddenLabel ?text }",
       "}",
      }, "\n");
  UpdateRequest request = UpdateFactory.create(sparqlQuery);
  UpdateAction.execute(request, graphStore) ;
}
 
开发者ID:KepaJRodriguez,项目名称:lucene-skos-ehri,代码行数:23,代码来源:SKOSEngineImpl.java

示例3: updateDataset

import com.hp.hpl.jena.update.UpdateRequest; //导入依赖的package包/类
private void updateDataset(String updateString, HttpServletRequest request, HttpServletResponse response) 
		throws IOException {
	Config config = new Config(request);
	Dataset tdbstore = TDBFactory.createDataset(config.getTripleStoreDir());
	UpdateRequest update = UpdateFactory.create(updateString);
	UpdateAction.execute(update, tdbstore);
	out.print("Updated");
	TDB.sync(tdbstore);
}
 
开发者ID:IKCAP,项目名称:turbosoft,代码行数:10,代码来源:SparqlEndpoint.java

示例4: clearAll

import com.hp.hpl.jena.update.UpdateRequest; //导入依赖的package包/类
public void clearAll() {
    UpdateRequest request = null;
    if (CONFIG.sparqlVendor().equalsIgnoreCase(PublisherConfig.VIRTUOSO)) {
        Query select = QueryFactory.create(
                "SELECT DISTINCT ?g { GRAPH ?g {?x ?y ?z}"
                + "FILTER(strStarts(str(?g), \"" + Observation.METERS + "\"))}");
        ResultSet result = QueryExecutionFactory.createServiceRequest(
                endpoint, select, authenticator).execSelect();
        StringBuilder cleanQuery = new StringBuilder();
        int count = 0;
        while (result.hasNext()) {
            String graphUri = result.next().getResource("g").getURI();
            cleanQuery.append("CLEAR GRAPH <").append(graphUri).append("> ;\n");
            if (++count > 4) {
                request = UpdateFactory.create(cleanQuery.toString());
                UpdateExecutionFactory.createRemote(
                        request, endpoint, authenticator).execute();
                count = 0;
                cleanQuery = new StringBuilder();
            }
            if (count > 0) {
                request = UpdateFactory.create(cleanQuery.toString());
                UpdateExecutionFactory.createRemote(
                        request, endpoint, authenticator).execute();
            }
        }
    } else {
        request = UpdateFactory.create("CLEAR ALL");
        UpdateExecutionFactory.createRemote(
                request, endpoint, authenticator).execute();
    }
}
 
开发者ID:ailabitmo,项目名称:DAAFSE,代码行数:33,代码来源:Store.java

示例5: cleanupModel

import com.hp.hpl.jena.update.UpdateRequest; //导入依赖的package包/类
private void cleanupModel() {
	final UpdateRequest del = PQUtils.constructPQ(readQuery(DELETE_TM_NULL), m).asUpdate();
	UpdateAction.execute(del, m);
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:5,代码来源:GeneralJSONRDF.java

示例6: main

import com.hp.hpl.jena.update.UpdateRequest; //导入依赖的package包/类
public static void main(String [] args)
{
	// Set up the ModelD2RQ using a mapping file
	String workingDir = System.getProperty("user.dir");		
	String propFile = workingDir + "/mapping-iswc2.ttl";
	
	String pckg = "de.fuberlin.wiwiss.d2rq.";
	Logger rdqlLogger = Logger.getLogger(pckg + "RDQL");
	
	org.apache.log4j.BasicConfigurator.configure();
	
	rdqlLogger.setLevel(Level.DEBUG);

	Model m = new de.fuberlin.wiwiss.d2rq.ModelD2RQ("file:" + propFile);
	
	String sparql = "CONSTRUCT {?s ?p ?o.} WHERE {?s ?p ?o.}";
	Query q = QueryFactory.create(sparql); 
	//ResultSet rs = QueryExecutionFactory.create(q, m).execSelect();
	Model m2 = QueryExecutionFactory.create(q, m).execConstruct();
	/*while (rs.hasNext()) {
	    QuerySolution row = rs.nextSolution();
	    System.out.println("Got here ");
	    //System.out.println(row.)
	};*/
	StmtIterator stmti = m2.listStatements();
	while(stmti.hasNext())
	{
		Statement stmt = stmti.next();
		System.out.println(stmt.getSubject()+ "<<>>" + stmt.getPredicate() + "<<>>" + stmt.getObject());
	}
	
	//String sparql = "SELECT ?s ?p ?o WHERE {?s <http://annotation.semanticweb.org/iswc/iswc.daml#FirstName> \"Yolanda\"^^<http://www.w3.org/2001/XMLSchema#string>}";
	//String sparql = "SELECT ?s ?p ?o WHERE {?s <http://annotation.semanticweb.org/iswc/iswc.daml#phone> ?o}";
	/*Query q2 = QueryFactory.create(sparql); 
	ResultSet rs = QueryExecutionFactory.create(q2, m).execSelect();
	while (rs.hasNext()) {
	    QuerySolution row = rs.nextSolution();
	    
	    System.out.println("-->" + row.get("s") + "<<>>" + row.get("p") + "<<>>" +row.get("o"));
	    
	    //System.out.println("Title: " + row.getLiteral("paperTitle").getString());
	    //System.out.println("Author: " + row.getLiteral("authorName").getString());
	};*/
	
	// Trying sparql insert
	System.out.println("Trying insert ");
	
	Model m3 = new ModelD2RQUpdate("file:" + propFile);

	
	String sparql2 = "DELETE {?person <http://annotation.semanticweb.org/iswc/iswc.daml#phone> \"666\"^^<http://www.w3.org/2001/XMLSchema#string>} WHERE { ?person <http://annotation.semanticweb.org/iswc/iswc.daml#FirstName> \"Yolanda\"^^<http://www.w3.org/2001/XMLSchema#string>}";
	String sparql4 = "INSERT {<http://conferences.org/comp/confno#90> <http://annotation.semanticweb.org/iswc/iswc.daml#phone> \"666\"^^<http://www.w3.org/2001/XMLSchema#string>}";
	String sparql3 = "MODIFY DELETE " + "{?person <http://annotation.semanticweb.org/iswc/iswc.daml#phone> \"666\"^^<http://www.w3.org/2001/XMLSchema#string>}" +
		"INSERT { ?person <http://annotation.semanticweb.org/iswc/iswc.daml#phone> \"667\"^^<http://www.w3.org/2001/XMLSchema#string> }" + 
		"WHERE { ?person <http://annotation.semanticweb.org/iswc/iswc.daml#FirstName> \"Varun\"^^<http://www.w3.org/2001/XMLSchema#string>}";
	
	UpdateRequest u = UpdateFactory.create(sparql4);
	UpdateAction.execute(u, m2);
	System.out.println("Done Inserts ");
	
	m2.close();
	m.close();
}
 
开发者ID:SEMOSS,项目名称:semoss,代码行数:64,代码来源:D2RQTester.java


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