01: /*
02: * Copyright (C) 1999-2004 <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</a>
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18: package org.mandarax.kernel;
19:
20: /**
21: * Interface representing queries. Queries consist of one or many facts and a common name.
22: * The inference engine then tries to replace the variables in these facts by constants, using
23: * the knowledge in a knowledge base.
24: * <br>
25: * DerivationEventListeners can be attached to a query. If the IE supports them (use the feature descriptor
26: * of the IE to find out) the respective callback will be called by the IE.
27: * @see org.mandarax.kernel.Fact
28: * @see org.mandarax.kernel.LogicFactory
29: * @see org.mandarax.kernel.DerivationEventListener
30: * @author <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</A>
31: * @version 3.4 <7 March 05>
32: * @since 1.9
33: */
34: public interface Query extends PropertiesSupport {
35:
36: /**
37: * Get the facts.
38: * @see org.mandarax.kernel.Fact
39: * @return an array of facts
40: */
41: public Fact[] getFacts();
42:
43: /**
44: * Set the facts.
45: * @see org.mandarax.kernel.Fact
46: * @param facts an array of facts
47: */
48: public void setFacts(Fact[] facts);
49:
50: /**
51: * Get the common name of this query, i.e., something like "Find the oncle of a person".
52: * @return a string
53: */
54: public String getName();
55:
56: /**
57: * Set the common name of this query.
58: * @param a name
59: */
60: public void setName(String queryName);
61:
62: /**
63: * Get the registered derivation event listener.
64: * @return the derivation event listeners
65: */
66: public DerivationEventListener[] getDerivationEventListeners();
67:
68: /**
69: * Set the derivation event listeners.
70: * @param listeners listeners
71: */
72: public void setDerivationEventListeners(
73: DerivationEventListener[] listeners);
74:
75: /**
76: * Indicates whether the clause is ground (= does not have variables).
77: * @return a boolean
78: */
79: public boolean isGround();
80: }
|