From 8eebe79d24c1741628ff38c5d11fd07c949c9797 Mon Sep 17 00:00:00 2001 From: "m.geoffroy" Date: Thu, 29 May 2008 14:01:31 +0000 Subject: [PATCH] --- .../cdm/model/name/NameRelationshipType.java | 5 + .../cdm/model/name/TaxonNameBase.java | 101 +++++++++++++++--- .../strategy/cache/NameCacheStrategyBase.java | 9 +- .../parser/NonViralNameParserImpl.java | 3 +- 4 files changed, 96 insertions(+), 22 deletions(-) diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/NameRelationshipType.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/NameRelationshipType.java index 451d0b37b1..27af846efb 100644 --- a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/NameRelationshipType.java +++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/NameRelationshipType.java @@ -20,6 +20,11 @@ import javax.persistence.*; /** * http://rs.tdwg.org/ontology/voc/TaxonName.rdf#NomenclaturalNoteTypeTerm + * The relationship are to be understood as 'is .... of'. For instance + * Linum radiola L. is a replaced synonym of Radiola linoides Roth + * or Astragalus rhizanthus Boiss. is a later homonym of + * Astragalus rhizanthus Royle. + * * @author m.doering * @version 1.0 * @created 08-Nov-2007 13:06:38 diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/TaxonNameBase.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/TaxonNameBase.java index c972a6eeff..e4e58819b7 100644 --- a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/TaxonNameBase.java +++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/name/TaxonNameBase.java @@ -17,6 +17,8 @@ import eu.etaxonomy.cdm.model.taxon.Synonym; import eu.etaxonomy.cdm.model.taxon.Taxon; import eu.etaxonomy.cdm.model.taxon.TaxonBase; import eu.etaxonomy.cdm.model.taxon.TaxonRelationship; +import eu.etaxonomy.cdm.model.agent.Contact; +import eu.etaxonomy.cdm.model.agent.TeamOrPersonBase; import eu.etaxonomy.cdm.model.common.IParsable; import eu.etaxonomy.cdm.model.common.IRelated; import eu.etaxonomy.cdm.model.common.IdentifiableEntity; @@ -44,7 +46,7 @@ import javax.persistence.*; * The scientific name string without author strings and year can be stored in the {@link #getNameCache() nameCache} attribute. * The scientific taxon name does not depend on the use made of it * in a publication or a treatment ({@link taxon.TaxonBase taxon concept respectively potential taxon}) - * as an "accepted" respectively "correct" name ({@link taxon.Taxon taxon}) + * as an {@link taxon.Taxon "accepted" respectively "correct" (taxon) name} * or as a {@link taxon.Synonym synonym}. * * @author m.doering @@ -55,14 +57,9 @@ import javax.persistence.*; @Inheritance(strategy=InheritanceType.SINGLE_TABLE) public abstract class TaxonNameBase extends IdentifiableEntity implements IReferencedEntity, IParsable, IRelated { static Logger logger = Logger.getLogger(TaxonNameBase.class); - //The scientific name without author strings and year private String nameCache; - //Non-atomised addition to a name not ruled by a nomenclatural code private String appendedPhrase; - //Details of the nomenclatural reference (protologue). These are mostly (implicitly) pages but can also be figures or - //tables or any other element of a publication. {only if a nomenclatural reference exists} private String nomenclaturalMicroReference; - //this flag will be set to true if the parseName method was unable to successfully parse the name private boolean hasProblem = false; protected Set nameTypeDesignations = new HashSet(); private HomotypicalGroup homotypicalGroup = new HomotypicalGroup(); @@ -71,10 +68,8 @@ public abstract class TaxonNameBase extends Identifiabl private Set status = new HashSet(); private Set taxonBases = new HashSet(); private Rank rank; - //if set, the Reference.isNomenclaturallyRelevant flag should be set to true! private INomenclaturalReference nomenclaturalReference; - //this flag shows if the getNameCache should return generated value(false) or the given String(true) protected boolean protectedNameCache; protected INameCacheStrategy cacheStrategy; @@ -161,11 +156,11 @@ public abstract class TaxonNameBase extends Identifiabl } /** - * Returns or generates the nameCache (scientific name + * Returns or generates the name cache (scientific name * without author strings and year) string for this taxon name. If the * {@link #isProtectedNameCache() protectedNameCache} flag is not set (False) * the string will be generated according to a defined strategy, - * otherwise the value of the actual nameCache string will be returned. + * otherwise the value of the present nameCache string will be returned. * * @return the string which identifies this taxon name (without authors or year) * @see #generateNameCache() @@ -182,7 +177,7 @@ public abstract class TaxonNameBase extends Identifiabl } /** - * Assigns a nameCache string to this taxon name and protects it from being overwritten. + * Assigns a name cache string to this taxon name and protects it from being overwritten. * * @param nameCache the string which identifies this taxon name (without authors or year) * @see #getNameCache() @@ -196,7 +191,9 @@ public abstract class TaxonNameBase extends Identifiabl /** * Returns the boolean value of the flag intended to protect (true) * or not (false) the {@link #getNameCache() nameCache} (scientific name without author strings and year) - * string of this taxon name. + * string of this taxon name. This flag shows whether the getNameCache + * method should return a generated value (false) or the present name cache + * string (true). * * @return the boolean value of the protectedNameCache flag * @see #getNameCache() @@ -464,56 +461,126 @@ public abstract class TaxonNameBase extends Identifiabl //TODO for PROTOTYPE + /** + * Returns the {@link eu.etaxonomy.cdm.strategy.cache.INameCacheStrategy cache strategy} used to generate a name string + * corresponding to this taxon name. The cache strategy includes + * two methods: {@link eu.etaxonomy.cdm.strategy.cache.INameCacheStrategy#getNameCache(TaxonNameBase) one} for the scientific name + * string without author teams and year and another {@link eu.etaxonomy.cdm.strategy.cache.INameCacheStrategy#getTaggedName(TaxonNameBase) another one} for the array of scientific name components + * with author teams and eventually year. + * + * @return the name cache strategy used for this taxon name + * @see eu.etaxonomy.cdm.strategy.cache.INameCacheStrategy + * @see eu.etaxonomy.cdm.strategy.cache.NameCacheStrategyBase + */ @Transient public INameCacheStrategy getCacheStrategy() { return cacheStrategy; } + /** + * @see #getCacheStrategy() + */ public void setCacheStrategy(INameCacheStrategy cacheStrategy) { this.cacheStrategy = cacheStrategy; } + /** + * Returns the taxonomic {@link Rank rank} of this taxon name. + * + * @see Rank + */ @ManyToOne //@Cascade({CascadeType.SAVE_UPDATE}) public Rank getRank(){ return this.rank; } + /** + * @see #getRank() + */ public void setRank(Rank rank){ this.rank = rank; } + /** + * Returns the {@link reference.INomenclaturalReference nomenclatural reference} of this taxon name. + * The nomenclatural reference is here meant to be the one publication + * this taxon name was originally published in while fulfilling the formal + * requirements as specified by the corresponding nomenclatural code. + * + * @see reference.INomenclaturalReference + * @see reference.ReferenceBase + */ @ManyToOne @Cascade({CascadeType.SAVE_UPDATE}) - public ReferenceBase getNomenclaturalReference(){ - return (ReferenceBase) this.nomenclaturalReference; + public INomenclaturalReference getNomenclaturalReference(){ + return (INomenclaturalReference) this.nomenclaturalReference; } + /** + * Assigns a nomenclatural {@link reference.INomenclaturalReference nomenclatural reference} to this taxon name. + * The corresponding {@link reference.ReferenceBase.isNomenclaturallyRelevant nomenclaturally relevant flag} will be set to true + * as it is obviously used for nomenclatural purposes. + * + * @see #getNomenclaturalReference() + */ public void setNomenclaturalReference(INomenclaturalReference nomenclaturalReference){ this.nomenclaturalReference = nomenclaturalReference; } - + /** + * Returns the appended phrase string assigned to this taxon name. + * The appended phrase is a non-atomised addition to a name. It is + * not ruled by a nomenclatural code. + */ public String getAppendedPhrase(){ return this.appendedPhrase; } + /** + * @see #getAppendedPhrase() + */ public void setAppendedPhrase(String appendedPhrase){ this.appendedPhrase = appendedPhrase; } + /** + * Returns the details string of the nomenclatural reference assigned + * to this taxon name. The details describe the exact localisation within + * the publication used as nomenclature reference. These are mostly + * (implicitly) pages but can also be figures or tables or any other + * element of a publication. A nomenclatural micro reference (details) + * requires the existence of a nomenclatural reference. + */ + //Details of the nomenclatural reference (protologue). public String getNomenclaturalMicroReference(){ return this.nomenclaturalMicroReference; } + /** + * @see #getNomenclaturalMicroReference() + */ public void setNomenclaturalMicroReference(String nomenclaturalMicroReference){ this.nomenclaturalMicroReference = nomenclaturalMicroReference; } + /** + * Returns the boolean value of the flag indicating whether the + * or not (false) the {@link #getNameCache() nameCache} (scientific name without author strings and year) + * string of this taxon name. This flag shows whether the getNameCache + * method should return a generated value (false) or the present name cache + * string (true). + * + * @return the boolean value of the protectedNameCache flag + * @see #getNameCache() + */ + //this flag will be set to true if the parseName method was unable to successfully parse the name public boolean getHasProblem(){ return this.hasProblem; } + /** + * @see #getHasProblem() + */ public void setHasProblem(boolean hasProblem){ this.hasProblem = hasProblem; } /** - * Same as getHasProblem() - * @return + * @see #getHasProblem() */ public boolean hasProblem(){ return getHasProblem(); diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/NameCacheStrategyBase.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/NameCacheStrategyBase.java index e152af0c4a..b8248401b1 100644 --- a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/NameCacheStrategyBase.java +++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/cache/NameCacheStrategyBase.java @@ -32,16 +32,17 @@ public abstract class NameCacheStrategyBase extends Stra super(); } - /* (non-Javadoc) - * @see eu.etaxonomy.cdm.strategy.INameCacheStrategy#getFullNameCache() + /** + * Generates and returns the "name cache" (only scientific name without author teams and year). + * @see eu.etaxonomy.cdm.strategy.cache.INameCacheStrategy#getNameCache(eu.etaxonomy.cdm.model.name.TaxonNameBase) */ - // Test implementation abstract public String getNameCache(T taxonNameBase); - /* (non-Javadoc) + /** + * Generates and returns the "full name cache" (including scientific name, author teams and eventually year). * @see eu.etaxonomy.cdm.strategy.INameCacheStrategy#getTitleCache(eu.etaxonomy.cdm.model.common.CdmBase) */ public abstract String getTitleCache(T name); diff --git a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/parser/NonViralNameParserImpl.java b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/parser/NonViralNameParserImpl.java index 183b1e66f5..fb01f298b5 100644 --- a/cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/parser/NonViralNameParserImpl.java +++ b/cdmlib-model/src/main/java/eu/etaxonomy/cdm/strategy/parser/NonViralNameParserImpl.java @@ -25,6 +25,7 @@ import eu.etaxonomy.cdm.model.reference.Article; import eu.etaxonomy.cdm.model.reference.Book; import eu.etaxonomy.cdm.model.reference.BookSection; import eu.etaxonomy.cdm.model.reference.Generic; +import eu.etaxonomy.cdm.model.reference.INomenclaturalReference; import eu.etaxonomy.cdm.model.reference.ReferenceBase; import eu.etaxonomy.cdm.model.reference.StrictReferenceBase; import eu.etaxonomy.cdm.strategy.exceptions.StringNotParsableException; @@ -171,7 +172,7 @@ public class NonViralNameParserImpl implements INonViralNameParser //parse subparts parseFullName(nameToBeFilled, name, rank, makeEmpty); parseReference(nameToBeFilled, referenceString, isInReference); - ReferenceBase ref = nameToBeFilled.getNomenclaturalReference(); + INomenclaturalReference ref = nameToBeFilled.getNomenclaturalReference(); if (ref != null && ref.getHasProblem()){ nameToBeFilled.setHasProblem(true); } -- 2.34.1