Java Code Examples for org.eclipse.rdf4j.query.GraphQuery#setIncludeInferred()

The following examples show how to use org.eclipse.rdf4j.query.GraphQuery#setIncludeInferred() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SPARQLConnection.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private RepositoryResult<Statement> getStatementGeneral(Resource subj, IRI pred, Value obj, boolean includeInferred,
		Resource... contexts) throws RepositoryException, MalformedQueryException, QueryEvaluationException {
	GraphQueryResult gRes = null;
	RepositoryResult<Statement> result = null;

	boolean allGood = false;
	try {
		GraphQuery query = prepareGraphQuery(SPARQL, EVERYTHING, "");
		query.setIncludeInferred(includeInferred);
		setBindings(query, subj, pred, obj, contexts);
		gRes = query.evaluate();
		result = new RepositoryResult<>(
				new ExceptionConvertingIteration<Statement, RepositoryException>(gRes) {

					@Override
					protected RepositoryException convert(Exception e) {
						return new RepositoryException(e);
					}
				});
		allGood = true;
		return result;
	} finally {
		if (!allGood) {
			try {
				if (result != null) {
					result.close();
				}
			} finally {
				if (gRes != null) {
					gRes.close();
				}
			}
		}
	}
}
 
Example 2
Source File: SailConnectionQueryPreparer.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public GraphQuery prepare(ParsedGraphQuery graphQuery) {
	GraphQuery query = new SailConnectionGraphQuery(graphQuery, con, vf);
	query.setIncludeInferred(includeInferred);
	return query;
}
 
Example 3
Source File: SailQueryPreparer.java    From rdf4j with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public GraphQuery prepare(ParsedGraphQuery graphQuery) {
	GraphQuery query = new SailGraphQuery(graphQuery, con);
	query.setIncludeInferred(includeInferred);
	return query;
}