本文整理了Java中org.eclipse.rdf4j.repository.RepositoryConnection.hasStatement
方法的一些代码示例,展示了RepositoryConnection.hasStatement
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RepositoryConnection.hasStatement
方法的具体详情如下:
包路径:org.eclipse.rdf4j.repository.RepositoryConnection
类名称:RepositoryConnection
方法名:hasStatement
[英]Checks whether the repository contains statements with a specific subject, predicate and/or object, optionally in the specified contexts.
[中]检查存储库是否包含具有特定主语、谓语和/或宾语的语句(可选地在指定的上下文中)。
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
@Override
public boolean mayHaveStatement(RepositoryConnection conn, Resource subj, IRI pred, Value obj,
Resource... contexts)
{
return conn.hasStatement(subj, pred, obj, includeInferred, contexts);
}
代码示例来源:origin: eclipse/rdf4j
@Override
public boolean mayHaveStatement(RepositoryConnection conn, Resource subj, IRI pred, Value obj,
Resource... contexts)
{
return conn.hasStatement(subj, pred, obj, includeInferred, contexts);
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
private boolean isRepositoryConfigContext(RepositoryConnection con, Resource context)
throws RepositoryException
{
logger.debug("Is {} a repository config context?", context);
return con.hasStatement(context, RDF.TYPE, REPOSITORY_CONTEXT, true, (Resource)null);
}
代码示例来源:origin: de.tudarmstadt.ukp.inception.rdf4j/rdf4j-shacl
@Override
public boolean requiresEvaluation(Repository addedStatements, Repository removedStatements) {
boolean requiresEvalutation;
try (RepositoryConnection addedStatementsConnection = addedStatements.getConnection()) {
requiresEvalutation = addedStatementsConnection.hasStatement(null, path, null, false);
}
try (RepositoryConnection removedStatementsConnection = removedStatements.getConnection()) {
requiresEvalutation |= removedStatementsConnection.hasStatement(null, path, null, false);
}
return requiresEvalutation;
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-shacl
@Override
public boolean requiresEvaluation(Repository addedStatements, Repository removedStatements) {
boolean requiresEvalutation;
try (RepositoryConnection addedStatementsConnection = addedStatements.getConnection()) {
requiresEvalutation = addedStatementsConnection.hasStatement(null, path, null, false);
}
try (RepositoryConnection removedStatementsConnection = removedStatements.getConnection()) {
requiresEvalutation |= removedStatementsConnection.hasStatement(null, path, null, false);
}
return requiresEvalutation;
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-shacl
@Override
public boolean requiresEvaluation(Repository addedStatements, Repository removedStatements) {
boolean requiresEvalutation;
try (RepositoryConnection addedStatementsConnection = addedStatements.getConnection()) {
requiresEvalutation = addedStatementsConnection.hasStatement(null, RDF.TYPE, targetClass, false);
}
return super.requiresEvaluation(addedStatements, removedStatements) || requiresEvalutation;
}
代码示例来源:origin: de.tudarmstadt.ukp.inception.rdf4j/rdf4j-shacl
@Override
public boolean requiresEvaluation(Repository addedStatements, Repository removedStatements) {
boolean requiresEvalutation;
try (RepositoryConnection addedStatementsConnection = addedStatements.getConnection()) {
requiresEvalutation = addedStatementsConnection.hasStatement(null, RDF.TYPE, targetClass, false);
}
return super.requiresEvaluation(addedStatements, removedStatements) || requiresEvalutation;
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
@Override
public boolean hasStatement(Resource subj, IRI pred, Value obj, boolean includeInferred,
Resource... contexts)
throws RepositoryException
{
if (isDelegatingRead()) {
return getDelegate().hasStatement(subj, pred, obj, includeInferred, contexts);
}
return super.hasStatement(subj, pred, obj, includeInferred, contexts);
}
代码示例来源:origin: eclipse/rdf4j
@Override
public boolean hasStatement(Resource subj, IRI pred, Value obj, boolean includeInferred,
Resource... contexts)
throws RepositoryException
{
if (isDelegatingRead()) {
return getDelegate().hasStatement(subj, pred, obj, includeInferred, contexts);
}
return super.hasStatement(subj, pred, obj, includeInferred, contexts);
}
代码示例来源:origin: eclipse/rdf4j
@Override
public boolean hasStatement(Statement st, boolean includeInferred, Resource... contexts)
throws RepositoryException
{
if (isDelegatingRead()) {
return getDelegate().hasStatement(st, includeInferred, contexts);
}
return super.hasStatement(st, includeInferred, contexts);
}
代码示例来源:origin: org.eclipse.rdf4j/rdf4j-client
@Override
public boolean hasStatement(Statement st, boolean includeInferred, Resource... contexts)
throws RepositoryException
{
if (isDelegatingRead()) {
return getDelegate().hasStatement(st, includeInferred, contexts);
}
return super.hasStatement(st, includeInferred, contexts);
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testDropNamed()
throws Exception {
logger.debug("executing testDropNamed");
String update = "DROP NAMED";
Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update);
operation.execute();
assertFalse(con.hasStatement(null, null, null, false, graph1));
assertFalse(con.hasStatement(null, null, null, false, graph2));
assertTrue(con.hasStatement(null, null, null, false));
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testClearNamed()
throws Exception {
logger.debug("executing testClearNamed");
String update = "CLEAR NAMED";
Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update);
operation.execute();
assertFalse(con.hasStatement(null, null, null, false, graph1));
assertFalse(con.hasStatement(null, null, null, false, graph2));
assertTrue(con.hasStatement(null, null, null, false));
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testInsertEmptyWhere()
throws Exception {
logger.debug("executing test testInsertEmptyWhere");
StringBuilder update = new StringBuilder();
update.append(getNamespaceDeclarations());
update.append("INSERT { <" + bob + "> rdfs:label \"Bob\" . } WHERE { }");
Update operation = con.prepareUpdate(QueryLanguage.SPARQL, update.toString());
assertFalse(con.hasStatement(bob, RDFS.LABEL, f.createLiteral("Bob"), true));
operation.execute();
assertTrue(con.hasStatement(bob, RDFS.LABEL, f.createLiteral("Bob"), true));
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testHasStatementWithoutBNodes() throws Exception {
testCon.add(name, name, nameBob);
assertTrue("Repository should contain newly added statement", testCon
.hasStatement(name, name, nameBob, false));
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testAddGzipInputStreamNTriples() throws Exception {
// add file default-graph.nt.gz to repository, no context
File nt = Util.resourceAsTempFile(TEST_DIR_PREFIX + "default-graph.nt");
addInputFile(createTempGzipFileFrom(nt), RDFFormat.NTRIPLES);
assertTrue("Repository should contain newly added statements", testCon
.hasStatement(null, publisher, nameBob, false));
assertTrue("Repository should contain newly added statements", testCon
.hasStatement(null, publisher, nameAlice, false));
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testHasStatementWithBNodes() throws Exception {
testCon.add(bob, name, nameBob);
assertTrue("Repository should contain newly added statement", testCon
.hasStatement(bob, name, nameBob, false));
}
代码示例来源:origin: franzinc/agraph-java-client
@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: franzinc/agraph-java-client
@Test
public void testRollback()
throws Exception {
testCon.setAutoCommit(false);
testCon.add(alice, name, nameAlice);
assertTrue("Uncommitted updates should be visible to own connection", testCon.hasStatement(alice, name,
nameAlice, false));
testCon.rollback();
assertFalse("Repository should not contain statement after rollback", testCon.hasStatement(alice, name,
nameAlice, false));
testCon.setAutoCommit(true);
}
代码示例来源:origin: franzinc/agraph-java-client
@Test
public void testSubClassInference()
throws Exception {
testCon.setAutoCommit(false);
testCon.add(woman, RDFS.SUBCLASSOF, person);
testCon.add(man, RDFS.SUBCLASSOF, person);
testCon.add(alice, RDF.TYPE, woman);
testCon.setAutoCommit(true);
assertTrue(testCon.hasStatement(alice, RDF.TYPE, person, true));
}
内容来源于网络,如有侵权,请联系作者删除!