public class KiWiReasoningConnection extends KiWiConnection
KiWiConnection.RetryCommand<T>, KiWiConnection.RetryExecution<T>
cacheManager, connection, dialect, persistence, tripleBatch
Constructor and Description |
---|
KiWiReasoningConnection(KiWiPersistence persistence,
KiWiDialect dialect,
CacheManager cacheManager,
org.openrdf.model.ValueFactory valueFactory) |
Modifier and Type | Method and Description |
---|---|
protected Justification |
constructJustificationFromDatabase(ResultSet row) |
protected Program |
constructProgramFromDatabase(ResultSet row) |
protected Rule |
constructRuleFromDatabase(ResultSet row,
Map<String,String> namespaces) |
void |
deleteJustifications()
Delete all justifications.
|
void |
deleteJustifications(Iterable<Justification> justifications)
Delete the justifications given as argument (batch operation).
|
void |
deleteJustifications(info.aduna.iteration.Iteration<Justification,SQLException> justifications)
Delete the justifications given as argument (batch operation).
|
void |
deleteJustifications(KiWiTriple triple)
Delete the justifications referring to a certain triple given as argument.
|
void |
deleteJustifications(Rule rule)
Delete the justifications referring to a certain rule given as argument.
|
void |
deleteProgram(Program program)
Delete the (persistent) program given as argument from the database, including all rules, justifications and
namespaces refenced by the program or its rules.
|
info.aduna.iteration.CloseableIteration<Justification,SQLException> |
listJustificationsBySupporting(KiWiTriple triple)
List all justifications supported by the given triple.
|
info.aduna.iteration.CloseableIteration<Justification,SQLException> |
listJustificationsBySupporting(Rule rule)
List all justifications supported by the given rule.
|
info.aduna.iteration.CloseableIteration<Justification,SQLException> |
listJustificationsForTriple(KiWiTriple triple)
List all justifications supporting the given triple.
|
info.aduna.iteration.CloseableIteration<Justification,SQLException> |
listJustificationsForTriple(long tripleId)
List all justifications supporting the given triple.
|
info.aduna.iteration.CloseableIteration<Program,SQLException> |
listPrograms()
List all currently existing programs in the database.
|
info.aduna.iteration.CloseableIteration<KiWiTriple,SQLException> |
listUnsupportedTriples()
List all triples that are not supported by at least one justification.
|
Program |
loadProgram(Long id)
Load and return the program with the ID given as argument.
|
Program |
loadProgram(String name)
Load and return the program with the name given as argument.
|
Rule |
loadRuleById(long ruleId,
Map<String,String> namespaces)
Load the rule with the given database ID from the database.
|
info.aduna.iteration.CloseableIteration<Rule,SQLException> |
loadRulesByProgram(long programId,
Map<String,String> namespaces)
Load the rule with the given database ID from the database.
|
info.aduna.iteration.CloseableIteration<QueryResult,SQLException> |
query(Collection<Pattern> patterns,
QueryResult initialBindings,
Set<Filter> filters,
List<VariableField> orderBy,
boolean justifications)
Evaluate a query on the triple store.
|
void |
removeRule(Rule rule)
Remove the rule given as argument from the database.
|
void |
storeJustifications(Iterable<Justification> justifications)
Store a collection of new justification in the database.
|
void |
storeProgram(Program program)
Store the program given as argument in the database.
|
void |
storeRule(Rule rule,
Map<String,String> namespaces)
Store the rule given as argument in the database.
|
void |
updateProgram(Program program)
Store the program given as argument in the database.
|
close, commit, constructNamespaceFromDatabase, constructNodeFromDatabase, constructTripleFromDatabase, constructTripleQuery, constructTriplesFromDatabase, deleteAll, deleteContext, deleteNamespace, deleteTriple, flushBatch, getAutoCommit, getBatchSize, getCacheManager, getConfiguration, getDatabaseTables, getDatabaseVersion, getDialect, getJDBCConnection, getLocale, getMetadata, getNextSequence, getPreparedStatement, getPreparedStatement, getSize, getSize, getTransactionId, getTripleId, isBatchCommit, isClosed, listContexts, listNamespaces, listResources, listResources, listTriples, loadAnonResource, loadLiteral, loadLiteral, loadLiteral, loadLiteral, loadLiteral, loadNamespaceByPrefix, loadNamespaceByUri, loadNodeById, loadNodesByIds, loadTripleById, loadUriResource, requireJDBCConnection, rollback, setAutoCommit, setBatchCommit, setBatchSize, setMetadata, storeNamespace, storeNode, storeTriple, undeleteTriple
public KiWiReasoningConnection(KiWiPersistence persistence, KiWiDialect dialect, CacheManager cacheManager, org.openrdf.model.ValueFactory valueFactory) throws SQLException
SQLException
public void storeRule(Rule rule, Map<String,String> namespaces) throws SQLException
rule
- SQLException
public Rule loadRuleById(long ruleId, Map<String,String> namespaces) throws SQLException
ruleId
- SQLException
public info.aduna.iteration.CloseableIteration<Rule,SQLException> loadRulesByProgram(long programId, Map<String,String> namespaces) throws SQLException, ParseException
SQLException
ParseException
protected Rule constructRuleFromDatabase(ResultSet row, Map<String,String> namespaces) throws SQLException, ParseException
SQLException
ParseException
public void removeRule(Rule rule) throws SQLException
rule
- SQLException
public void storeProgram(Program program) throws SQLException
program
- SQLException
public void updateProgram(Program program) throws SQLException
program
- the program to updateSQLException
public Program loadProgram(String name) throws SQLException
name
- the name of the program to loadSQLException
- in case of a database problem or an unparsable programpublic Program loadProgram(Long id) throws SQLException
SQLException
protected Program constructProgramFromDatabase(ResultSet row) throws SQLException, ParseException
SQLException
ParseException
public info.aduna.iteration.CloseableIteration<Program,SQLException> listPrograms() throws SQLException
SQLException
public void deleteProgram(Program program) throws SQLException
program
- SQLException
public void storeJustifications(Iterable<Justification> justifications) throws SQLException
justifications
- SQLException
public void deleteJustifications(Iterable<Justification> justifications) throws SQLException
justifications
- SQLException
public void deleteJustifications(info.aduna.iteration.Iteration<Justification,SQLException> justifications) throws SQLException
justifications
- SQLException
public void deleteJustifications(Rule rule) throws SQLException
rule
- SQLException
public void deleteJustifications(KiWiTriple triple) throws SQLException
triple
- SQLException
public void deleteJustifications() throws SQLException
SQLException
public info.aduna.iteration.CloseableIteration<Justification,SQLException> listJustificationsBySupporting(Rule rule) throws SQLException
rule
- SQLException
public info.aduna.iteration.CloseableIteration<Justification,SQLException> listJustificationsBySupporting(KiWiTriple triple) throws SQLException
triple
- SQLException
public info.aduna.iteration.CloseableIteration<Justification,SQLException> listJustificationsForTriple(KiWiTriple triple) throws SQLException
triple
- SQLException
public info.aduna.iteration.CloseableIteration<Justification,SQLException> listJustificationsForTriple(long tripleId) throws SQLException
tripleId
- SQLException
protected Justification constructJustificationFromDatabase(ResultSet row) throws SQLException
SQLException
public info.aduna.iteration.CloseableIteration<KiWiTriple,SQLException> listUnsupportedTriples() throws SQLException
SQLException
public info.aduna.iteration.CloseableIteration<QueryResult,SQLException> query(Collection<Pattern> patterns, QueryResult initialBindings, Set<Filter> filters, List<VariableField> orderBy, boolean justifications) throws SQLException
patterns
- the set of patterns to query; patterns are considered to be connected by AND;
occurrences of the same variable in multiple patterns will be evaluated as a joininitialBindings
- initial bindings of variable fields may be used in case some bindings are
already available to further restrict the results; the purpose of this parameter
is to support query-by-example queries as well as to speed up e.g. incremental
reasoningfilters
- a set of filters to apply to the result before returning the bindings; depending
on the kind of filter, filtering will be carried out by the database or in memoryorderBy
- list of variables by whose bindings the result rows should be ordered; variables
at the beginning of the list take precedence over variables that are further behindSQLException
Copyright © 2012–2018 The Apache Software Foundation. All rights reserved.