org.openrdf.repository.sail.SailRepositoryConnection Java Examples

The following examples show how to use org.openrdf.repository.sail.SailRepositoryConnection. 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: QueryRewriterFactory.java    From neo4j-sparql-extension with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Updates the set of rules used for query rewriting.
 *
 * @param conn the connection to use
 */
public final synchronized void
		updateOntology(SailRepositoryConnection conn) {
	try {
		// reload the graph and if not empty load rules from the graph
		URI ctx = conn.getValueFactory().createURI(ontologyContext);
		if (conn.size(ctx) > 0) {
			rules = Rules.fromOntology(new RepositorySource());
		}
	} catch (RepositoryException ex) {
		throw new RuntimeException(ex);
	}
}
 
Example #2
Source File: QueryRewriter.java    From neo4j-sparql-extension with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Create a new query rewriter with a set of rules.
 *
 * @param conn the repository connection used for query execution
 * @param rules the set of rules used for rewriting
 */
public QueryRewriter(
		SailRepositoryConnection conn,
		List<Rule> rules) {
	this.rules = new ArrayList<>(rules);
	this.conn = conn;
	this.vf = conn.getValueFactory();
	for (Rule r : rules) {
		r.setValueFactory(vf);
	}
}
 
Example #3
Source File: SailBooleanExprQuery.java    From neo4j-sparql-extension with GNU General Public License v3.0 4 votes vote down vote up
public SailBooleanExprQuery(ParsedBooleanQuery booleanQuery, SailRepositoryConnection sailConnection) {
	super(booleanQuery, sailConnection);
}
 
Example #4
Source File: SailTupleExprQuery.java    From neo4j-sparql-extension with GNU General Public License v3.0 4 votes vote down vote up
public SailTupleExprQuery(ParsedTupleQuery tupleQuery, SailRepositoryConnection sailConnection) {
	super(tupleQuery, sailConnection);
}
 
Example #5
Source File: SailGraphExprQuery.java    From neo4j-sparql-extension with GNU General Public License v3.0 4 votes vote down vote up
public SailGraphExprQuery(ParsedGraphQuery graphQuery, SailRepositoryConnection sailConnection) {
	super(graphQuery, sailConnection);
}
 
Example #6
Source File: QueryRewriterFactory.java    From neo4j-sparql-extension with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Returns a query rewriter for a given repository connection.
 *
 * @param conn the connection to use
 * @return a query rewriter that uses the TBox from the repository
 */
public synchronized QueryRewriter
		getRewriter(SailRepositoryConnection conn) {
	return new QueryRewriter(conn, rules);
}
 
Example #7
Source File: QueryRewriter.java    From neo4j-sparql-extension with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Create a new query rewriter.
 *
 * @param conn the repository connection used for query execution
 */
public QueryRewriter(SailRepositoryConnection conn) {
	this(conn, Collections.EMPTY_LIST);
}
 
Example #8
Source File: QueryRewriter.java    From neo4j-sparql-extension with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Create a new query rewriter with a set of rules.
 *
 * @param conn the repository connection used for query execution
 * @param rules the set of rules used for rewriting
 */
public QueryRewriter(
		SailRepositoryConnection conn,
		Rule... rules) {
	this(conn, Arrays.asList(rules));
}
 
Example #9
Source File: AbstractSailResource.java    From neo4j-sparql-extension with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Returns a new connection for the current repository.
 *
 * @return a new connection
 * @throws RepositoryException if there was a problem getting the connection
 */
protected SailRepositoryConnection getConnection()
		throws RepositoryException {
	return rep.getConnection();
}