本文整理了Java中org.eclipse.rdf4j.repository.RepositoryConnection.size
方法的一些代码示例,展示了RepositoryConnection.size
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RepositoryConnection.size
方法的具体详情如下:
包路径:org.eclipse.rdf4j.repository.RepositoryConnection
类名称:RepositoryConnection
方法名:size
[英]Returns the number of (explicit) statements that are in the specified contexts in this repository.
[中]返回此存储库中指定上下文中的(显式)语句数。
代码示例来源:origin: joshsh/sesametools
@Override
public int size() {
try {
return (int) rc.size();
} catch (RepositoryException e) {
throw new RepositoryGraphRuntimeException(e);
}
}
代码示例来源:origin: eclipse/rdf4j
@Override
public long size(Resource... contexts)
throws RepositoryException
{
return getDelegate().size(contexts);
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
@Override
public long size(Resource... contexts)
throws RepositoryException
{
return getDelegate().size(contexts);
}
代码示例来源:origin: joshsh/sesametools
protected long sizeInternal(Resource... contexts) throws SailException {
try {
return repoConnection.size();
} catch (RepositoryException e) {
throw new SailException(e);
}
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-http-server-spring
/**
* Returns the number of (explicit) statements that are in the specified contexts in this transaction.
*
* @param contexts
* The context(s) to get the data from. Note that this parameter is a vararg and as such is
* optional. If no contexts are supplied the method operates on the entire repository.
* @return The number of explicit statements from the specified contexts in this transaction.
*/
long getSize(Resource[] contexts)
throws InterruptedException, ExecutionException
{
Future<Long> result = submit(() -> txnConnection.size(contexts));
return getFromFuture(result);
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-http-server-spring
request))
size = repositoryCon.size(contexts);
代码示例来源:origin: franzinc/agraph-java-client
private void testDEFAULT(RepositoryConnection conn)
throws IOException, UpdateExecutionException, RepositoryException,
MalformedQueryException, QueryEvaluationException {
Resource g1 = conn.getValueFactory().createIRI("eh:graph1");
Resource g2 = conn.getValueFactory().createIRI("eh:graph2");
Resource g3 = conn.getValueFactory().createIRI("eh:graph3");
String update = AGAbstractTest.readResourceAsString("/test/update-default.ru");
conn.prepareUpdate(QueryLanguage.SPARQL, update).execute();
Assert.assertEquals(4, conn.size((Resource) null)); // just null context
Assert.assertEquals(2, conn.size(g1));
Assert.assertEquals(2, conn.size(g2));
Assert.assertEquals(0, conn.size(g3));
Assert.assertEquals(8, conn.size()); // whole store, all contexts
// Add the default graph to graph3
update = "ADD DEFAULT TO <eh:graph3>";
conn.prepareUpdate(QueryLanguage.SPARQL, update).execute();
Assert.assertEquals(4, conn.size(g3)); // so, just from the null context
Assert.assertEquals(12, conn.size());
conn.prepareUpdate(QueryLanguage.SPARQL, "DROP DEFAULT").execute();
Assert.assertEquals(0, conn.size((Resource) null));
Assert.assertEquals(8, conn.size());
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testSizeRollback()
throws Exception {
assertEquals(0, testCon.size());
assertEquals(0, testCon2.size());
testCon.setAutoCommit(false);
testCon.add(vf.createBNode(), vf.createIRI("urn:pred"), vf.createBNode());
assertEquals(1, testCon.size());
assertEquals(0, testCon2.size());
testCon.add(vf.createBNode(), vf.createIRI("urn:pred"), vf.createBNode());
assertEquals(2, testCon.size());
assertEquals(0, testCon2.size());
testCon.rollback();
assertEquals(0, testCon.size());
assertEquals(0, testCon2.size());
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testSizeCommit()
throws Exception {
assertEquals(0, testCon.size());
assertEquals(0, testCon2.size());
testCon.setAutoCommit(false);
testCon.add(vf.createBNode(), vf.createIRI("urn:pred"), vf.createBNode());
assertEquals(1, testCon.size());
assertEquals(0, testCon2.size());
testCon.add(vf.createBNode(), vf.createIRI("urn:pred"), vf.createBNode());
assertEquals(2, testCon.size());
assertEquals(0, testCon2.size());
testCon.commit();
assertEquals(2, testCon.size());
assertEquals(2, testCon2.size());
}
代码示例来源:origin: franzinc/agraph-java-client
Assert.assertEquals(4, conn.size((Resource) null)); // just null context
Assert.assertEquals(2, conn.size(g1));
Assert.assertEquals(2, conn.size(g2));
Assert.assertEquals(0, conn.size(g3));
Assert.assertEquals(8, conn.size()); // whole store, all contexts
Assert.assertEquals(5, conn.size((Resource) null));
Assert.assertEquals(5, conn.size((Resource) null));
Assert.assertEquals(1, conn.size(g1));
Assert.assertEquals(1, conn.size(g2));
Assert.assertEquals(0, conn.size(g3));
Assert.assertEquals(7, conn.size());
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testRecoverFromParseError()
throws RepositoryException, IOException {
String invalidData = "bad";
String validData = "@prefix foo: <http://example.org/foo#>.\nfoo:a foo:b foo:c.";
try {
testCon.add(new StringReader(invalidData), "", RDFFormat.TURTLE);
fail("Invalid data should result in an exception");
} catch (RDFParseException e) {
// Expected behaviour
}
try {
testCon.add(new StringReader(validData), "", RDFFormat.TURTLE);
} catch (RDFParseException e) {
fail("Valid data should not result in an exception");
}
assertEquals("Repository contains incorrect number of statements", 1, testCon.size());
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testRecoverFromParseErrorNTriples() throws RepositoryException,
IOException {
String invalidData = "bad";
String validData = "<http://example.org/foo#a> <http://example.org/foo#b> <http://example.org/foo#c> .";
try {
testCon.add(new StringReader(invalidData), "", RDFFormat.NTRIPLES);
fail("Invalid data should result in an exception");
} catch (RDFParseException e) {
// Expected behaviour
}
try {
testCon.add(new StringReader(validData), "", RDFFormat.NTRIPLES);
} catch (RDFParseException e) {
fail("Valid data should not result in an exception");
}
assertEquals("Repository contains incorrect number of statements", 1,
testCon.size());
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testRecoverFromParseErrorNTriples() throws RepositoryException,
IOException {
String invalidData = "bad";
String validData = "<http://example.org/foo#a> <http://example.org/foo#b> <http://example.org/foo#c> .";
try {
testCon.add(new StringReader(invalidData), "", RDFFormat.NTRIPLES);
fail("Invalid data should result in an exception");
} catch (RDFParseException e) {
// Expected behaviour
}
try {
testCon.add(new StringReader(validData), "", RDFFormat.NTRIPLES);
} catch (RDFParseException e) {
fail("Valid data should not result in an exception");
}
assertEquals("Repository contains incorrect number of statements", 1,
testCon.size());
}
代码示例来源:origin: joshsh/sesametools
testRepositoryConnection.add(testInputSubjectUri1, testInputPredicateUri1, testInputObjectUri1, testContext1);
Assert.assertEquals(1, testRepositoryConnection.size());
Assert.assertEquals(1, testRepositoryConnection.size(testContext1));
Assert.assertEquals(1, testRepositoryConnection.size(testContext1));
Assert.assertEquals(1, testRepositoryConnection.size());
代码示例来源:origin: joshsh/sesametools
testRepositoryConnection.add(testInputSubjectUri1, testInputPredicateUri1, testInputObjectUri1, testContext1);
Assert.assertEquals(1, testRepositoryConnection.size());
Assert.assertEquals(1, testRepositoryConnection.size(testContext1));
Assert.assertEquals(1, testRepositoryConnection.size(testContext1));
Assert.assertEquals(1, testRepositoryConnection.size());
代码示例来源:origin: joshsh/sesametools
testRepositoryConnection.add(testInputSubjectUri1, testInputPredicateUri1, testInputObjectUri1, testContext1);
Assert.assertEquals(1, testRepositoryConnection.size());
Assert.assertEquals(1, testRepositoryConnection.size(testContext1));
Assert.assertEquals(1, testRepositoryConnection.size(testContext1));
Assert.assertEquals(1, testRepositoryConnection.size());
代码示例来源:origin: joshsh/sesametools
testRepositoryConnection.add(testInputSubjectUri1, testInputPredicateUri1, testInputObjectUri1, testContext1);
Assert.assertEquals(1, testRepositoryConnection.size());
Assert.assertEquals(1, testRepositoryConnection.size(testContext1));
Assert.assertEquals(1, testRepositoryConnection.size(testContext1));
Assert.assertEquals(1, testRepositoryConnection.size());
代码示例来源:origin: franzinc/agraph-java-client
@Test
@Category(TestSuites.Prepush.class)
public void getRepositoryUsingManager() throws Exception {
final Path confDir = Files.createTempDirectory("repomgr");
closeLater(() -> FileUtils.deleteDirectory(confDir.toFile()));
RepositoryManager manager = new LocalRepositoryManager(confDir.toFile());
manager.initialize();
closeLater(manager::shutDown);
Model graph = parseTurtleGraph(configFile);
updateGraphForTestServer(graph);
// Cleanup
AGRepositoryConfig agConfig = getConfig(graph);
deleteLater(agConfig.getRepositoryId(),
agConfig.getCatalogId());
Resource node = GraphUtil.getUniqueSubject(graph, RDF.TYPE, RepositoryConfigSchema.REPOSITORY);
String id = GraphUtil.getUniqueObjectLiteral(graph, node, RepositoryConfigSchema.REPOSITORYID).stringValue();
RepositoryConfig config = RepositoryConfig.create(graph, node);
config.validate();
manager.addRepositoryConfig(config);
Repository repo = manager.getRepository(id);
repo.initialize();
closeLater(repo::shutDown);
Assert.assertEquals(0, repo.getConnection().size());
}
代码示例来源:origin: joshsh/sesametools
assertEquals(7, rc.size());
代码示例来源:origin: franzinc/agraph-java-client
@Test
@Category(TestSuites.Prepush.class)
public void getRepositoryUsingConfig() throws Exception {
Model graph = parseTurtleGraph(configFile);
updateGraphForTestServer(graph);
AGRepositoryConfig config = getConfig(graph);
deleteLater(config.getRepositoryId(),
config.getCatalogId());
config.setServerUrl(AGAbstractTest.findServerUrl());
config.setUsername(AGAbstractTest.username());
config.setPassword(AGAbstractTest.password());
AGRepositoryFactory factory = new AGRepositoryFactory();
Repository repo = factory.getRepository(config);
repo.initialize();
closeLater(repo::shutDown);
Assert.assertEquals(0, repo.getConnection().size());
Model graph2 = new LinkedHashModel();
config.export(graph2);
Assert.assertEquals(6, graph2.size());
}
内容来源于网络,如有侵权,请联系作者删除!