本文整理了Java中org.openrdf.query.Update.execute()
方法的一些代码示例,展示了Update.execute()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Update.execute()
方法的具体详情如下:
包路径:org.openrdf.query.Update
类名称:Update
方法名:execute
[英]Execute this update on the repository.
[中]在存储库上执行此更新。
代码示例来源:origin: blazegraph/database
/**
* A test which verifies that an exception is NOT thrown if
* the named solution set does not exist and SILENT is specified.
*/
public void test_dropSolutionSet_02() throws UpdateExecutionException,
RepositoryException, MalformedQueryException {
if (!isSolutionSetUpdateEnabled()) {
/*
* Test requires this feature.
*/
return;
}
con.prepareUpdate(QueryLanguage.SPARQL,
"drop silent solutions %namedSet1").execute();
}
代码示例来源:origin: blazegraph/database
@Test
public void testUpdateBaseURI()
throws Exception
{
testCon.prepareUpdate(QueryLanguage.SPARQL, "INSERT DATA { <> a <> }", URN_TEST_S1).execute();
assertThat(testCon.size(), is(equalTo(1L)));
}
代码示例来源:origin: blazegraph/database
@Test
public void testClearAll()
throws Exception
{
logger.debug("executing testClearAll");
String update = "CLEAR ALL";
Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update);
operation.execute();
assertFalse(con.hasStatement(null, null, null, false));
}
代码示例来源:origin: blazegraph/database
/**
* A test which verifies that an exception is NOT thrown if
* the named solution set does not exist and SILENT is specified.
*/
public void test_clearSolutionSet_02() throws UpdateExecutionException,
RepositoryException, MalformedQueryException {
if (!isSolutionSetUpdateEnabled()) {
/*
* Test requires this feature.
*/
return;
}
con.prepareUpdate(QueryLanguage.SPARQL,
"clear silent solutions %namedSet1").execute();
}
代码示例来源:origin: blazegraph/database
@Test
public void testDropAll()
throws Exception
{
logger.debug("executing testDropAll");
String update = "DROP ALL";
Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update);
operation.execute();
assertFalse(con.hasStatement(null, null, null, false));
}
代码示例来源:origin: blazegraph/database
/**
* Update graph using SPARQL Update.
*/
public void update(final String queryStr, final String extQueryId)
throws Exception {
try {
final Update update =
cxn().prepareUpdate(QueryLanguage.SPARQL, queryStr);
update.execute();
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
代码示例来源:origin: org.openrdf.sesame/sesame-sparql-testsuite
@Test
public void testClearAll()
throws Exception
{
logger.debug("executing testClearAll");
String update = "CLEAR ALL";
Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update);
operation.execute();
assertFalse(con.hasStatement(null, null, null, false));
}
代码示例来源:origin: blazegraph/database
/**
* Verify ability to load data from a gzip resource.
*/
public void testLoadGZip()
throws Exception
{
//Depends on bigdata-rdf test resource
final URL url = this.getClass().getClassLoader().getResource("com/bigdata/rdf/rio/small.rdf.gz");
final String update = "LOAD <" + url.toExternalForm() + ">";
final String ns = "http://bigdata.com/test/data#";
con.prepareUpdate(QueryLanguage.SPARQL, update).execute();
assertTrue(con.hasStatement(f.createURI(ns, "mike"), RDFS.LABEL,
f.createLiteral("Michael Personick"), true));
}
代码示例来源:origin: org.openrdf.sesame/sesame-sparql-testsuite
@Test
public void testDropAll()
throws Exception
{
logger.debug("executing testDropAll");
String update = "DROP ALL";
Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update);
operation.execute();
assertFalse(con.hasStatement(null, null, null, false));
}
代码示例来源:origin: blazegraph/database
/**
* A test which verifies that an exception is NOT thrown if
* the named solution set does not exist and SILENT is specified.
*/
public void test_clearSolutionSet_02() throws UpdateExecutionException,
RepositoryException, MalformedQueryException {
if (!isSolutionSetUpdateEnabled()) {
/*
* Test requires this feature.
*/
return;
}
con.prepareUpdate(QueryLanguage.SPARQL,
"clear silent solutions %namedSet1").execute();
}
代码示例来源:origin: blazegraph/database
@Test
public void testInsertNonMatchingWhere()
throws Exception
{
logger.debug("executing test testInsertNonMatchingWhere");
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());
assertFalse(con.hasStatement(bob, RDFS.LABEL, null, true));
operation.execute();
assertFalse(con.hasStatement(bob, RDFS.LABEL, null, true));
}
代码示例来源:origin: blazegraph/database
/**
* A test which verifies that an exception is NOT thrown if
* the named solution set does not exist and SILENT is specified.
*/
public void test_dropSolutionSet_02() throws UpdateExecutionException,
RepositoryException, MalformedQueryException {
if (!isSolutionSetUpdateEnabled()) {
/*
* Test requires this feature.
*/
return;
}
con.prepareUpdate(QueryLanguage.SPARQL,
"drop silent solutions %namedSet1").execute();
}
代码示例来源:origin: org.openrdf.sesame/sesame-sparql-testsuite
@Test
public void testInsertNonMatchingWhere()
throws Exception
{
logger.debug("executing test testInsertNonMatchingWhere");
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());
assertFalse(con.hasStatement(bob, RDFS.LABEL, null, true));
operation.execute();
assertFalse(con.hasStatement(bob, RDFS.LABEL, null, true));
}
代码示例来源:origin: blazegraph/database
/**
* Verify ability to load data from a gzip resource.
*/
public void testLoadGZip()
throws Exception
{
//Depends on bigdata-rdf test resource
final URL url = this.getClass().getClassLoader().getResource("com/bigdata/rdf/rio/small.rdf.gz");
final String update = "LOAD <" + url.toExternalForm() + ">";
final String ns = "http://bigdata.com/test/data#";
con.prepareUpdate(QueryLanguage.SPARQL, update).execute();
assertTrue(con.hasStatement(f.createURI(ns, "mike"), RDFS.LABEL,
f.createLiteral("Michael Personick"), true));
}
代码示例来源:origin: blazegraph/database
@Test
public void testDeleteData()
throws Exception
{
logger.debug("executing testDeleteData");
StringBuilder update = new StringBuilder();
update.append(getNamespaceDeclarations());
update.append("DELETE DATA { ex:alice foaf:knows ex:bob. } ");
Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update.toString());
assertTrue(con.hasStatement(alice, FOAF.KNOWS, bob, true));
operation.execute();
String msg = "statement should have been deleted.";
assertFalse(msg, con.hasStatement(alice, FOAF.KNOWS, bob, true));
}
代码示例来源:origin: blazegraph/database
@Test
public void testDeleteDataFromGraph()
throws Exception
{
logger.debug("executing testDeleteDataFromGraph");
StringBuilder update = new StringBuilder();
update.append(getNamespaceDeclarations());
update.append("DELETE DATA { GRAPH ex:graph1 {ex:alice foaf:knows ex:bob. } } ");
Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update.toString());
assertTrue(con.hasStatement(alice, FOAF.KNOWS, bob, true, graph1));
operation.execute();
String msg = "statement should have been deleted from graph1";
assertFalse(msg, con.hasStatement(alice, FOAF.KNOWS, bob, true, graph1));
}
代码示例来源:origin: org.openrdf.sesame/sesame-sparql-testsuite
@Test
public void testDeleteData()
throws Exception
{
logger.debug("executing testDeleteData");
StringBuilder update = new StringBuilder();
update.append(getNamespaceDeclarations());
update.append("DELETE DATA { ex:alice foaf:knows ex:bob. } ");
Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update.toString());
assertTrue(con.hasStatement(alice, FOAF.KNOWS, bob, true));
operation.execute();
String msg = "statement should have been deleted.";
assertFalse(msg, con.hasStatement(alice, FOAF.KNOWS, bob, true));
}
代码示例来源:origin: org.openrdf.sesame/sesame-sparql-testsuite
@Test
public void testDeleteDataFromGraph()
throws Exception
{
logger.debug("executing testDeleteDataFromGraph");
StringBuilder update = new StringBuilder();
update.append(getNamespaceDeclarations());
update.append("DELETE DATA { GRAPH ex:graph1 {ex:alice foaf:knows ex:bob. } } ");
Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update.toString());
assertTrue(con.hasStatement(alice, FOAF.KNOWS, bob, true, graph1));
operation.execute();
String msg = "statement should have been deleted from graph1";
assertFalse(msg, con.hasStatement(alice, FOAF.KNOWS, bob, true, graph1));
}
代码示例来源:origin: blazegraph/database
@Test
public void testCopyToNewNamed()
throws Exception
{
logger.debug("executing testCopyToNewNamed");
StringBuilder update = new StringBuilder();
update.append(getNamespaceDeclarations());
update.append("COPY GRAPH ex:graph1 TO ex:graph3");
Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update.toString());
operation.execute();
assertTrue(con.hasStatement(bob, FOAF.NAME, null, false, f.createURI(EX_NS, "graph3")));
assertTrue(con.hasStatement(bob, FOAF.NAME, null, false, graph1));
}
代码示例来源:origin: blazegraph/database
@Test
public void testAddToNewNamed()
throws Exception
{
logger.debug("executing testAddToNewNamed");
StringBuilder update = new StringBuilder();
update.append(getNamespaceDeclarations());
update.append("ADD GRAPH ex:graph1 TO ex:graph3");
Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update.toString());
operation.execute();
assertTrue(con.hasStatement(bob, FOAF.NAME, null, false, f.createURI(EX_NS, "graph3")));
assertTrue(con.hasStatement(bob, FOAF.NAME, null, false, graph1));
}
内容来源于网络,如有侵权,请联系作者删除!