本文整理了Java中org.eclipse.rdf4j.query.Update
类的一些代码示例,展示了Update
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Update
类的具体详情如下:
包路径:org.eclipse.rdf4j.query.Update
类名称:Update
[英]An update operation on a repository that can be formulated in one of the supported query languages (for example SPARQL).
[中]存储库上的更新操作,可以用一种受支持的查询语言(例如SPARQL)表示。
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
public void execute()
throws UpdateExecutionException
{
delegate.execute();
if (activated) {
for (RepositoryConnectionListener listener : listeners) {
listener.execute(conn, ql, update, baseURI, delegate);
}
}
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-http-server-spring
/**
* @param queryLn
* @param sparqlUpdateString
* @param baseURI
* @param includeInferred
* @param dataset
* @param bindings
* @throws ExecutionException
* @throws InterruptedException
*/
void executeUpdate(QueryLanguage queryLn, String sparqlUpdateString, String baseURI,
boolean includeInferred, Dataset dataset, Map<String, Value> bindings)
throws InterruptedException, ExecutionException
{
Future<Boolean> result = submit(() -> {
Update update = txnConnection.prepareUpdate(queryLn, sparqlUpdateString);
update.setIncludeInferred(includeInferred);
if (dataset != null) {
update.setDataset(dataset);
}
for (String bindingName : bindings.keySet()) {
update.setBinding(bindingName, bindings.get(bindingName));
}
update.execute();
return true;
});
getFromFuture(result);
}
代码示例来源:origin: eclipse/rdf4j
@Override
public BindingSet getBindings() {
return delegate.getBindings();
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testInsertNonMatchingWhereWithBindings()
throws Exception {
logger.debug("executing test testInsertNonMatchingWhereWithBindings");
StringBuilder update = new StringBuilder();
update.append(getNamespaceDeclarations());
update.append("INSERT { ?x rdfs:label ?y . } WHERE { ?x rdfs:comment ?y }");
Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update.toString());
operation.setBinding("x", bob);
operation.setBinding("y", f.createLiteral("Bob"));
assertFalse(con.hasStatement(bob, RDFS.LABEL, null, true));
operation.execute();
assertFalse(con.hasStatement(bob, RDFS.LABEL, null, true));
}
代码示例来源:origin: eclipse/rdf4j
@Override
public void setIncludeInferred(boolean includeInferred) {
delegate.setIncludeInferred(includeInferred);
}
代码示例来源:origin: Merck/Halyard
public int run(CommandLine cmd) throws Exception {
SailRepository rep = new SailRepository(new TimeAwareHBaseSail(getConf(), cmd.getOptionValue('s'), false, 0, true, 0, cmd.getOptionValue('i'), null));
rep.initialize();
try {
Update u = rep.getConnection().prepareUpdate(QueryLanguage.SPARQL, cmd.getOptionValue('q'));
((MapBindingSet)u.getBindings()).addBinding(new TimeAwareHBaseSail.TimestampCallbackBinding());
LOG.info("Update execution started");
u.execute();
LOG.info("Update finished");
} finally {
rep.shutDown();
}
return 0;
}
}
代码示例来源:origin: eclipse/rdf4j
@Override
public void setBinding(String name, Value value) {
delegate.setBinding(name, value);
}
代码示例来源:origin: eclipse/rdf4j
@Override
public void setDataset(Dataset dataset) {
delegate.setDataset(dataset);
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
@Override
public void setMaxExecutionTime(int maxExecTime) {
delegate.setMaxExecutionTime(maxExecTime);
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testInsertEmptyWhereWithBinding()
throws Exception {
logger.debug("executing test testInsertEmptyWhereWithBinding");
StringBuilder update = new StringBuilder();
update.append(getNamespaceDeclarations());
update.append("INSERT {?x rdfs:label ?y . } WHERE { }");
Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update.toString());
operation.setBinding("x", bob);
operation.setBinding("y", f.createLiteral("Bob"));
assertFalse(con.hasStatement(bob, RDFS.LABEL, f.createLiteral("Bob"), true));
operation.execute();
assertTrue(con.hasStatement(bob, RDFS.LABEL, f.createLiteral("Bob"), true));
}
代码示例来源:origin: eclipse/rdf4j
@Override
public void setIncludeInferred(boolean includeInferred) {
delegate.setIncludeInferred(includeInferred);
}
代码示例来源:origin: Merck/Halyard
SailRepositoryConnection con = rep.getConnection();
Update upd = new SailUpdate(singleUpdate, con){};
((MapBindingSet)upd.getBindings()).addBinding(new TimestampCallbackBinding());
LOG.log(Level.INFO, "Execution of: {0}", query);
context.setStatus(name);
upd.execute();
context.setStatus(name + " - " + added.get() + " added " + removed.get() + " removed");
LOG.log(Level.INFO, "Query finished with {0} KeyValues added and {1} removed", new Object[] {added.get(), removed.get()});
代码示例来源:origin: eclipse/rdf4j
@Override
public void setBinding(String name, Value value) {
delegate.setBinding(name, value);
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-repository-event
public void setDataset(Dataset dataset) {
delegate.setDataset(dataset);
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-repository-event
@Override
public void setMaxExecutionTime(int maxExecTime) {
delegate.setMaxExecutionTime(maxExecTime);
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-repository-event
public void execute()
throws UpdateExecutionException
{
delegate.execute();
if (activated) {
for (RepositoryConnectionListener listener : listeners) {
listener.execute(conn, ql, update, baseURI, delegate);
}
}
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-http-protocol
public void execute(RepositoryConnection con)
throws RepositoryException
{
try {
Update preparedUpdate = con.prepareUpdate(QueryLanguage.SPARQL, getUpdateString(), getBaseURI());
preparedUpdate.setIncludeInferred(isIncludeInferred());
preparedUpdate.setDataset(getDataset());
if (getBindings() != null) {
for (Binding binding : getBindings()) {
preparedUpdate.setBinding(binding.getName(), binding.getValue());
}
}
preparedUpdate.execute();
}
catch (MalformedQueryException e) {
throw new RepositoryException(e);
}
catch (UpdateExecutionException e) {
throw new RepositoryException(e);
}
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testInsertWhereWithBindings()
throws Exception {
logger.debug("executing test testInsertWhereWithBindings");
StringBuilder update = new StringBuilder();
update.append(getNamespaceDeclarations());
update.append("INSERT { ?x rdfs:comment ?z . } WHERE { ?x foaf:name ?y }");
Literal comment = f.createLiteral("Bob has a comment");
Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update.toString());
operation.setBinding("x", bob);
operation.setBinding("z", comment);
assertFalse(con.hasStatement(null, RDFS.COMMENT, comment, true));
operation.execute();
assertTrue(con.hasStatement(bob, RDFS.COMMENT, comment, true));
assertFalse(con.hasStatement(alice, RDFS.COMMENT, comment, true));
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
public void setIncludeInferred(boolean includeInferred) {
delegate.setIncludeInferred(includeInferred);
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
public void setBinding(String name, Value value) {
delegate.setBinding(name, value);
}
内容来源于网络,如有侵权,请联系作者删除!