Interface Reasoner
- All Known Implementing Classes:
ReasonerNotThreaded
,ReasonerThreadedFactsPartitioning
,ReasonerThreadedRulesPartitioning
public interface Reasoner
a reasoner performs the reasoning process
- Author:
- angele
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the reasoner.void
compile
(IntensionalDB idb, ExtensionalDB[] edbs, ReasoningMonitor monitor, SystemMonitor smonitor, boolean topdown, int maxNumberOfResults, boolean streamReasoning, boolean streamReasoningWithRetracts) compile rules for the reasoning processevaluate()
starts evaluation and returns iterators for the results of the evaluationvoid
Starts evaluation and feed the results into receiverStarts evaluation for several queries.void
Is called after reasoning process is finishedget queries after compilationReturns the reasoning symbol table used to create new symbols during reasoning
This reasoning symbol table is different to the base symbol table given by core.getSymbolTable()
To decode reasoning results always use this onevoid
register
(InterruptFlag interruptFlag, List<EventResultReceiver> receiver, CoreReadLock edbReadLock) Register several queries for events caused by sensors or in case of
stream reasoning db caused by added facts.
Every time events from sensors arrive there might be one or more new results.
For every result receiver.receive is called
This is used for stream reasoningboolean
Have results contained whole edb relations?boolean
test
(Reader in, SymbolTable baseTable, ExternalDataTypeProvider datatypes, ExtensionalDB edb, boolean topdown, String path, BuiltinProvider builtinProvider, RewriterProvider rewriterProvider, Configuration config, Properties prp) Testing the evaluation.
-
Method Details
-
test
boolean test(Reader in, SymbolTable baseTable, ExternalDataTypeProvider datatypes, ExtensionalDB edb, boolean topdown, String path, BuiltinProvider builtinProvider, RewriterProvider rewriterProvider, Configuration config, Properties prp) throws ReasoningException, IOException, ReasoningException, InterruptedException, SemReasonerException Testing the evaluation.
The file contains rules and facts and solutions.
Solutions are given by the solutions predicate.
This method reads the file, stores the facts in an edb,
stores the rules in an idb, compiles and evaluates
the query and compares the results to the solutions- Parameters:
in
- , reader for e.g. a filebaseTable
- , symbol tableedb
- , extensional databasetopdown
- , top down evaluation (magic sets)path
- , path to edbbuiltinProvider
- , provides builtinsrewriterProvider
- , provides rewritersconfig
- , a configurationprp
- , builtin properties- Returns:
- true, if results of evaluation are the same as the solutions inside the file
- Throws:
ReasoningException
IOException
InterruptedException
SemReasonerException
-
evaluate
void evaluate(Receiver receiver) throws InterruptedException, ReasoningException, IOException, SemReasonerException Starts evaluation and feed the results into receiver- Parameters:
receiver
- , the results are sent to receiver- Throws:
InterruptedException
ReasoningException
IOException
SemReasonerException
-
evaluate
List<TupleEnumerator> evaluate() throws InterruptedException, ReasoningException, IOException, SemReasonerExceptionstarts evaluation and returns iterators for the results of the evaluation- Returns:
- iterator for results
- Throws:
InterruptedException
ReasoningException
IOException
SemReasonerException
-
evaluateSeveralQueries
List<List<TupleEnumerator>> evaluateSeveralQueries() throws InterruptedException, ReasoningException, IOException, SemReasonerExceptionStarts evaluation for several queries.
For every query a list of iterators for the results is returned.- Returns:
- , list of tuple enumerators for results
- Throws:
InterruptedException
ReasoningException
IOException
SemReasonerException
-
close
Close the reasoner. Must be called to correctly finalize the reasoner -
evaluationFinished
Is called after reasoning process is finished -
getSymbolTable
SymbolTable getSymbolTable()Returns the reasoning symbol table used to create new symbols during reasoning
This reasoning symbol table is different to the base symbol table given by core.getSymbolTable()
To decode reasoning results always use this one- Returns:
-
compile
void compile(IntensionalDB idb, ExtensionalDB[] edbs, ReasoningMonitor monitor, SystemMonitor smonitor, boolean topdown, int maxNumberOfResults, boolean streamReasoning, boolean streamReasoningWithRetracts) throws InterruptedException, IOException, SemReasonerException compile rules for the reasoning process- Parameters:
idb
- , intensional dbedbs
- extensional dbsmonitor
- , monitoring reasoning and memory consumptionsmonitor
- , system monitor, used by system may be nulltopdown
- , execution is done top down (magic sets)streamReasoningWithRetracts
- , retracts in stream reasoningstreamReasoning
- , stream reasoning is done- Throws:
InterruptedException
IOException
SemReasonerException
-
register
void register(InterruptFlag interruptFlag, List<EventResultReceiver> receiver, CoreReadLock edbReadLock) throws InterruptedException, IOException, SemReasonerException Register several queries for events caused by sensors or in case of
stream reasoning db caused by added facts.
Every time events from sensors arrive there might be one or more new results.
For every result receiver.receive is called
This is used for stream reasoning- Parameters:
interruptFlag
- , interruptreceiver
-edbReadLock
- , the read lock for the extensional db, used during reasoning- Throws:
IOException
SemReasonerException
InterruptedException
-
resultsContainedEDBRelations
boolean resultsContainedEDBRelations()Have results contained whole edb relations?- Returns:
-
getQueries
get queries after compilation- Returns:
-