Search in sources :

Example 1 with RepositoryResult

use of org.eclipse.rdf4j.repository.RepositoryResult in project rdf4j by eclipse.

the class SPARQLConnection method getStatementsSingleTriple.

private RepositoryResult<Statement> getStatementsSingleTriple(Resource subj, IRI pred, Value obj, boolean includeInferred, Resource... contexts) throws RepositoryException {
    if (hasStatement(subj, pred, obj, includeInferred, contexts)) {
        Statement st = getValueFactory().createStatement(subj, pred, obj);
        CloseableIteration<Statement, RepositoryException> cursor;
        cursor = new SingletonIteration<Statement, RepositoryException>(st);
        return new RepositoryResult<Statement>(cursor);
    } else {
        return new RepositoryResult<Statement>(new EmptyIteration<Statement, RepositoryException>());
    }
}
Also used : Statement(org.eclipse.rdf4j.model.Statement) RepositoryException(org.eclipse.rdf4j.repository.RepositoryException) RepositoryResult(org.eclipse.rdf4j.repository.RepositoryResult)

Aggregations

Statement (org.eclipse.rdf4j.model.Statement)1 RepositoryException (org.eclipse.rdf4j.repository.RepositoryException)1 RepositoryResult (org.eclipse.rdf4j.repository.RepositoryResult)1