View Javadoc

1   /*
2    wsmo4j - a WSMO API and Reference Implementation
3   
4    Copyright (c) 2004-2005, OntoText Lab. / SIRMA
5   
6    This library is free software; you can redistribute it and/or modify it under
7    the terms of the GNU Lesser General Public License as published by the Free
8    Software Foundation; either version 2.1 of the License, or (at your option)
9    any later version.
10   This library is distributed in the hope that it will be useful, but WITHOUT
11   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12   FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13   details.
14   You should have received a copy of the GNU Lesser General Public License along
15   with this library; if not, write to the Free Software Foundation, Inc.,
16   59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17   */
18  
19  /**
20   * <p>Title: WSMO4J</p>
21   * <p>Description: WSMO API and a Reference Implementation</p>
22   * <p>Copyright:  Copyright (c) 2004-2005</p>
23   * <p>Company: OntoText Lab. / SIRMA </p>
24   */
25  
26  package org.omwg.ontology;
27  
28  
29  import java.util.*;
30  
31  import org.wsmo.common.*;
32  import org.wsmo.common.exception.*;
33  
34  
35  /**
36   * This interface represents a WSMO concept.
37   *
38   * @see Instance
39   * @author not attributable
40   * @version $Revision: 1946 $ $Date: 2007-04-02 15:13:28 +0300 (Mon, 02 Apr 2007) $
41   */
42  public interface Concept
43      extends OntologyElement, Type {
44  
45      /**
46       * Adds a new concept to the set of super-concepts of this concept
47       * <i>The super concept will also add this concept to the list of its sub-concepts</i>
48       * @param superConcept The new super-concept to be added.
49       * @throws org.wsmo.common.exception.SynchronisationException
50       * @throws org.wsmo.common.exception.InvalidModelException
51       * @see #removeSuperConcept(Concept superConcept)
52       */
53      void addSuperConcept(Concept superConcept)
54          throws SynchronisationException, InvalidModelException;
55  
56      /**
57       * Removes a concept from the set of super-concepts of this concept
58       * <i>The super concept will also remove this concept from the list of its sub-concepts</i>.
59       * @param superConcept The super-concept to be removed
60       * @throws org.wsmo.common.exception.SynchronisationException
61       * @throws org.wsmo.common.exception.InvalidModelException
62       */
63      void removeSuperConcept(Concept superConcept)
64          throws SynchronisationException, InvalidModelException;
65  
66      /**
67       * Lists the super-concepts of this concept.
68       * @return The set of super-concepts defined by this ontology.
69       * @throws org.wsmo.common.exception.SynchronisationException
70       */
71      Set <Concept> listSuperConcepts()
72          throws SynchronisationException;
73  
74      /**
75       * Adds a new concept to the set of sub-concepts of this concept
76       * <i>The sub concept will also add this concept to the list of its super-concepts</i>.
77       * @param subConcept The new sub-concept to be added.
78       * @throws org.wsmo.common.exception.SynchronisationException
79       * @throws org.wsmo.common.exception.InvalidModelException
80       * @see #removeSubConcept(Concept subConcept)
81       */
82      void addSubConcept(Concept subConcept)
83          throws SynchronisationException, InvalidModelException;
84  
85      /**
86       * Removes a concept from the set of sub-concepts of this concept
87       * <i>The sub concept will also remove this concept from the list of its super-concepts</i>.
88       * @param subConcept The sub-concept to be removed
89       * @throws org.wsmo.common.exception.SynchronisationException
90       * @throws org.wsmo.common.exception.InvalidModelException
91       */
92      void removeSubConcept(Concept subConcept)
93          throws SynchronisationException, InvalidModelException;
94  
95      /**
96       * Lists the sub-concepts of this concept
97       * @return The set of sub-concepts defined by this ontology.
98       * @throws org.wsmo.common.exception.SynchronisationException
99       */
100     Set <Concept> listSubConcepts()
101         throws SynchronisationException;
102 
103     /**
104      * Create an Attribute for a Concept
105      * @return a new Attribute for the Concept
106      * @param id The ID of the new Attribute
107      * @throws InvalidModelException 
108      */
109     Attribute createAttribute(Identifier id) throws InvalidModelException;
110 
111     /**
112      * Removes an attribute from this concept's list of attributes.
113      * @param identifier The identifier of the attribute to be removed 
114      * from the concept's list of attributes.
115      */
116     void removeAttribute(Identifier identifier);
117     
118     /**
119      * Removes an attribute from this concept's list of attributes.
120      * @param attr The attribute to be removed from this concept's list of attributes.
121      * @throws org.wsmo.common.exception.SynchronisationException
122      * @throws org.wsmo.common.exception.InvalidModelException
123      */
124     void removeAttribute(Attribute attr)
125         throws SynchronisationException, InvalidModelException;
126 
127     /**
128      * Returns a list of this concept's attributes.
129      * @return The list of this concept's attributes.
130      * @throws org.wsmo.common.exception.SynchronisationException
131      * @see Attribute
132      */
133     Set <Attribute> listAttributes()
134         throws SynchronisationException;
135 
136     /**
137      * Searches for all attributes with the specified ID.
138      * @param id identifier of the attribute
139      * @return the attribute or null if not found
140      * @throws org.wsmo.common.exception.SynchronisationException
141      */
142     Set <Attribute> findAttributes(Identifier id);
143 
144     /**
145      * Adds a new instance to the set of instances of this concept
146      * <i>The instance will also add this concept to the list of its concepts</i>
147      * @param inst The new instance to be added.
148      * @throws org.wsmo.common.exception.SynchronisationException
149      * @throws org.wsmo.common.exception.InvalidModelException
150      * @see #removeInstance(Instance inst)
151      * @see Instance#addConcept(Concept memberOf)
152      */
153     void addInstance(Instance inst)
154         throws SynchronisationException, InvalidModelException;
155 
156     /**
157      * Removes an instance from the set of instances of this concept
158      * <i>The instance will also remove this concept from the list of its concepts</i>
159      * @param inst The instance to be removed
160      * @throws org.wsmo.common.exception.SynchronisationException
161      * @throws org.wsmo.common.exception.InvalidModelException
162      */
163     void removeInstance(Instance inst)
164         throws SynchronisationException, InvalidModelException;
165 
166     /**
167      * Returns a list of this concept's instances
168      * @return The list of this concept's instances
169      * @throws org.wsmo.common.exception.SynchronisationException
170      * @see Instance
171      */
172     Set <Instance> listInstances()
173         throws SynchronisationException;
174 
175 //DO NOT EDIT below this line
176 
177     /**
178      * @supplierCardinality 0..*
179      * @clientCardinality 0..*
180      * @supplierRole has-instance
181      * @clientRole has-concept */
182     /*# Instance lnkInstance; */
183 
184     /**
185      * @supplierCardinality 0..*
186      * @clientCardinality 0..*
187      * @supplierRole super-concept
188      * @clientRole sub-concept
189      */
190     /*# Concept lnkConcept; */
191 
192     /**
193      * @supplierCardinality 0..*
194      * @clientCardinality 1
195      * @supplierRole has-attribute
196      * @clientRole defined-in
197      * @directed
198      * @link aggregationByValue
199      */
200     /*# Attribute lnkConceptAttribute; */
201 }
202 
203 /*
204  * $Log$
205  * Revision 1.26  2007/04/02 12:13:14  morcen
206  * Generics support added to wsmo-api, wsmo4j and wsmo-test
207  *
208  * Revision 1.25  2006/02/16 14:34:57  nathaliest
209  * added removeAttribute(Identifier) method
210  *
211  * Revision 1.24  2006/02/13 22:49:23  nathaliest
212  * - changed concept.createAttribute() and Parameter.addType to throw InvalidModelException.
213  * - small change at check AnonIds in ConceptImpl
214  *
215  * Revision 1.23  2006/02/10 14:29:13  vassil_momtchev
216  * Attribute findAttribute(Identifier) method changed to Set findAttributes(Identifier); now search all superconcept attributes also
217  *
218  * Revision 1.22  2005/09/21 08:15:39  holgerlausen
219  * fixing java doc, removing asString()
220  *
221  * Revision 1.21  2005/09/01 14:55:09  vassil_momtchev
222  * createAttribute(IRI) replaced addAttribute(Attribute)
223  *
224  * Revision 1.20  2005/07/14 09:01:23  vassil_momtchev
225  * addAttribute method is restored to Concept interface (problem with the proxies)
226  *
227  * Revision 1.19  2005/07/05 08:59:35  alex_simov
228  * removeAttribute() restored
229  *
230  * Revision 1.18  2005/07/04 14:20:17  marin_dimitrov
231  * Concept::createAttribute is deprecated now. Use only the respective WsmoFactory method
232  *
233  * Revision 1.17  2005/06/24 12:47:58  marin_dimitrov
234  * added common super interface of Concept and WsmlDataType
235  *
236  * Revision 1.16  2005/06/01 10:11:00  marin_dimitrov
237  * v0.4.0
238  *
239  * Revision 1.7  2005/05/31 13:12:26  damian
240  * createAttribute changed
241  *
242  * Revision 1.6  2005/05/13 15:38:26  marin
243  * fixed javadoc errors
244  *
245  * Revision 1.5  2005/05/13 13:58:37  marin
246  * more @see tags
247  *
248  * Revision 1.4  2005/05/12 14:44:26  marin
249  * javadoc, header, footer, etc
250  *
251  */