📄 knowledgebase.java
字号:
/*
* Copyright (C) 1999-2004 <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</a>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
package org.mandarax.kernel;
import java.util.Iterator;
import java.util.List;
import org.mandarax.kernel.validation.TestCase;
/**
* Knowledge Base objects are containers managing knowledge represented
* by clauses sets (this includes facts and rules).
* <br/>
* As from version 1.9 the knowledge base manages also a set of (named) queries.
* This is consistent with <a href="www.ruleml.org">RuleML</a> where knowledge bases ("rule bases") also contain queries.
* <br/>
* New methods for adding/removing plugins to the knowledgebase are added since 3.3.1 (by Adrian Paschke).
* <br/>
* New methods for adding/removing test cases to the knowledgebase are added since 3.4 (by Jens Dietrich).
* @see org.mandarax.kernel.Fact
* @see org.mandarax.kernel.Rule
* @see org.mandarax.kernel.ClauseSet
* @see org.mandarax.kernel.validation.TestCase
* @author <A href="http://www-ist.massey.ac.nz/JBDietrich" target="_top">Jens Dietrich</A>
* @version 3.4 <7 March 05>
* @since 1.0
*/
public interface KnowledgeBase extends KnowledgeOwner, ClauseSetChangeListener {
/**
* Add a plugin to knowledgebase
* @parameter plugin a KnowledgeBase
* @parameter id String - the URI of the plugin
* @since 3.3.1 added by Adrian Paschke
*/
void addPlugIn(KnowledgeBase plugin, String id);
/**
* Add a plugin to knowledgebase
* @parameter plugin a KnowledgeBase
* @parameter id String - the URI of the plugin
* @since 3.3.1 added by Adrian Paschke
*/
void addPlugIn(List plugin, String id);
/**
* Add a plugin to knowledgebase
* @parameter plugin a KnowledgeBase
* @parameter id String - the URI of the plugin
* @since 3.3.1 added by Adrian Paschke
*/
void addPlugIn(ClauseSet[] plugin, String id);
/**
* Remove a plugin with the id from knowledgebase
* @parameter id String - the plugin URI
* @since 3.3.1 added by Adrian Paschke
*/
void removePlugIn(String id);
/**
* Add a clause set.
* @param c a clause set
*/
void add(ClauseSet c);
/**
* Add a knowledge base change listener.
* @param l a listener
*/
void addKnowledgeBaseChangeListener(KnowledgeBaseChangeListener l);
/**
* Get a collection containing all clause sets.
* @return a list containing all clause sets
*/
java.util.List getClauseSets();
/**
* Get a collection containing all clause sets that have the key.
* @param the key object
* @return a list containing all clause sets
*/
java.util.List getClauseSets(Object key);
/**
* Get the feature descriptions.
* @return the feature descriptions
*/
KnowledgeBaseFeatureDescriptions getFeatureDescriptions();
/**
* Get the keys.
* @return the list of keys
*/
java.util.Collection getKeys();
/**
* Remove a clause.
* @return true if the object has been found (true) or not (false)
* @param c org.mandarax.kernel.ClauseSet
*/
public boolean remove(ClauseSet c);
/**
* Remove all clauses.
*/
public void removeAll();
/**
* Remove a knowledge base change listener.
* @param l a listener
*/
void removeKnowledgeBaseChangeListener(KnowledgeBaseChangeListener l);
/**
* Add a query.
* @param q a query
*/
void addQuery(Query q);
/**
* Remove a query.
* @param q a query
* @return true if the object has been found (true) or not (false)
*/
boolean removeQuery(Query q);
/**
* Get a query by name or null if there is no query with this name.
* @param queryName a query name
* @return a query of null if there is no query registered with this name
*/
Query getQuery(String queryName);
/**
* Get an iterator for the names of all queries registered.
* @return an iterator
*/
Iterator queryNames();
/**
* Get an iterator for all queries registered.
* @return an iterator
*/
Iterator queries();
/**
* Get an iterator for all predicates contained (in any clause set with-) in the kb.
* @return an iterator
*/
Iterator predicates();
/**
* Get a predicate by name.
* Note that there might by more than one predicate in the kb with the same name.
* In some cases, this makes sense (e.g. polymorphic predicates such as < for different
* types), but should be avoided for "custom" predicates (such as SimplePredicates).
* In this case, this method should return one predicate. In this case, applications can still use
* predicates() in order to find all predicates with a particular name.
* @return a predicate or null indicating that the kb does not contain a predicate with this name
* @param name a predicate name
*/
Predicate getPredicate(String name);
/**
* Add a test case.
* @param testCase a test case
*/
void addTestCase(TestCase testCase);
/**
* Remove a test case.
* @param testCase a test case
* @return true if the object has been found (true) or not (false)
*/
boolean removeTestCase(TestCase testCase);
/**
* Get an iterator for all test cases registered.
* @return an iterator
*/
Iterator testcases ();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -