01: package org.mandarax.reference;
02:
03: /*
04: * Copyright (C) 1999-2004 <a href="mailto:jens.dietrich@unforgettable.com">Jens Dietrich</a>
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation; either
09: * version 2 of the License, or (at your option) any later version.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: * You should have received a copy of the GNU Lesser General Public
17: * License along with this library; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19: */
20: import org.mandarax.kernel.InferenceEngine;
21: import org.mandarax.kernel.InferenceEngineFeatureDescriptions;
22: import org.mandarax.kernel.InferenceException;
23: import org.mandarax.kernel.Query;
24: import org.mandarax.kernel.ResultSet;
25:
26: /**
27: * Default inference engine. Instances are just wrappers. The actual inference engine is
28: * the latest stable recommended implementation. This is to support users selecting the
29: * right engine.
30: * @author <A HREF="mailto:jens.dietrich@unforgettable.com">Jens Dietrich</A>
31: * @version 3.4 <7 March 05>
32: * @since 2.1
33: */
34: public class DefaultInferenceEngine implements InferenceEngine {
35: private InferenceEngine delegate = new ResolutionInferenceEngine3();
36:
37: /**
38: * Get the feature descriptions.
39: * @return the feature descriptions
40: */
41: public InferenceEngineFeatureDescriptions getFeatureDescriptions() {
42: return delegate.getFeatureDescriptions();
43: }
44:
45: /**
46: * Answer a query, retrieve (multiple different) result.
47: * The cardinality contraints describe how many results should be computed. It is either
48: * <ol>
49: * <li> <code>ONE</code> - indicating that only one answer is expected
50: * <li> <code>ALL</code> - indicating that all answers should be computed
51: * <li> <code>an integer value greater than 0 indicating that this number of results expected
52: * </ol>
53: * @see #ONE
54: * @see #ALL
55: * @return the result set of the query
56: * @param query the query clause
57: * @param kb the knowledge base used to answer the query
58: * @param aCardinalityConstraint the number of results expected
59: * @param exceptionHandlingPolicy one of the constants definied in this class (BUBBLE_EXCEPTIONS,TRY_NEXT)
60: * @throws an InferenceException
61: */
62: public ResultSet query(Query query,
63: org.mandarax.kernel.KnowledgeBase kb,
64: int aCardinalityConstraint, int exceptionHandlingPolicy)
65: throws InferenceException {
66: return delegate.query(query, kb, aCardinalityConstraint,
67: exceptionHandlingPolicy);
68: }
69: }
|