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 package org.omwg.ontology; 20 21 22 import java.util.*; 23 24 import org.wsmo.common.*; 25 import org.wsmo.common.exception.*; 26 27 28 /** 29 * Defines WSMO attribute. Attribute could be specified as Concept 30 * Attribute (attribute which has no {link WsmlDataType} as range) or 31 * Data Attribute. 32 * 33 * @author not attributable 34 * @see Concept 35 * @author not attributable 36 * @version $Revision: 1946 $Date: 37 */ 38 public interface Attribute 39 extends Entity { 40 41 /** 42 * Returns the type of this attribute. 43 * @return true (constraining) / false (inferring) 44 */ 45 boolean isConstraining(); 46 47 /** 48 * Sets the type of this attribute. 49 * @param constraining true (constraining) / false (inferring) 50 */ 51 void setConstraining(boolean constraining); 52 53 /** 54 * Returns the minimal cardinality constraint of this attribute. 55 * The cardinality option is only available to Concept Attributes. 56 * @return number indicating the minimal cardinality constraint 57 */ 58 int getMinCardinality(); 59 60 /** 61 * Sets the minimal cardinality constraint of this attribute. 62 * The cardinality option is only available to Concept Attributes. 63 * @param min number indicating the minimal cardinality constraint 64 */ 65 void setMinCardinality(int min); 66 67 /** 68 * Returns the maximal cardinality constraint of this attribute. 69 * The cardinality option is only available to Concept Attributes. 70 * @return number indicating the maximal cardinality constraint 71 */ 72 int getMaxCardinality(); 73 74 /** 75 * Sets the maximal cardinality constraint of this attribute. 76 * The cardinality option is only available to Concept Attributes. 77 * For specifiying unrestricted MAX cardinality use: Integer.MAX_VALUE. 78 * @return max number indicating the maximal cardinality constraint 79 */ 80 void setMaxCardinality(int max); 81 82 /** 83 * Returns the {@link Concept} described by this attribute. 84 * @return Concept 85 */ 86 Concept getConcept(); 87 88 /** 89 * Returns the list of allowed {@link Type} for the current attribute. 90 * @return Set of Type objects 91 */ 92 Set <Type> listTypes(); 93 94 /** 95 * Adds a new {@link Type} as range for this attribute. 96 * @param type the Type to be added 97 * @throws InvalidModelException 98 */ 99 void addType(Type type) 100 throws InvalidModelException; 101 102 /** 103 * Removes a {@link Type} for this attribute. 104 * @param type the Type to be removed 105 * @throws InvalidModelException 106 */ 107 void removeType(Type type) 108 throws InvalidModelException; 109 110 /** 111 * Returns if this attribute is defined as reflexive. 112 * This option is available only for the concept attribtues. 113 * @return 114 */ 115 boolean isReflexive(); 116 117 /** 118 * Sets this attribute whether to be reflexive. 119 * This option is available only for the concept attribtues. 120 * @param reflexive is reflexive 121 */ 122 void setReflexive(boolean reflexive); 123 124 /** 125 * Returns if this attribute is defined as symmetric. 126 * When an attribute is specified as being symmetric, 127 * this means that if an individual a has a symmetric attribute 128 * att with value b, then b also has attribute att with value a. 129 * This option is available only for the concept attribtues. 130 * @return 131 */ 132 boolean isSymmetric(); 133 134 /** 135 * Sets this attribute whether to be symmetric. 136 * This option is available only for the concept attribtues. 137 * @param symmetric is reflexive 138 */ 139 void setSymmetric(boolean symmetric); 140 141 /** 142 * Returns if this attribute is defined as transitive. 143 * When an attribute is specified as being transitive, 144 * this means that if three individuals a, b and c are related 145 * via a transitive attribute att in such a way: a att b att c 146 * then c is also a value for the attribute att at a: a att c. 147 * This option is available only for the concept attribtues. 148 * @return 149 */ 150 boolean isTransitive(); 151 152 /** 153 * Sets this attribute whether to be transitive. 154 * This option is available only for the concept attribtues. 155 * @param trans is reflexive 156 */ 157 void setTransitive(boolean trans); 158 159 /** 160 * Returns the inverse attribute of this attribute. 161 * When an attribute is specified as being the inverse of another 162 * attribute, this means that if an individual a has an attribute 163 * att1 with value b and att1 is the inverse of a certain 164 * attribute att2, then it is inferred that b has an attribute 165 * att2 with value a. 166 * This option is available only for the concept attribtues. 167 * @return null or the inverse attribute's identifier 168 */ 169 Identifier getInverseOf(); 170 171 /** 172 * Sets this attribute to be inverse of another attribute. 173 * @param id attribute to be set as inverse of or null to remove 174 * the current inverse attribute 175 */ 176 void setInverseOf(Identifier id); 177 178 /** 179 * @supplierCardinality 0..* 180 * @directed 181 * @supplierRole has-type*/ 182 /*# Type lnkType; */ 183 } 184 185 /* 186 * $Log$ 187 * Revision 1.19 2007/04/02 12:13:14 morcen 188 * Generics support added to wsmo-api, wsmo4j and wsmo-test 189 * 190 * Revision 1.18 2006/02/16 09:47:30 vassil_momtchev 191 * setInverseOf uses Identifier instead of Attribute 192 * 193 * Revision 1.17 2006/02/15 10:51:48 holgerlausen 194 * added javadoc hint to max cardinality 195 * 196 * Revision 1.16 2005/09/26 08:36:20 vassil_momtchev 197 * javadoc, header and footer added 198 * 199 */