Ontology.java |
1 /* Ontology.java 2 * 3 * Copyright (c) 1998-2004, 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 * $Id: Ontology.java,v 1.9 2004/07/23 17:45:30 kalina Exp $ 16 */ 17 18 package gate.creole.ontology; 19 20 import java.util.List; 21 import java.util.Set; 22 23 public interface Ontology extends Taxonomy { 24 25 /**Adds an instance to the ontology. 26 * @param name the instance name to be added 27 * @param theClass the class to be added 28 * @return the OInstance that has been added to the ontology */ 29 public OInstance addInstance(String name, OClass theClass); 30 31 /**Adds an instance to the ontology.*/ 32 public void addInstance(OInstance theInstance); 33 34 /**Removes the instance from the ontology. 35 * @param theInstance to be removed */ 36 public void removeInstance(OInstance theInstance); 37 38 /**Gets all instances in the ontology. 39 * @return List of OInstance objects */ 40 public List getInstances(); 41 42 /**Gets all instances in the ontology, which belong to this class, 43 * including instances of sub-classes. If only the instances 44 * of the given class are needed, then use getDirectInstances. 45 * @param theClass the class of the instances 46 * @return List of OInstance objects */ 47 public List getInstances(OClass theClass); 48 49 /**Gets all instances in the ontology, which belong to the 50 * given class only. 51 * @param theClass the class of the instances 52 * @return List of OInstance objects */ 53 public List getDirectInstances(OClass theClass); 54 55 /**Gets the instance with the given name. 56 * @param instanceName the instance name 57 * @return the OInstance object with this name */ 58 public OInstance getInstanceByName(String instanceName); 59 60 /** 61 * Create a DatatypeProperty with the given domain and range 62 * @param domain 63 * @param range 64 */ 65 public DatatypeProperty addDatatypeProperty(String name, OClass domain, String range); 66 67 /** 68 * Create a DatatypeProperty with the given domain and range 69 * @param domain 70 * @param range 71 */ 72 public DatatypeProperty addDatatypeProperty(String name, OClass domain, Number range); 73 74 /** 75 * Create a FunctionalProperty with the given domain and range 76 * @param domain 77 * @param range 78 * @return a {@link KBFunctionalProperty} value. 79 */ 80 public FunctionalProperty addFunctionalProperty(String name, OClass domain, Object range); 81 82 public ObjectProperty addObjectProperty(String name, OClass domain, OClass range); 83 84 public SymmetricProperty addSymmetricProperty(String name, OClass domain, OClass range); 85 86 public TransitiveProperty addTransitiveProperty(OClass domain, OClass range); 87 88 public void addPropertyDefinition(Property theProperty); 89 90 public Set getPropertyDefinitions(); 91 92 public Property getPropertyDefinitionByName(String name); 93 94 }