| 1 | /** |
|---|
| 2 | * Copyright (C) 2007 EDIT |
|---|
| 3 | * European Distributed Institute of Taxonomy |
|---|
| 4 | * http://www.e-taxonomy.eu |
|---|
| 5 | * |
|---|
| 6 | * The contents of this file are subject to the Mozilla Public License Version 1.1 |
|---|
| 7 | * See LICENSE.TXT at the top of this package for the full license terms. |
|---|
| 8 | */ |
|---|
| 9 | |
|---|
| 10 | package eu.etaxonomy.cdm.model.description; |
|---|
| 11 | |
|---|
| 12 | |
|---|
| 13 | import java.util.HashMap; |
|---|
| 14 | import java.util.HashSet; |
|---|
| 15 | import java.util.List; |
|---|
| 16 | import java.util.Map; |
|---|
| 17 | import java.util.Set; |
|---|
| 18 | import java.util.UUID; |
|---|
| 19 | |
|---|
| 20 | import javax.persistence.Entity; |
|---|
| 21 | import javax.persistence.FetchType; |
|---|
| 22 | import javax.persistence.JoinTable; |
|---|
| 23 | import javax.persistence.ManyToMany; |
|---|
| 24 | import javax.persistence.OneToMany; |
|---|
| 25 | import javax.xml.bind.annotation.XmlAccessType; |
|---|
| 26 | import javax.xml.bind.annotation.XmlAccessorType; |
|---|
| 27 | import javax.xml.bind.annotation.XmlElement; |
|---|
| 28 | import javax.xml.bind.annotation.XmlElementWrapper; |
|---|
| 29 | import javax.xml.bind.annotation.XmlIDREF; |
|---|
| 30 | import javax.xml.bind.annotation.XmlRootElement; |
|---|
| 31 | import javax.xml.bind.annotation.XmlSchemaType; |
|---|
| 32 | import javax.xml.bind.annotation.XmlType; |
|---|
| 33 | |
|---|
| 34 | import org.apache.log4j.Logger; |
|---|
| 35 | import org.hibernate.envers.Audited; |
|---|
| 36 | import org.hibernate.search.annotations.Indexed; |
|---|
| 37 | |
|---|
| 38 | import eu.etaxonomy.cdm.model.common.DefinedTermBase; |
|---|
| 39 | import eu.etaxonomy.cdm.model.common.Language; |
|---|
| 40 | import eu.etaxonomy.cdm.model.common.TermVocabulary; |
|---|
| 41 | import eu.etaxonomy.cdm.model.name.BotanicalName; |
|---|
| 42 | import eu.etaxonomy.cdm.model.name.HybridRelationshipType; |
|---|
| 43 | import eu.etaxonomy.cdm.model.occurrence.Specimen; |
|---|
| 44 | |
|---|
| 45 | /** |
|---|
| 46 | * The class for individual properties (also designed as character, type or |
|---|
| 47 | * category) of observed phenomena able to be described or measured. It also |
|---|
| 48 | * covers categories of informations on {@link TaxonNameBase taxon names} not |
|---|
| 49 | * taken in account in {@link NomenclaturalCode nomenclature}.<BR> |
|---|
| 50 | * Descriptions require features in order to be structured and disaggregated |
|---|
| 51 | * in {@link DescriptionElementBase description elements}.<BR> |
|---|
| 52 | * Experts do not use the word feature for the actual description |
|---|
| 53 | * but only for the property itself. Therefore naming this class FeatureType |
|---|
| 54 | * would have leaded to confusion. |
|---|
| 55 | * <P> |
|---|
| 56 | * Since features are {@link DefinedTermBase defined terms} they have a hierarchical |
|---|
| 57 | * structure that allows to specify ("kind of") or generalize |
|---|
| 58 | * ("generalization of") features. "Kind of" / "generalization of" relations |
|---|
| 59 | * are bidirectional (a feature F1 is a "Kind of" a feature F2 if and only |
|---|
| 60 | * if the feature F2 is a "generalization of" the feature F1. This hierarchical |
|---|
| 61 | * structure has nothing in common with {@link FeatureTree feature trees} used for determination. |
|---|
| 62 | * <P> |
|---|
| 63 | * A standard set of feature instances will be automatically |
|---|
| 64 | * created as the project starts. But this class allows to extend this standard |
|---|
| 65 | * set by creating new instances of additional features if needed.<BR> |
|---|
| 66 | * <P> |
|---|
| 67 | * This class corresponds to DescriptionsSectionType according to the SDD |
|---|
| 68 | * schema. |
|---|
| 69 | * |
|---|
| 70 | * @author m.doering |
|---|
| 71 | * @version 1.0 |
|---|
| 72 | * @created 08-Nov-2007 13:06:24 |
|---|
| 73 | */ |
|---|
| 74 | @XmlAccessorType(XmlAccessType.PROPERTY) |
|---|
| 75 | @XmlType(name="Feature", factoryMethod="NewInstance", propOrder = { |
|---|
| 76 | "kindOf", |
|---|
| 77 | "generalizationOf", |
|---|
| 78 | "partOf", |
|---|
| 79 | "includes", |
|---|
| 80 | "supportsTextData", |
|---|
| 81 | "supportsQuantitativeData", |
|---|
| 82 | "supportsDistribution", |
|---|
| 83 | "supportsIndividualAssociation", |
|---|
| 84 | "supportsTaxonInteraction", |
|---|
| 85 | "supportsCommonTaxonName", |
|---|
| 86 | "supportsCategoricalData", |
|---|
| 87 | "recommendedModifierEnumeration", |
|---|
| 88 | "recommendedStatisticalMeasures", |
|---|
| 89 | "supportedCategoricalEnumerations", |
|---|
| 90 | "recommendedMeasurementUnits" |
|---|
| 91 | }) |
|---|
| 92 | @XmlRootElement(name = "Feature") |
|---|
| 93 | @Entity |
|---|
| 94 | @Indexed(index = "eu.etaxonomy.cdm.model.common.DefinedTermBase") |
|---|
| 95 | @Audited |
|---|
| 96 | public class Feature extends DefinedTermBase<Feature> { |
|---|
| 97 | private static final long serialVersionUID = 6754598791831848704L; |
|---|
| 98 | private static final Logger logger = Logger.getLogger(Feature.class); |
|---|
| 99 | |
|---|
| 100 | protected static Map<UUID, Feature> termMap = null; |
|---|
| 101 | |
|---|
| 102 | private boolean supportsTextData; |
|---|
| 103 | |
|---|
| 104 | private boolean supportsQuantitativeData; |
|---|
| 105 | |
|---|
| 106 | private boolean supportsDistribution; |
|---|
| 107 | |
|---|
| 108 | private boolean supportsIndividualAssociation; |
|---|
| 109 | |
|---|
| 110 | private boolean supportsTaxonInteraction; |
|---|
| 111 | |
|---|
| 112 | private boolean supportsCategoricalData; |
|---|
| 113 | |
|---|
| 114 | /* |
|---|
| 115 | * FIXME Should this be Many-To-Many or do we expect each Feature to have its own unique modifier enums? |
|---|
| 116 | */ |
|---|
| 117 | @OneToMany(fetch = FetchType.LAZY) |
|---|
| 118 | @JoinTable(name="DefinedTermBase_RecommendedModifierEnumeration") |
|---|
| 119 | private Set<TermVocabulary<Modifier>> recommendedModifierEnumeration = new HashSet<TermVocabulary<Modifier>>(); |
|---|
| 120 | |
|---|
| 121 | |
|---|
| 122 | @ManyToMany(fetch = FetchType.LAZY) |
|---|
| 123 | @JoinTable(name="DefinedTermBase_StatisticalMeasure") |
|---|
| 124 | private Set<StatisticalMeasure> recommendedStatisticalMeasures = new HashSet<StatisticalMeasure>(); |
|---|
| 125 | |
|---|
| 126 | /* |
|---|
| 127 | * FIXME Should this be Many-To-Many or do we expect each Feature to have its own unique state enums? |
|---|
| 128 | */ |
|---|
| 129 | @OneToMany(fetch = FetchType.LAZY) |
|---|
| 130 | @JoinTable(name="DefinedTermBase_SupportedCategoricalEnumeration") |
|---|
| 131 | private Set<TermVocabulary<State>> supportedCategoricalEnumerations = new HashSet<TermVocabulary<State>>(); |
|---|
| 132 | |
|---|
| 133 | private boolean supportsCommonTaxonName; |
|---|
| 134 | |
|---|
| 135 | @ManyToMany(fetch = FetchType.LAZY) |
|---|
| 136 | @JoinTable(name="DefinedTermBase_MeasurementUnit") |
|---|
| 137 | private Set<MeasurementUnit> recommendedMeasurementUnits = new HashSet<MeasurementUnit>(); |
|---|
| 138 | |
|---|
| 139 | /* ***************** CONSTRUCTOR AND FACTORY METHODS **********************************/ |
|---|
| 140 | |
|---|
| 141 | |
|---|
| 142 | /** |
|---|
| 143 | * Class constructor: creates a new empty feature instance. |
|---|
| 144 | * |
|---|
| 145 | * @see #Feature(String, String, String) |
|---|
| 146 | */ |
|---|
| 147 | public Feature() { |
|---|
| 148 | } |
|---|
| 149 | |
|---|
| 150 | /** |
|---|
| 151 | * Class constructor: creates a new feature instance with a description (in the {@link Language#DEFAULT() default language}), |
|---|
| 152 | * a label and a label abbreviation. |
|---|
| 153 | * |
|---|
| 154 | * @param term the string (in the default language) describing the |
|---|
| 155 | * new feature to be created |
|---|
| 156 | * @param label the string identifying the new feature to be created |
|---|
| 157 | * @param labelAbbrev the string identifying (in abbreviated form) the |
|---|
| 158 | * new feature to be created |
|---|
| 159 | * @see #Feature() |
|---|
| 160 | */ |
|---|
| 161 | protected Feature(String term, String label, String labelAbbrev) { |
|---|
| 162 | super(term, label, labelAbbrev); |
|---|
| 163 | } |
|---|
| 164 | |
|---|
| 165 | /** |
|---|
| 166 | * Creates a new empty feature instance. |
|---|
| 167 | * |
|---|
| 168 | * @see #NewInstance(String, String, String) |
|---|
| 169 | */ |
|---|
| 170 | public static Feature NewInstance() { |
|---|
| 171 | return new Feature(); |
|---|
| 172 | } |
|---|
| 173 | |
|---|
| 174 | /** |
|---|
| 175 | * Creates a new feature instance with a description (in the {@link Language#DEFAULT() default language}), |
|---|
| 176 | * a label and a label abbreviation. |
|---|
| 177 | * |
|---|
| 178 | * @param term the string (in the default language) describing the |
|---|
| 179 | * new feature to be created |
|---|
| 180 | * @param label the string identifying the new feature to be created |
|---|
| 181 | * @param labelAbbrev the string identifying (in abbreviated form) the |
|---|
| 182 | * new feature to be created |
|---|
| 183 | * @see #readCsvLine(List, Language) |
|---|
| 184 | * @see #NewInstance() |
|---|
| 185 | */ |
|---|
| 186 | public static Feature NewInstance(String term, String label, String labelAbbrev){ |
|---|
| 187 | return new Feature(term, label, labelAbbrev); |
|---|
| 188 | } |
|---|
| 189 | |
|---|
| 190 | /* *************************************************************************************/ |
|---|
| 191 | |
|---|
| 192 | |
|---|
| 193 | /* (non-Javadoc) |
|---|
| 194 | * @see eu.etaxonomy.cdm.model.common.DefinedTermBase#resetTerms() |
|---|
| 195 | */ |
|---|
| 196 | @Override |
|---|
| 197 | public void resetTerms(){ |
|---|
| 198 | termMap = null; |
|---|
| 199 | } |
|---|
| 200 | |
|---|
| 201 | |
|---|
| 202 | /** |
|---|
| 203 | * Returns the boolean value of the flag indicating whether <i>this</i> |
|---|
| 204 | * feature can be described with {@link QuantitativeData quantitative data} (true) |
|---|
| 205 | * or not (false). If this flag is set <i>this</i> feature can only apply to |
|---|
| 206 | * {@link TaxonDescription taxon descriptions} or {@link SpecimenDescription specimen descriptions}. |
|---|
| 207 | * |
|---|
| 208 | * @return the boolean value of the supportsQuantitativeData flag |
|---|
| 209 | */ |
|---|
| 210 | @XmlElement(name = "SupportsQuantitativeData") |
|---|
| 211 | public boolean isSupportsQuantitativeData() { |
|---|
| 212 | return supportsQuantitativeData; |
|---|
| 213 | } |
|---|
| 214 | |
|---|
| 215 | /** |
|---|
| 216 | * @see #isSupportsQuantitativeData() |
|---|
| 217 | */ |
|---|
| 218 | public void setSupportsQuantitativeData(boolean supportsQuantitativeData) { |
|---|
| 219 | this.supportsQuantitativeData = supportsQuantitativeData; |
|---|
| 220 | } |
|---|
| 221 | |
|---|
| 222 | /** |
|---|
| 223 | * Returns the boolean value of the flag indicating whether <i>this</i> |
|---|
| 224 | * feature can be described with {@link TextData text data} (true) |
|---|
| 225 | * or not (false). |
|---|
| 226 | * |
|---|
| 227 | * @return the boolean value of the supportsTextData flag |
|---|
| 228 | */ |
|---|
| 229 | @XmlElement(name = "SupportsTextData") |
|---|
| 230 | public boolean isSupportsTextData() { |
|---|
| 231 | return supportsTextData; |
|---|
| 232 | } |
|---|
| 233 | |
|---|
| 234 | /** |
|---|
| 235 | * @see #isSupportsTextData() |
|---|
| 236 | */ |
|---|
| 237 | public void setSupportsTextData(boolean supportsTextData) { |
|---|
| 238 | this.supportsTextData = supportsTextData; |
|---|
| 239 | } |
|---|
| 240 | |
|---|
| 241 | /** |
|---|
| 242 | * Returns the boolean value of the flag indicating whether <i>this</i> |
|---|
| 243 | * feature can be described with {@link Distribution distribution} objects |
|---|
| 244 | * (true) or not (false). This flag is set if and only if <i>this</i> feature |
|---|
| 245 | * is the {@link #DISTRIBUTION() distribution feature}. |
|---|
| 246 | * |
|---|
| 247 | * @return the boolean value of the supportsDistribution flag |
|---|
| 248 | */ |
|---|
| 249 | @XmlElement(name = "SupportsDistribution") |
|---|
| 250 | public boolean isSupportsDistribution() { |
|---|
| 251 | return supportsDistribution; |
|---|
| 252 | } |
|---|
| 253 | |
|---|
| 254 | /** |
|---|
| 255 | * @see #isSupportsDistribution() |
|---|
| 256 | */ |
|---|
| 257 | public void setSupportsDistribution(boolean supportsDistribution) { |
|---|
| 258 | this.supportsDistribution = supportsDistribution; |
|---|
| 259 | } |
|---|
| 260 | |
|---|
| 261 | /** |
|---|
| 262 | * Returns the boolean value of the flag indicating whether <i>this</i> |
|---|
| 263 | * feature can be described with {@link IndividualsAssociation individuals associations} |
|---|
| 264 | * (true) or not (false). |
|---|
| 265 | * |
|---|
| 266 | * @return the boolean value of the supportsIndividualAssociation flag |
|---|
| 267 | */ |
|---|
| 268 | @XmlElement(name = "SupportsIndividualAssociation") |
|---|
| 269 | public boolean isSupportsIndividualAssociation() { |
|---|
| 270 | return supportsIndividualAssociation; |
|---|
| 271 | } |
|---|
| 272 | |
|---|
| 273 | /** |
|---|
| 274 | * @see #isSupportsIndividualAssociation() |
|---|
| 275 | */ |
|---|
| 276 | public void setSupportsIndividualAssociation( |
|---|
| 277 | boolean supportsIndividualAssociation) { |
|---|
| 278 | this.supportsIndividualAssociation = supportsIndividualAssociation; |
|---|
| 279 | } |
|---|
| 280 | |
|---|
| 281 | /** |
|---|
| 282 | * Returns the boolean value of the flag indicating whether <i>this</i> |
|---|
| 283 | * feature can be described with {@link TaxonInteraction taxon interactions} |
|---|
| 284 | * (true) or not (false). |
|---|
| 285 | * |
|---|
| 286 | * @return the boolean value of the supportsTaxonInteraction flag |
|---|
| 287 | */ |
|---|
| 288 | @XmlElement(name = "SupportsTaxonInteraction") |
|---|
| 289 | public boolean isSupportsTaxonInteraction() { |
|---|
| 290 | return supportsTaxonInteraction; |
|---|
| 291 | } |
|---|
| 292 | |
|---|
| 293 | /** |
|---|
| 294 | * @see #isSupportsTaxonInteraction() |
|---|
| 295 | */ |
|---|
| 296 | public void setSupportsTaxonInteraction(boolean supportsTaxonInteraction) { |
|---|
| 297 | this.supportsTaxonInteraction = supportsTaxonInteraction; |
|---|
| 298 | } |
|---|
| 299 | |
|---|
| 300 | /** |
|---|
| 301 | * Returns the boolean value of the flag indicating whether <i>this</i> |
|---|
| 302 | * feature can be described with {@link CommonTaxonName common names} |
|---|
| 303 | * (true) or not (false). This flag is set if and only if <i>this</i> feature |
|---|
| 304 | * is the {@link #COMMON_NAME() common name feature}. |
|---|
| 305 | * |
|---|
| 306 | * @return the boolean value of the supportsCommonTaxonName flag |
|---|
| 307 | */ |
|---|
| 308 | @XmlElement(name = "SupportsCommonTaxonName") |
|---|
| 309 | public boolean isSupportsCommonTaxonName() { |
|---|
| 310 | return supportsCommonTaxonName; |
|---|
| 311 | } |
|---|
| 312 | |
|---|
| 313 | /** |
|---|
| 314 | * @see #isSupportsTaxonInteraction() |
|---|
| 315 | */ |
|---|
| 316 | public void setSupportsCommonTaxonName(boolean supportsCommonTaxonName) { |
|---|
| 317 | this.supportsCommonTaxonName = supportsCommonTaxonName; |
|---|
| 318 | } |
|---|
| 319 | |
|---|
| 320 | /** |
|---|
| 321 | * Returns the boolean value of the flag indicating whether <i>this</i> |
|---|
| 322 | * feature can be described with {@link CategoricalData categorical data} |
|---|
| 323 | * (true) or not (false). |
|---|
| 324 | * |
|---|
| 325 | * @return the boolean value of the supportsCategoricalData flag |
|---|
| 326 | */ |
|---|
| 327 | @XmlElement(name = "SupportsCategoricalData") |
|---|
| 328 | public boolean isSupportsCategoricalData() { |
|---|
| 329 | return supportsCategoricalData; |
|---|
| 330 | } |
|---|
| 331 | |
|---|
| 332 | /** |
|---|
| 333 | * @see #supportsCategoricalData() |
|---|
| 334 | */ |
|---|
| 335 | public void setSupportsCategoricalData(boolean supportsCategoricalData) { |
|---|
| 336 | this.supportsCategoricalData = supportsCategoricalData; |
|---|
| 337 | } |
|---|
| 338 | |
|---|
| 339 | |
|---|
| 340 | /** |
|---|
| 341 | * Returns the set of {@link TermVocabulary term vocabularies} containing the |
|---|
| 342 | * {@link Modifier modifiers} recommended to be used for {@link DescriptionElementBase description elements} |
|---|
| 343 | * with <i>this</i> feature. |
|---|
| 344 | * |
|---|
| 345 | */ |
|---|
| 346 | @XmlElementWrapper(name = "RecommendedModifierEnumerations") |
|---|
| 347 | @XmlElement(name = "RecommendedModifierEnumeration") |
|---|
| 348 | @XmlIDREF |
|---|
| 349 | @XmlSchemaType(name = "IDREF") |
|---|
| 350 | public Set<TermVocabulary<Modifier>> getRecommendedModifierEnumeration() { |
|---|
| 351 | return recommendedModifierEnumeration; |
|---|
| 352 | } |
|---|
| 353 | |
|---|
| 354 | /** |
|---|
| 355 | * Adds a {@link TermVocabulary term vocabulary} (with {@link Modifier modifiers}) to the set of |
|---|
| 356 | * {@link #getRecommendedModifierEnumeration() recommended modifier vocabularies} assigned |
|---|
| 357 | * to <i>this</i> feature. |
|---|
| 358 | * |
|---|
| 359 | * @param recommendedModifierEnumeration the term vocabulary to be added |
|---|
| 360 | * @see #getRecommendedModifierEnumeration() |
|---|
| 361 | */ |
|---|
| 362 | public void addRecommendedModifierEnumeration( |
|---|
| 363 | TermVocabulary<Modifier> recommendedModifierEnumeration) { |
|---|
| 364 | this.recommendedModifierEnumeration.add(recommendedModifierEnumeration); |
|---|
| 365 | } |
|---|
| 366 | /** |
|---|
| 367 | * Removes one element from the set of {@link #getRecommendedModifierEnumeration() recommended modifier vocabularies} |
|---|
| 368 | * assigned to <i>this</i> feature. |
|---|
| 369 | * |
|---|
| 370 | * @param recommendedModifierEnumeration the term vocabulary which should be removed |
|---|
| 371 | * @see #getRecommendedModifierEnumeration() |
|---|
| 372 | * @see #addRecommendedModifierEnumeration(TermVocabulary) |
|---|
| 373 | */ |
|---|
| 374 | public void removeRecommendedModifierEnumeration( |
|---|
| 375 | TermVocabulary<Modifier> recommendedModifierEnumeration) { |
|---|
| 376 | this.recommendedModifierEnumeration.remove(recommendedModifierEnumeration); |
|---|
| 377 | } |
|---|
| 378 | |
|---|
| 379 | /** |
|---|
| 380 | * Returns the set of {@link StatisticalMeasure statistical measures} recommended to be used |
|---|
| 381 | * in case of {@link QuantitativeData quantitative data} with <i>this</i> feature. |
|---|
| 382 | */ |
|---|
| 383 | @XmlElementWrapper(name = "RecommendedStatisticalMeasures") |
|---|
| 384 | @XmlElement(name = "RecommendedStatisticalMeasure") |
|---|
| 385 | @XmlIDREF |
|---|
| 386 | @XmlSchemaType(name = "IDREF") |
|---|
| 387 | public Set<StatisticalMeasure> getRecommendedStatisticalMeasures() { |
|---|
| 388 | return recommendedStatisticalMeasures; |
|---|
| 389 | } |
|---|
| 390 | |
|---|
| 391 | /** |
|---|
| 392 | * Adds a {@link StatisticalMeasure statistical measure} to the set of |
|---|
| 393 | * {@link #getRecommendedStatisticalMeasures() recommended statistical measures} assigned |
|---|
| 394 | * to <i>this</i> feature. |
|---|
| 395 | * |
|---|
| 396 | * @param recommendedStatisticalMeasure the statistical measure to be added |
|---|
| 397 | * @see #getRecommendedStatisticalMeasures() |
|---|
| 398 | */ |
|---|
| 399 | public void addRecommendedStatisticalMeasure( |
|---|
| 400 | StatisticalMeasure recommendedStatisticalMeasure) { |
|---|
| 401 | this.recommendedStatisticalMeasures.add(recommendedStatisticalMeasure); |
|---|
| 402 | } |
|---|
| 403 | /** |
|---|
| 404 | * Removes one element from the set of {@link #getRecommendedStatisticalMeasures() recommended statistical measures} |
|---|
| 405 | * assigned to <i>this</i> feature. |
|---|
| 406 | * |
|---|
| 407 | * @param recommendedStatisticalMeasure the statistical measure which should be removed |
|---|
| 408 | * @see #getRecommendedStatisticalMeasures() |
|---|
| 409 | * @see #addRecommendedStatisticalMeasure(StatisticalMeasure) |
|---|
| 410 | */ |
|---|
| 411 | public void removeRecommendedStatisticalMeasure( |
|---|
| 412 | StatisticalMeasure recommendedStatisticalMeasure) { |
|---|
| 413 | this.recommendedStatisticalMeasures.remove(recommendedStatisticalMeasure); |
|---|
| 414 | } |
|---|
| 415 | |
|---|
| 416 | /** |
|---|
| 417 | * Returns the set of {@link StatisticalMeasure statistical measures} recommended to be used |
|---|
| 418 | * in case of {@link QuantitativeData quantitative data} with <i>this</i> feature. |
|---|
| 419 | */ |
|---|
| 420 | @XmlElementWrapper(name = "RecommendedMeasurementUnits") |
|---|
| 421 | @XmlElement(name = "RecommendedMeasurementUnit") |
|---|
| 422 | @XmlIDREF |
|---|
| 423 | @XmlSchemaType(name = "IDREF") |
|---|
| 424 | public Set<MeasurementUnit> getRecommendedMeasurementUnits() { |
|---|
| 425 | return recommendedMeasurementUnits; |
|---|
| 426 | } |
|---|
| 427 | |
|---|
| 428 | /** |
|---|
| 429 | * Adds a {@link StatisticalMeasure statistical measure} to the set of |
|---|
| 430 | * {@link #getRecommendedStatisticalMeasures() recommended statistical measures} assigned |
|---|
| 431 | * to <i>this</i> feature. |
|---|
| 432 | * |
|---|
| 433 | * @param recommendedStatisticalMeasure the statistical measure to be added |
|---|
| 434 | * @see #getRecommendedStatisticalMeasures() |
|---|
| 435 | */ |
|---|
| 436 | public void addRecommendedMeasurementUnit( |
|---|
| 437 | MeasurementUnit recommendedMeasurementUnit) { |
|---|
| 438 | this.recommendedMeasurementUnits.add(recommendedMeasurementUnit); |
|---|
| 439 | } |
|---|
| 440 | /** |
|---|
| 441 | * Removes one element from the set of {@link #getRecommendedStatisticalMeasures() recommended statistical measures} |
|---|
| 442 | * assigned to <i>this</i> feature. |
|---|
| 443 | * |
|---|
| 444 | * @param recommendedStatisticalMeasure the statistical measure which should be removed |
|---|
| 445 | * @see #getRecommendedStatisticalMeasures() |
|---|
| 446 | * @see #addRecommendedStatisticalMeasure(StatisticalMeasure) |
|---|
| 447 | */ |
|---|
| 448 | public void removeRecommendedMeasurementUnit( |
|---|
| 449 | MeasurementUnit recommendedMeasurementUnit) { |
|---|
| 450 | this.recommendedMeasurementUnits.remove(recommendedMeasurementUnit); |
|---|
| 451 | } |
|---|
| 452 | |
|---|
| 453 | /** |
|---|
| 454 | * Returns the set of {@link TermVocabulary term vocabularies} containing the list of |
|---|
| 455 | * possible {@link State states} to be used in {@link CategoricalData categorical data} |
|---|
| 456 | * with <i>this</i> feature. |
|---|
| 457 | * |
|---|
| 458 | */ |
|---|
| 459 | @XmlElementWrapper(name = "SupportedCategoricalEnumerations") |
|---|
| 460 | @XmlElement(name = "SupportedCategoricalEnumeration") |
|---|
| 461 | @XmlIDREF |
|---|
| 462 | @XmlSchemaType(name = "IDREF") |
|---|
| 463 | public Set<TermVocabulary<State>> getSupportedCategoricalEnumerations() { |
|---|
| 464 | return supportedCategoricalEnumerations; |
|---|
| 465 | } |
|---|
| 466 | |
|---|
| 467 | /** |
|---|
| 468 | * Adds a {@link TermVocabulary term vocabulary} to the set of |
|---|
| 469 | * {@link #getSupportedCategoricalEnumerations() supported state vocabularies} assigned |
|---|
| 470 | * to <i>this</i> feature. |
|---|
| 471 | * |
|---|
| 472 | * @param supportedCategoricalEnumeration the term vocabulary which should be removed |
|---|
| 473 | * @see #getSupportedCategoricalEnumerations() |
|---|
| 474 | */ |
|---|
| 475 | public void addSupportedCategoricalEnumeration( |
|---|
| 476 | TermVocabulary<State> supportedCategoricalEnumeration) { |
|---|
| 477 | this.supportedCategoricalEnumerations.add(supportedCategoricalEnumeration); |
|---|
| 478 | } |
|---|
| 479 | /** |
|---|
| 480 | * Removes one element from the set of {@link #getSupportedCategoricalEnumerations() supported state vocabularies} |
|---|
| 481 | * assigned to <i>this</i> feature. |
|---|
| 482 | * |
|---|
| 483 | * @param supportedCategoricalEnumeration the term vocabulary which should be removed |
|---|
| 484 | * @see #getSupportedCategoricalEnumerations() |
|---|
| 485 | * @see #addSupportedCategoricalEnumeration(TermVocabulary) |
|---|
| 486 | */ |
|---|
| 487 | public void removeSupportedCategoricalEnumeration( |
|---|
| 488 | TermVocabulary<State> supportedCategoricalEnumeration) { |
|---|
| 489 | this.supportedCategoricalEnumerations.remove(supportedCategoricalEnumeration); |
|---|
| 490 | } |
|---|
| 491 | |
|---|
| 492 | @XmlElement(name = "KindOf", namespace = "http://etaxonomy.eu/cdm/model/common/1.0") |
|---|
| 493 | @XmlIDREF |
|---|
| 494 | @XmlSchemaType(name = "IDREF") |
|---|
| 495 | @Override |
|---|
| 496 | public Feature getKindOf(){ |
|---|
| 497 | return super.getKindOf(); |
|---|
| 498 | } |
|---|
| 499 | |
|---|
| 500 | public void setKindOf(Feature kindOf){ |
|---|
| 501 | super.setKindOf(kindOf); |
|---|
| 502 | } |
|---|
| 503 | |
|---|
| 504 | @XmlElement(name = "PartOf", namespace = "http://etaxonomy.eu/cdm/model/common/1.0") |
|---|
| 505 | @XmlIDREF |
|---|
| 506 | @XmlSchemaType(name = "IDREF") |
|---|
| 507 | public Feature getPartOf(){ |
|---|
| 508 | return super.getPartOf(); |
|---|
| 509 | } |
|---|
| 510 | |
|---|
| 511 | public void setPartOf(Feature partOf){ |
|---|
| 512 | super.setPartOf(partOf); |
|---|
| 513 | } |
|---|
| 514 | |
|---|
| 515 | @XmlElementWrapper(name = "Generalizations", namespace = "http://etaxonomy.eu/cdm/model/common/1.0") |
|---|
| 516 | @XmlElement(name = "GeneralizationOf", namespace = "http://etaxonomy.eu/cdm/model/common/1.0") |
|---|
| 517 | @XmlIDREF |
|---|
| 518 | @XmlSchemaType(name = "IDREF") |
|---|
| 519 | public Set<Feature> getGeneralizationOf(){ |
|---|
| 520 | return super.getGeneralizationOf(); |
|---|
| 521 | } |
|---|
| 522 | |
|---|
| 523 | protected void setGeneralizationOf(Set<Feature> value){ |
|---|
| 524 | super.setGeneralizationOf(value); |
|---|
| 525 | } |
|---|
| 526 | |
|---|
| 527 | @XmlElementWrapper(name = "Includes", namespace = "http://etaxonomy.eu/cdm/model/common/1.0") |
|---|
| 528 | @XmlElement(name = "Include", namespace = "http://etaxonomy.eu/cdm/model/common/1.0") |
|---|
| 529 | @XmlIDREF |
|---|
| 530 | @XmlSchemaType(name = "IDREF") |
|---|
| 531 | public Set<Feature> getIncludes(){ |
|---|
| 532 | return super.getIncludes(); |
|---|
| 533 | } |
|---|
| 534 | |
|---|
| 535 | protected void setIncludes(Set<Feature> includes) { |
|---|
| 536 | super.setIncludes(includes); |
|---|
| 537 | } |
|---|
| 538 | |
|---|
| 539 | private static final UUID uuidUnknown = UUID.fromString("910307f1-dc3c-452c-a6dd-af5ac7cd365c"); |
|---|
| 540 | private static final UUID uuidDescription = UUID.fromString("9087cdcd-8b08-4082-a1de-34c9ba9fb493"); |
|---|
| 541 | private static final UUID uuidDistribution = UUID.fromString("9fc9d10c-ba50-49ee-b174-ce83fc3f80c6"); |
|---|
| 542 | private static final UUID uuidEcology = UUID.fromString("aa923827-d333-4cf5-9a5f-438ae0a4746b"); |
|---|
| 543 | private static final UUID uuidHabitat = UUID.fromString("fb16929f-bc9c-456f-9d40-dec987b36438"); |
|---|
| 544 | private static final UUID uuidHabitatAndEcology = UUID.fromString("9fdc4663-4d56-47d0-90b5-c0bf251bafbb"); |
|---|
| 545 | private static final UUID uuidChromosomeNumber = UUID.fromString("6f677e98-d8d5-4bc5-80bf-affdb7e3945a"); |
|---|
| 546 | |
|---|
| 547 | private static final UUID uuidBiologyEcology = UUID.fromString("9832e24f-b670-43b4-ac7c-20a7261a1d8c"); |
|---|
| 548 | private static final UUID uuidKey = UUID.fromString("a677f827-22b9-4205-bb37-11cb48dd9106"); |
|---|
| 549 | private static final UUID uuidMaterialsExamined = UUID.fromString("7c0c7571-a864-47c1-891d-01f59000dae1"); |
|---|
| 550 | private static final UUID uuidMaterialsMethods = UUID.fromString("1e87d9c3-0844-4a03-9686-773e2ccb3ab6"); |
|---|
| 551 | private static final UUID uuidEtymology = UUID.fromString("dd653d48-355c-4aec-a4e7-724f6eb29f8d"); |
|---|
| 552 | private static final UUID uuidDiagnosis = UUID.fromString("d43d8501-ceab-4caa-9e51-e87138528fac"); |
|---|
| 553 | private static final UUID uuidProtologue = UUID.fromString("71b356c5-1e3f-4f5d-9b0f-c2cf8ae7779f"); |
|---|
| 554 | private static final UUID uuidCommonName = UUID.fromString("fc810911-51f0-4a46-ab97-6562fe263ae5"); |
|---|
| 555 | private static final UUID uuidPhenology = UUID.fromString("a7786d3e-7c58-4141-8416-346d4c80c4a2"); |
|---|
| 556 | private static final UUID uuidOccurrence = UUID.fromString("5deff505-1a32-4817-9a74-50e6936fd630"); |
|---|
| 557 | private static final UUID uuidCitation = UUID.fromString("99b2842f-9aa7-42fa-bd5f-7285311e0101"); |
|---|
| 558 | private static final UUID uuidAdditionalPublication = UUID.fromString("2c355c16-cb04-4858-92bf-8da8d56dea95"); |
|---|
| 559 | private static final UUID uuidUses = UUID.fromString("e5374d39-b210-47c7-bec1-bee05b5f1cb6"); |
|---|
| 560 | private static final UUID uuidConservation = UUID.fromString("4518fc20-2492-47de-b345-777d2b83c9cf"); |
|---|
| 561 | private static final UUID uuidCultivation = UUID.fromString("e28965b2-a367-48c5-b954-8afc8ac2c69b"); |
|---|
| 562 | private static final UUID uuidIntroduction = UUID.fromString("e75255ca-8ff4-4905-baad-f842927fe1d3"); |
|---|
| 563 | private static final UUID uuidDiscussion = UUID.fromString("d3c4cbb6-0025-4322-886b-cd0156753a25"); |
|---|
| 564 | private static final UUID uuidImage = UUID.fromString("84193b2c-327f-4cce-90ef-c8da18fd5bb5"); |
|---|
| 565 | private static final UUID uuidAnatomy = UUID.fromString("94213b2c-e67a-4d37-25ef-e8d316edfba1"); |
|---|
| 566 | private static final UUID uuidHostPlant = UUID.fromString("6e9de1d5-05f0-40d5-8786-2fe30d0d894d"); |
|---|
| 567 | private static final UUID uuidPathogenAgent = UUID.fromString("002d05f2-fd72-49f1-ba4d-196cf09240b5"); |
|---|
| 568 | private static final UUID uuidIndividualsAssociation = UUID.fromString("e2308f37-ddc5-447d-b483-5e2171dd85fd"); |
|---|
| 569 | private static final UUID uuidSpecimen = UUID.fromString("8200e050-d5fd-4cac-8a76-4b47afb13809"); |
|---|
| 570 | private static final UUID uuidObservation = UUID.fromString("f59e747d-0b4f-4bf7-b69a-cbd50bc78595"); |
|---|
| 571 | private static final UUID uuidStatus = UUID.fromString("86d40635-2a63-4ad6-be75-9faa4a6a57fb"); |
|---|
| 572 | private static final UUID uuidSystematics = UUID.fromString("bd9aca17-cd0e-4418-a3a1-1a4b80dbc162"); |
|---|
| 573 | private static final UUID uuidUseRecord = UUID.fromString("8125a59d-b4d5-4485-89ea-67306297b599"); |
|---|
| 574 | |
|---|
| 575 | /** |
|---|
| 576 | * Creates and returns a new feature instance on the basis of a given string |
|---|
| 577 | * list (containing an UUID, an URI, a label and a description) and a given |
|---|
| 578 | * {@link Language language} to be associated with the description. Furthermore |
|---|
| 579 | * the flags concerning the supported subclasses of {@link DescriptionElementBase description elements} |
|---|
| 580 | * are set according to a particular string belonging to the given |
|---|
| 581 | * string list.<BR> |
|---|
| 582 | * This method overrides the readCsvLine method from {@link DefinedTermBase#readCsvLine(List, Language) DefinedTermBase}. |
|---|
| 583 | * |
|---|
| 584 | * @param csvLine the string list with elementary information for attributes |
|---|
| 585 | * @param lang the language in which the description has been formulated |
|---|
| 586 | * @see #NewInstance(String, String, String) |
|---|
| 587 | */ |
|---|
| 588 | @Override |
|---|
| 589 | public Feature readCsvLine(Class<Feature> termClass, List<String> csvLine, Map<UUID,DefinedTermBase> terms) { |
|---|
| 590 | Feature newInstance = super.readCsvLine(termClass, csvLine, terms); |
|---|
| 591 | String text = (String)csvLine.get(4); |
|---|
| 592 | if (text != null && text.length() >= 6){ |
|---|
| 593 | if ("1".equals(text.substring(0, 1))){newInstance.setSupportsTextData(true);}; |
|---|
| 594 | if ("1".equals(text.substring(1, 2))){newInstance.setSupportsQuantitativeData(true);}; |
|---|
| 595 | if ("1".equals(text.substring(2, 3))){newInstance.setSupportsDistribution(true);}; |
|---|
| 596 | if ("1".equals(text.substring(3, 4))){newInstance.setSupportsIndividualAssociation(true);}; |
|---|
| 597 | if ("1".equals(text.substring(4, 5))){newInstance.setSupportsTaxonInteraction(true);}; |
|---|
| 598 | if ("1".equals(text.substring(5, 6))){newInstance.setSupportsCommonTaxonName(true);}; |
|---|
| 599 | // if ("1".equals(text.substring(6, 7))){newInstance.setSupportsCategoricalData(true);}; |
|---|
| 600 | //there is no abbreviated label for features yet, if there is one in future we need to increment the index for supportXXX form 4 to 5 |
|---|
| 601 | newInstance.getRepresentation(Language.DEFAULT()).setAbbreviatedLabel(null); |
|---|
| 602 | } |
|---|
| 603 | return newInstance; |
|---|
| 604 | } |
|---|
| 605 | |
|---|
| 606 | //******************************* STATIC METHODS ***************************************** |
|---|
| 607 | |
|---|
| 608 | protected static Feature getTermByUuid(UUID uuid){ |
|---|
| 609 | if (termMap == null){ |
|---|
| 610 | return null; //better return null then initialize the termMap in an unwanted way |
|---|
| 611 | //example for an unwanted initialization: before initializing spring you may use a static method of this class. |
|---|
| 612 | //This would result in an default terminitialization instead of a database based |
|---|
| 613 | // term initialization |
|---|
| 614 | |
|---|
| 615 | // DefaultTermInitializer vocabularyStore = new DefaultTermInitializer(); |
|---|
| 616 | // vocabularyStore.initialize(); |
|---|
| 617 | } |
|---|
| 618 | return (Feature)termMap.get(uuid); |
|---|
| 619 | } |
|---|
| 620 | |
|---|
| 621 | /** |
|---|
| 622 | * Returns the "unknown" feature. This feature allows to store values of |
|---|
| 623 | * {@link DescriptionElementBase description elements} even if it is momentarily |
|---|
| 624 | * not known what they mean. |
|---|
| 625 | */ |
|---|
| 626 | public static final Feature UNKNOWN(){ |
|---|
| 627 | return getTermByUuid(uuidUnknown); |
|---|
| 628 | } |
|---|
| 629 | |
|---|
| 630 | /** |
|---|
| 631 | * Returns the "description" feature. This feature allows to handle global |
|---|
| 632 | * {@link DescriptionElementBase description elements} for a global {@link DescriptionBase description}.<BR> |
|---|
| 633 | * The "description" feature is the highest level feature. |
|---|
| 634 | */ |
|---|
| 635 | public static final Feature DESCRIPTION(){ |
|---|
| 636 | return getTermByUuid(uuidDescription); |
|---|
| 637 | } |
|---|
| 638 | |
|---|
| 639 | /** |
|---|
| 640 | * Returns the "distribution" feature. This feature allows to handle only |
|---|
| 641 | * {@link Distribution distributions}. |
|---|
| 642 | * |
|---|
| 643 | * @see #isSupportsDistribution() |
|---|
| 644 | */ |
|---|
| 645 | public static final Feature DISTRIBUTION(){ |
|---|
| 646 | return getTermByUuid(uuidDistribution); |
|---|
| 647 | } |
|---|
| 648 | |
|---|
| 649 | /** |
|---|
| 650 | * Returns the "discussion" feature. This feature can only be described |
|---|
| 651 | * with {@link TextData text data}. |
|---|
| 652 | * |
|---|
| 653 | * @see #isSupportsTextData() |
|---|
| 654 | */ |
|---|
| 655 | public static final Feature DISCUSSION(){ |
|---|
| 656 | return getTermByUuid(uuidDiscussion); |
|---|
| 657 | } |
|---|
| 658 | |
|---|
| 659 | /** |
|---|
| 660 | * Returns the "ecology" feature. This feature only applies |
|---|
| 661 | * to {@link SpecimenDescription specimen descriptions} or to {@link TaxonDescription taxon descriptions}.<BR> |
|---|
| 662 | * The "ecology" feature generalizes all other possible features concerning |
|---|
| 663 | * ecological matters. |
|---|
| 664 | */ |
|---|
| 665 | public static final Feature ECOLOGY(){ |
|---|
| 666 | return getTermByUuid(uuidEcology); |
|---|
| 667 | } |
|---|
| 668 | |
|---|
| 669 | /** |
|---|
| 670 | * Returns the "habitat" feature. This feature only applies |
|---|
| 671 | * to {@link SpecimenDescription specimen descriptions} or to {@link TaxonDescription taxon descriptions}.<BR> |
|---|
| 672 | * The "habitat" feature generalizes all other possible features concerning |
|---|
| 673 | * habitat matters. |
|---|
| 674 | */ |
|---|
| 675 | public static final Feature HABITAT(){ |
|---|
| 676 | return getTermByUuid(uuidHabitat); |
|---|
| 677 | } |
|---|
| 678 | |
|---|
| 679 | |
|---|
| 680 | /** |
|---|
| 681 | * Returns the "habitat & ecology" feature. This feature only applies |
|---|
| 682 | * to {@link SpecimenDescription specimen descriptions} or to {@link TaxonDescription taxon descriptions}.<BR> |
|---|
| 683 | * The "habitat & ecology" feature generalizes all other possible features concerning |
|---|
| 684 | * habitat and ecology matters. |
|---|
| 685 | */ |
|---|
| 686 | public static final Feature HABITAT_ECOLOGY(){ |
|---|
| 687 | return getTermByUuid(uuidHabitatAndEcology); |
|---|
| 688 | } |
|---|
| 689 | |
|---|
| 690 | /** |
|---|
| 691 | * Returns the "biology_ecology" feature. This feature only applies |
|---|
| 692 | * to {@link SpecimenDescription specimen descriptions} or to {@link TaxonDescription taxon descriptions}.<BR> |
|---|
| 693 | * The "biology_ecology" feature generalizes all possible features concerning |
|---|
| 694 | * biological aspects of ecological matters. |
|---|
| 695 | * |
|---|
| 696 | * @see #ECOLOGY() |
|---|
| 697 | */ |
|---|
| 698 | public static final Feature BIOLOGY_ECOLOGY(){ |
|---|
| 699 | return getTermByUuid(uuidBiologyEcology); |
|---|
| 700 | } |
|---|
| 701 | |
|---|
| 702 | /** |
|---|
| 703 | * Returns the "chromosome number" feature. This feature only applies |
|---|
| 704 | * to {@link SpecimenDescription specimen descriptions} or to {@link TaxonDescription taxon descriptions}.<BR> |
|---|
| 705 | */ |
|---|
| 706 | public static final Feature CHROMOSOME_NUMBER(){ |
|---|
| 707 | return getTermByUuid(uuidChromosomeNumber); |
|---|
| 708 | } |
|---|
| 709 | |
|---|
| 710 | |
|---|
| 711 | /** |
|---|
| 712 | * Returns the "key" feature. This feature is the "upper" feature generalizing |
|---|
| 713 | * all features being used within an identification key. |
|---|
| 714 | */ |
|---|
| 715 | public static final Feature KEY(){ |
|---|
| 716 | return getTermByUuid(uuidKey); |
|---|
| 717 | } |
|---|
| 718 | |
|---|
| 719 | |
|---|
| 720 | /** |
|---|
| 721 | * Returns the "materials_examined" feature. This feature can only be described |
|---|
| 722 | * with {@link TextData text data} or eventually with {@link CategoricalData categorical data} |
|---|
| 723 | * mentioning which material has been examined in order to accomplish |
|---|
| 724 | * the description. This feature applies only to |
|---|
| 725 | * {@link SpecimenDescription specimen descriptions} or to {@link TaxonDescription taxon descriptions}. |
|---|
| 726 | */ |
|---|
| 727 | public static final Feature MATERIALS_EXAMINED(){ |
|---|
| 728 | return getTermByUuid(uuidMaterialsExamined); |
|---|
| 729 | } |
|---|
| 730 | |
|---|
| 731 | /** |
|---|
| 732 | * Returns the "materials_methods" feature. This feature can only be described |
|---|
| 733 | * with {@link TextData text data} or eventually with {@link CategoricalData categorical data} |
|---|
| 734 | * mentioning which methods have been adopted to analyze the material in |
|---|
| 735 | * order to accomplish the description. This feature applies only to |
|---|
| 736 | * {@link SpecimenDescription specimen descriptions} or to {@link TaxonDescription taxon descriptions}. |
|---|
| 737 | */ |
|---|
| 738 | public static final Feature MATERIALS_METHODS(){ |
|---|
| 739 | return getTermByUuid(uuidMaterialsMethods); |
|---|
| 740 | } |
|---|
| 741 | |
|---|
| 742 | /** |
|---|
| 743 | * Returns the "etymology" feature. This feature can only be described |
|---|
| 744 | * with {@link TextData text data} or eventually with {@link CategoricalData categorical data} |
|---|
| 745 | * giving some information about the history of the taxon name. This feature applies only to |
|---|
| 746 | * {@link TaxonNameDescription taxon name descriptions}. |
|---|
| 747 | */ |
|---|
| 748 | public static final Feature ETYMOLOGY(){ |
|---|
| 749 | return getTermByUuid(uuidEtymology); |
|---|
| 750 | } |
|---|
| 751 | |
|---|
| 752 | /** |
|---|
| 753 | * Returns the "diagnosis" feature. This feature can only be described |
|---|
| 754 | * with {@link TextData text data} or eventually with {@link CategoricalData categorical data}. |
|---|
| 755 | * This feature applies only to {@link SpecimenDescription specimen descriptions} or to |
|---|
| 756 | * {@link TaxonDescription taxon descriptions}. |
|---|
| 757 | */ |
|---|
| 758 | public static final Feature DIAGNOSIS(){ |
|---|
| 759 | return getTermByUuid(uuidDiagnosis); |
|---|
| 760 | } |
|---|
| 761 | |
|---|
| 762 | |
|---|
| 763 | /** |
|---|
| 764 | * Returns the "introduction" feature. This feature can only be described |
|---|
| 765 | * with {@link TextData text data}. |
|---|
| 766 | * |
|---|
| 767 | * @see #isSupportsTextData() |
|---|
| 768 | */ |
|---|
| 769 | public static final Feature INTRODUCTION(){ |
|---|
| 770 | return getTermByUuid(uuidIntroduction); |
|---|
| 771 | } |
|---|
| 772 | |
|---|
| 773 | /** |
|---|
| 774 | * Returns the "protologue" feature. This feature can only be described |
|---|
| 775 | * with {@link TextData text data} reproducing the content of the protologue |
|---|
| 776 | * (or some information about it) of the taxon name. This feature applies only to |
|---|
| 777 | * {@link TaxonNameDescription taxon name descriptions}. |
|---|
| 778 | * |
|---|
| 779 | * @see #isSupportsTextData() |
|---|
| 780 | */ |
|---|
| 781 | public static final Feature PROTOLOGUE(){ |
|---|
| 782 | return getTermByUuid(uuidProtologue); |
|---|
| 783 | } |
|---|
| 784 | |
|---|
| 785 | /** |
|---|
| 786 | * Returns the "common_name" feature. This feature allows to handle only |
|---|
| 787 | * {@link CommonTaxonName common names}. |
|---|
| 788 | * |
|---|
| 789 | * @see #isSupportsCommonTaxonName() |
|---|
| 790 | */ |
|---|
| 791 | public static final Feature COMMON_NAME(){ |
|---|
| 792 | return getTermByUuid(uuidCommonName); |
|---|
| 793 | } |
|---|
| 794 | |
|---|
| 795 | /** |
|---|
| 796 | * Returns the "phenology" feature. This feature can only be described |
|---|
| 797 | * with {@link CategoricalData categorical data} or eventually with {@link TextData text data} |
|---|
| 798 | * containing information time about recurring natural phenomena. |
|---|
| 799 | * This feature only applies to {@link TaxonDescription taxon descriptions}.<BR> |
|---|
| 800 | * The "phenology" feature generalizes all other possible features |
|---|
| 801 | * concerning time information about particular natural phenomena |
|---|
| 802 | * (such as "first flight of butterflies"). |
|---|
| 803 | */ |
|---|
| 804 | public static final Feature PHENOLOGY(){ |
|---|
| 805 | return getTermByUuid(uuidPhenology); |
|---|
| 806 | } |
|---|
| 807 | |
|---|
| 808 | /** |
|---|
| 809 | * Returns the "occurrence" feature. |
|---|
| 810 | */ |
|---|
| 811 | public static final Feature OCCURRENCE(){ |
|---|
| 812 | return getTermByUuid(uuidOccurrence); |
|---|
| 813 | } |
|---|
| 814 | |
|---|
| 815 | /** |
|---|
| 816 | * Returns the "anatomy" feature. |
|---|
| 817 | */ |
|---|
| 818 | public static final Feature ANATOMY(){ |
|---|
| 819 | return getTermByUuid(uuidAnatomy); |
|---|
| 820 | } |
|---|
| 821 | /** |
|---|
| 822 | * Returns the "hostplant" feature. |
|---|
| 823 | */ |
|---|
| 824 | public static final Feature HOSTPLANT(){ |
|---|
| 825 | return getTermByUuid(uuidHostPlant); |
|---|
| 826 | } |
|---|
| 827 | /** |
|---|
| 828 | * Returns the "pathogen agent" feature. |
|---|
| 829 | */ |
|---|
| 830 | public static final Feature PATHOGEN_AGENT(){ |
|---|
| 831 | return getTermByUuid(uuidPathogenAgent); |
|---|
| 832 | } |
|---|
| 833 | |
|---|
| 834 | /** |
|---|
| 835 | * Returns the "citation" feature. This feature can only be described |
|---|
| 836 | * with {@link TextData text data}. |
|---|
| 837 | * |
|---|
| 838 | * @see #isSupportsTextData() |
|---|
| 839 | */ |
|---|
| 840 | public static final Feature CITATION(){ |
|---|
| 841 | return getTermByUuid(uuidCitation); |
|---|
| 842 | } |
|---|
| 843 | |
|---|
| 844 | /** |
|---|
| 845 | * Returns the "additional_publication" feature. This feature can only be |
|---|
| 846 | * described with {@link TextData text data} with information about a |
|---|
| 847 | * publication where a {@link TaxonNameBase taxon name} has also been published |
|---|
| 848 | * but which is not the {@link TaxonNameBase#getNomenclaturalReference() nomenclatural reference}. |
|---|
| 849 | * This feature applies only to {@link TaxonNameDescription taxon name descriptions}. |
|---|
| 850 | * |
|---|
| 851 | * @see #isSupportsTextData() |
|---|
| 852 | */ |
|---|
| 853 | public static final Feature ADDITIONAL_PUBLICATION(){ |
|---|
| 854 | return getTermByUuid(uuidAdditionalPublication); |
|---|
| 855 | } |
|---|
| 856 | |
|---|
| 857 | |
|---|
| 858 | /** |
|---|
| 859 | * Returns the "uses" feature. This feature only applies |
|---|
| 860 | * to {@link TaxonDescription taxon descriptions}.<BR> |
|---|
| 861 | * The "uses" feature generalizes all other possible features concerning |
|---|
| 862 | * particular uses (for instance "industrial use of seeds"). |
|---|
| 863 | */ |
|---|
| 864 | public static final Feature USES(){ |
|---|
| 865 | return getTermByUuid(uuidUses); |
|---|
| 866 | } |
|---|
| 867 | |
|---|
| 868 | public static final Feature USERECORD(){ |
|---|
| 869 | return getTermByUuid(uuidUseRecord); |
|---|
| 870 | } |
|---|
| 871 | |
|---|
| 872 | |
|---|
| 873 | /** |
|---|
| 874 | * Returns the "conservation" feature. This feature only applies |
|---|
| 875 | * to {@link SpecimenDescription specimen descriptions} and generalizes |
|---|
| 876 | * methods and conditions for the conservation of {@link Specimen specimens}.<BR> |
|---|
| 877 | */ |
|---|
| 878 | public static final Feature CONSERVATION(){ |
|---|
| 879 | return getTermByUuid(uuidConservation); |
|---|
| 880 | } |
|---|
| 881 | |
|---|
| 882 | |
|---|
| 883 | /** |
|---|
| 884 | * Returns the "cultivation" feature. |
|---|
| 885 | */ |
|---|
| 886 | public static final Feature CULTIVATION(){ |
|---|
| 887 | return getTermByUuid(uuidCultivation); |
|---|
| 888 | } |
|---|
| 889 | |
|---|
| 890 | |
|---|
| 891 | /** |
|---|
| 892 | * Returns the "image" feature. |
|---|
| 893 | */ |
|---|
| 894 | public static final Feature IMAGE(){ |
|---|
| 895 | return getTermByUuid(uuidImage); |
|---|
| 896 | } |
|---|
| 897 | |
|---|
| 898 | /** |
|---|
| 899 | * Returns the "individuals association" feature. |
|---|
| 900 | */ |
|---|
| 901 | public static final Feature INDIVIDUALS_ASSOCIATION(){ |
|---|
| 902 | Feature individuals_association = getTermByUuid(uuidIndividualsAssociation); |
|---|
| 903 | Set<Feature> generalizationOf = new HashSet<Feature>(); |
|---|
| 904 | generalizationOf.add(SPECIMEN()); |
|---|
| 905 | generalizationOf.add(OBSERVATION()); |
|---|
| 906 | individuals_association.setGeneralizationOf(generalizationOf); |
|---|
| 907 | return individuals_association; |
|---|
| 908 | |
|---|
| 909 | } |
|---|
| 910 | |
|---|
| 911 | public static final Feature SPECIMEN(){ |
|---|
| 912 | return getTermByUuid(uuidSpecimen); |
|---|
| 913 | } |
|---|
| 914 | |
|---|
| 915 | public static final Feature OBSERVATION(){ |
|---|
| 916 | return getTermByUuid(uuidObservation); |
|---|
| 917 | } |
|---|
| 918 | |
|---|
| 919 | /** |
|---|
| 920 | * The status of a taxon. Usually the status should be determined within a {@link Distribution distribution}. |
|---|
| 921 | * If this is not possible for some reason (e.g. the area is not well defined) the status feature |
|---|
| 922 | * may be used. |
|---|
| 923 | * @return |
|---|
| 924 | */ |
|---|
| 925 | public static final Feature STATUS(){ |
|---|
| 926 | return getTermByUuid(uuidStatus); |
|---|
| 927 | } |
|---|
| 928 | |
|---|
| 929 | public static final Feature SYSTEMATICS(){ |
|---|
| 930 | return getTermByUuid(uuidSystematics); |
|---|
| 931 | } |
|---|
| 932 | |
|---|
| 933 | /** |
|---|
| 934 | * Returns the "hybrid_parent" feature. This feature can only be used |
|---|
| 935 | * by {@link TaxonInteraction taxon interactions}.<BR> |
|---|
| 936 | * <P> |
|---|
| 937 | * Note: It must be distinguished between hybrid relationships as |
|---|
| 938 | * relevant nomenclatural relationships between {@link BotanicalName plant names} |
|---|
| 939 | * on the one side and the biological relation between two {@link Taxon taxa} |
|---|
| 940 | * as it is here the case on the other one. |
|---|
| 941 | * |
|---|
| 942 | * @see #isSupportsTaxonInteraction() |
|---|
| 943 | * @see HybridRelationshipType |
|---|
| 944 | */ |
|---|
| 945 | public static final Feature HYBRID_PARENT(){ |
|---|
| 946 | //TODO |
|---|
| 947 | logger.warn("HYBRID_PARENT not yet implemented"); |
|---|
| 948 | return null; |
|---|
| 949 | } |
|---|
| 950 | |
|---|
| 951 | @Override |
|---|
| 952 | protected void setDefaultTerms(TermVocabulary<Feature> termVocabulary) { |
|---|
| 953 | if (termMap == null){ //needed because there are multiple feature vocabularies |
|---|
| 954 | termMap = new HashMap<UUID, Feature>(); |
|---|
| 955 | } |
|---|
| 956 | for (Feature term : termVocabulary.getTerms()){ |
|---|
| 957 | termMap.put(term.getUuid(), (Feature)term); |
|---|
| 958 | } |
|---|
| 959 | } |
|---|
| 960 | |
|---|
| 961 | } |
|---|