1   /*
2    * OntologyResource.java
3    *
4    * Copyright (c) 2005, The University of Sheffield.
5    *
6    * This file is part of GATE (see http://gate.ac.uk/), and is free
7    * software, licenced under the GNU Library General Public License,
8    * Version 2, June1991.
9    *
10   * A copy of this licence is included in the distribution in the file
11   * licence.html, and is also available at http://gate.ac.uk/gate/licence.html.
12   *
13   * Valentin Tablan 15-Sep-2005
14   *
15   *
16   *  $Id$
17   */
18  package gate.creole.ontology;
19  
20  import java.util.List;
21  import java.util.Set;
22  
23  /**
24   * This is the top level interface for all ontology resources such as classes,
25   * instances and properties.
26   */
27  public interface OntologyResource {
28    /**
29     * Gets the URI of the resource.
30     * 
31     * @return the URI.
32     */
33    public String getURI();
34  
35    /**
36     * Sets the URI of the resource.
37     * 
38     * @param theURI
39     *          the new URI to be set
40     */
41    public void setURI(String theURI);
42  
43    /**
44     * Gets the comment of the resource.
45     * 
46     * @return the comment of the resource
47     */
48    public String getComment();
49  
50    /**
51     * Sets the resource comment.
52     * 
53     * @param aComment
54     *          the comment to be set.
55     */
56    public void setComment(String aComment);
57  
58    /**
59     * Gets resource name.
60     * 
61     * @return the name of the resource.
62     */
63    public String getName();
64  
65    /**
66     * Sets the resource name.
67     * 
68     * @param aName
69     *          the new name of the resource.
70     */
71    public void setName(String aName);
72  
73    /**
74     * Gets the ontology to which the resource belongs.
75     * 
76     * @return the ontology to which the resource belongs
77     */
78    public Ontology getOntology();
79  
80    /**
81     * Gets the taxonomy to which the resource belongs.
82     * 
83     * @return the taxonomy to which the resource belongs
84     */
85    public Taxonomy getTaxonomy();
86  
87    /**
88     * Adds a new property with the given name and value.
89     * 
90     * @param propertyName
91     *          the name of the property
92     * @param theValue
93     *          the value for the property
94     * @return <tt>true</tt> if the property name is valid for this type of
95     *         instance and the new value has been added, <tt>false</tt>
96     *         otherwise.
97     */
98    public boolean addPropertyValue(String propertyName, Object theValue);
99  
100   /**
101    * Gets the list of values for a given property name.
102    * 
103    * @param propertyName
104    *          the name of the property
105    * @return a List of values.
106    */
107   public List getPropertyValues(String propertyName);
108 
109   /**
110    * Removes one of the values for a given property.
111    * 
112    * @param propertyName
113    *          the name of the property
114    * @param theValue
115    *          the value to be removed.
116    * @return <tt>true</tt> if the value was found and removed, <tt>false</tt>
117    *         otherwise.
118    */
119   public boolean removePropertyValue(String propertyName, Object theValue);
120 
121   /**
122    * Removes all values for a named property.
123    * 
124    * @param propertyName
125    *          the property name.
126    */
127   public void removePropertyValues(String propertyName);
128 
129   /**
130    * Gets the names of the properties that have set values for this instance.
131    * 
132    * @return a set of String values.
133    */
134   public Set getSetPropertiesNames();
135 }
136