1   /* KnowledgeBase.java
2    *
3    * Copyright (c) 2002-2003, The University of Sheffield.
4    *
5    * This file is part of GATE (see http://gate.ac.uk/), and is free
6    * software, licenced under the GNU Library General Public License,
7    * Version 2, June1991.
8    *
9    * A copy of this licence is included in the distribution in the file
10   * licence.html, and is also available at http://gate.ac.uk/gate/licence.html.
11   *
12   * Kalina Bontcheva 03/2003
13   *
14   */
15  
16  package gate.creole.ontology;
17  
18  import java.util.List;
19  
20  public interface KnowledgeBase extends Ontology {
21  
22    /**Adds an instance to the knowledge base.
23     * @param name the instance name to be added
24     * @param theClass the class to be added
25     * @return the OInstance that has been added to the KB */
26    public OInstance addInstance(String name, OClass theClass);
27  
28    /**Adds an instance to the knowledge base.*/
29    public void addInstance(OInstance theInstance);
30  
31    /**Removes the instance from the knowledge base.
32     * @param theInstance to be removed */
33    public void removeInstance(OInstance theInstance);
34  
35    /**Gets all instances in the KB.
36     * @return List of OInstance objects */
37    public List getInstances();
38  
39    /**Gets all instances in the KB, which belong to this class,
40     * including instances of sub-classes. If only the instances
41     * of the given class are needed, then use getDirectInstances.
42     * @param theClass the class of the instances
43     * @return List of OInstance objects */
44    public List getInstances(OClass theClass);
45  
46    /**Gets all instances in the KB, which belong to the
47     * given class only.
48     * @param theClass the class of the instances
49     * @return List of OInstance objects */
50    public List getDirectInstances(OClass theClass);
51  
52    /**Gets the instance with the given name.
53     * @param String the instance name
54     * @return the OInstance object with this name */
55    public OInstance getInstanceByName(String instanceName);
56  
57  
58  
59  }