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 class represents an instance of a WSMO concept.
37 *
38 * @see Concept
39 * @author not attributable
40 * @version $Revision: 1946 $ $Date: 2007-04-02 15:13:28 +0300 (Mon, 02 Apr 2007) $
41 */
42 public interface Instance
43 extends OntologyElement, Value {
44
45 /**
46 * Sets the concept this instance is an instance of.
47 * <i>The concept will also add this instance to the list of its instances</i>
48 * @param memberOf The concept that this instance is an instance of.
49 * @see #removeConcept(Concept memberOf)
50 * @throws org.wsmo.common.exception.SynchronisationException
51 * @throws org.wsmo.common.exception.InvalidModelException
52 * @see Concept#addInstance(Instance inst)
53 */
54 void addConcept(Concept memberOf)
55 throws SynchronisationException, InvalidModelException;
56
57 /**
58 * Removes a concept from the set of concepts that this entity is an instance of.
59 * @param memberOf the concept (the entity is no longer an instance of it)
60 * @throws org.wsmo.common.exception.SynchronisationException
61 * @throws org.wsmo.common.exception.InvalidModelException
62 */
63 void removeConcept(Concept memberOf)
64 throws SynchronisationException, InvalidModelException;
65
66 /**
67 * Returns a list of the concepts this instance belongs to
68 * @return The list of the concepts of this instances
69 * @throws org.wsmo.common.exception.SynchronisationException
70 * @see Concept
71 */
72 Set <Concept> listConcepts()
73 throws SynchronisationException;
74
75 /**
76 * Adds a new attribute value to the list of values associated with the specified attribute of this instance.
77 * @param id the attribute's indentifier of interest
78 * @param value The value to be added
79 * @throws org.wsmo.common.exception.SynchronisationException
80 * @throws org.wsmo.common.exception.InvalidModelException
81 * @see Concept#createAttribute(IRI)
82 * @see #removeAttributeValue(Identifier, Value)
83 * @see #removeAttributeValues(Identifier)
84 */
85 void addAttributeValue(Identifier id, Value value )
86 throws SynchronisationException, InvalidModelException;
87
88 /**
89 * Removes a particular value associated with an attribute within this instance.
90 * @param id The attribute's indentifier of interest
91 * @param value the attribute value to be removed
92 * @throws org.wsmo.common.exception.SynchronisationException
93 * @throws org.wsmo.common.exception.InvalidModelException
94 * @see #removeAttributeValues(Identifier id)
95 */
96 void removeAttributeValue(Identifier key, Value value )
97 throws SynchronisationException, InvalidModelException;
98
99 /**
100 * Clears all the values associated with a particular attribute of this instance.
101 * @param id The attribute's indentifier of interest
102 * @throws org.wsmo.common.exception.SynchronisationException
103 * @throws org.wsmo.common.exception.InvalidModelException
104 * @see #removeAttributeValue(Identifier id, Object value)
105 */
106 void removeAttributeValues(Identifier id)
107 throws SynchronisationException, InvalidModelException;
108
109 /**
110 * Returns a list of values of a specified attribute.
111 * Note that an attribute may be associated with more than one value
112 * @param key The attribute of interest.
113 * @return A set of values assigned to this attribute.
114 * @throws org.wsmo.common.exception.SynchronisationException
115 * @see #listAttributeValues()
116 */
117 Set <Value> listAttributeValues(Identifier key)
118 throws SynchronisationException;
119
120 /**
121 * Returns all attribute values for this instance.
122 * @return A Map of [Attribute, Set of values] pairs.
123 * @throws org.wsmo.common.exception.SynchronisationException
124 * @see #listAttributeValues(Identifier id)
125 */
126 Map <Identifier, Set <Value>> listAttributeValues()
127 throws SynchronisationException;
128
129 /**
130 * Search this concept and all super concepts for a
131 * specified attribute.
132 * @param id of the attribute
133 * @return Set with all attributes
134 * @throws SynchronisationException
135 */
136 Set <Attribute> findAttributeDefinitions(Identifier id) throws SynchronisationException;
137
138 //DO NOT EDIT below this line
139
140 /**
141 * @supplierCardinality 0..*
142 * @supplierRole specifies-value
143 * @directed
144 */
145 /*# Attribute lnkAttribute; */
146 }
147
148 /*
149 * $Log$
150 * Revision 1.20 2007/04/02 12:13:14 morcen
151 * Generics support added to wsmo-api, wsmo4j and wsmo-test
152 *
153 * Revision 1.19 2006/02/10 14:29:55 vassil_momtchev
154 * instance reference attributes by Identifier; no longer handle to Attribute object used;
155 *
156 * Revision 1.18 2005/09/21 08:15:39 holgerlausen
157 * fixing java doc, removing asString()
158 *
159 * Revision 1.17 2005/06/24 12:51:06 marin_dimitrov
160 * now use Value for param/attr values (was: Object)
161 *
162 * Revision 1.16 2005/06/24 12:47:14 marin_dimitrov
163 * added common super interface of Instance and DataValue
164 *
165 * Revision 1.15 2005/06/01 10:12:38 marin_dimitrov
166 * v0.4.0
167 *
168 * Revision 1.5 2005/05/13 15:38:26 marin
169 * fixed javadoc errors
170 *
171 * Revision 1.4 2005/05/13 13:58:38 marin
172 * more @see tags
173 *
174 * Revision 1.3 2005/05/12 14:44:26 marin
175 * javadoc, header, footer, etc
176 *
177 */