| org.mandarax.kernel.InferenceEngine
All known Subclasses: org.mandarax.reference.AbstractResolutionInferenceEngine, org.mandarax.reference.DefaultInferenceEngine,
InferenceEngine | public interface InferenceEngine (Code) | | Basic interface of an inference engine.
From version 1.7, we are using a new API for querying.
There are two reasons to discard the old API (despite these methods are still available but marked
as deprecated :
- Clause sets now may throw exceptions when an interator is requested. This is to take into account that mandarax
does not have to copy all knowledge into local memory, but can integrate clause sets from remote datasources
(like web services), databases and so on. With the query, an exception handling policy can be specified. There are
two policies avaialble right now: interrupt the derivation, or try the next clause or clause set.
- The result is represented by the new class
ResultSet designed similar to java.sql.ResultSet .
This is to emphasize the database aspect of mandarax ('deductive database') and to help programmers using the API (assuming that
most of them know JDBC). We will explore in the future to integrate more and more JDBC functionality, perhaps there could even be
a Mandarax JDBC driver at the end of this process. The main problem seems to be a 'pure string based' query language ala SQL.
From version 1.9, query methods expect an instance of Query (and not Clause ) to represent the query.
Users have normally used facts to represent queries. For compatibility, the fact reference implementation
implements the query interface.
Since 2.0, some deprecated query methods have been removed.
See Also: org.mandarax.reference.FactImpl See Also: org.mandarax.reference.Query author: Jens Dietrich version: 3.4 <7 March 05> since: 1.0 |
ALL | final public static int ALL(Code) | | |
BUBBLE_EXCEPTIONS | final public static int BUBBLE_EXCEPTIONS(Code) | | |
ONE | final public static int ONE(Code) | | |
TRY_NEXT | final public static int TRY_NEXT(Code) | | |
query | ResultSet query(Query query, KnowledgeBase kb, int aCardinalityConstraint, int exceptionHandlingPolicy) throws InferenceException(Code) | | Answer a query, retrieve (multiple different) result.
The cardinality contraints describe how many results should be computed. It is either
-
ONE - indicating that only one answer is expected
-
ALL - indicating that all answers should be computed
-
an integer value greater than 0 indicating that this number of results expected
Note that computing many or all answers can be a very expensive task!
Not all inference engines will support retrieving multiple answers, to find out whether this is supported use the feature descriptions.
If it is not supported, a runtime exception (java.lang.IllegalArgumentException )
is thrown indicating that the parameter (e.g. ALL ) is not valid.
See Also: InferenceEngine.ONE See Also: InferenceEngine.ALL the result set of the query Parameters: query - the query Parameters: kb - the knowledge base used to answer the query Parameters: aCardinalityConstraint - the number of results expected Parameters: exceptionHandlingPolicy - one of the constants definied in this class (BUBBLE_EXCEPTIONS,TRY_NEXT) throws: an - InferenceException |
|
|