*\r
* The contents of this file are subject to the Mozilla Public License Version 1.1\r
* See LICENSE.TXT at the top of this package for the full license terms.\r
-*/ \r
+*/\r
\r
package eu.etaxonomy.cdm.io.eflora.centralAfrica.ericaceae;\r
\r
\r
\r
\r
- \r
+\r
/* (non-Javadoc)\r
* @see eu.etaxonomy.cdm.io.eflora.EfloraTaxonImport#handleNomenclaturalReference(eu.etaxonomy.cdm.model.name.NonViralName, java.lang.String)\r
*/\r
nomRef.setTitleCache(value, true);\r
parseNomStatus(nomRef, name);\r
name.setNomenclaturalReference(nomRef);\r
- \r
+\r
String microReference = parseReferenceYearAndDetail(nomRef);\r
microReference = removeTrailing(microReference, ")");\r
- \r
+\r
microReference = parseHomonym(microReference, name);\r
name.setNomenclaturalMicroReference(microReference);\r
- \r
- TeamOrPersonBase nameTeam = CdmBase.deproxy(name.getCombinationAuthorTeam(), TeamOrPersonBase.class);\r
- TeamOrPersonBase refTeam = nomRef.getAuthorTeam();\r
+\r
+ TeamOrPersonBase nameTeam = CdmBase.deproxy(name.getCombinationAuthorship(), TeamOrPersonBase.class);\r
+ TeamOrPersonBase refTeam = nomRef.getAuthorship();\r
if (nameTeam == null ){\r
logger.warn("Name has nom. ref. but no author team. Name: " + name.getTitleCache() + ", Nom.Ref.: " + value);\r
}else if (refTeam == null ){\r
}else if (! authorTeamsMatch(refTeam, nameTeam)){\r
logger.warn("Nom.Ref. author and comb. author do not match: " + nomRef.getTitleCache() + " <-> " + nameTeam.getNomenclaturalTitle());\r
}else {\r
- nomRef.setAuthorTeam(nameTeam);\r
+ nomRef.setAuthorship(nameTeam);\r
nomRef.setTitle(CdmUtils.Nz(nomRef.getTitle()) + " - no title given yet -");\r
nameTeam.setTitleCache(refTeam.getTitleCache(), true);\r
}\r
return nameTeam;\r
}\r
- \r
+\r
/**\r
* Extracts the date published part and returns micro reference\r
* @param ref\r
String detailResult = null;\r
String titleToParse = ref.getTitleCache();\r
titleToParse = removeReferenceBracket(titleToParse, ref);\r
- \r
+\r
int detailStart = titleToParse.indexOf(":");\r
if (detailStart >= 0){\r
detailResult = titleToParse.substring(detailStart + 1);\r
titleToParse = titleToParse.substring(0, titleToParse.length() - detailResult.length() - 1).trim();\r
detailResult = detailResult.trim();\r
}\r
- \r
+\r
String reYear = "\\s[1-2]{1}[0-9]{3}";\r
String reYearPeriod = reYear;\r
-// \r
+//\r
// //pattern for the whole string\r
Pattern patReference = Pattern.compile( reYearPeriod );\r
Matcher matcher = patReference.matcher(titleToParse);\r
if (matcher.find()){\r
int start = matcher.start();\r
int end = matcher.end();\r
-// \r
+//\r
String strPeriod = titleToParse.substring(start, end);\r
TimePeriod datePublished = TimePeriodParser.parseString(strPeriod);\r
ref.setDatePublished(datePublished);\r
String author = titleToParse.substring(0, start).trim();\r
author = parseInRefrence(ref, author);\r
TeamOrPersonBase team = parseSingleTeam(author);\r
- ref.setAuthorTeam(team);\r
+ ref.setAuthorship(team);\r
ref.setProtectedTitleCache(false);\r
}else{\r
logger.warn("Could not parse reference: " + titleToParse);\r
}\r
return detailResult;\r
- \r
+\r
}\r
\r
private String parseInRefrence(Reference ref, String author) {\r
String myAuthorString = author.substring(0, pos);\r
Reference inReference = ReferenceFactory.newGeneric();\r
TeamOrPersonBase inAuthor = parseSingleTeam(inAuthorString);\r
- inReference.setAuthorTeam(inAuthor);\r
+ inReference.setAuthorship(inAuthor);\r
ref.setInReference(inReference);\r
return myAuthorString;\r
}else{\r
return author;\r
}\r
- \r
+\r
}\r
\r
private String removeReferenceBracket(String refString, Reference ref) {\r
String reBracket = "\\(.*\\).?";\r
Pattern patBracket = Pattern.compile(reBracket);\r
Matcher matcher = patBracket.matcher(titleToParse);\r
- \r
+\r
if (matcher.matches()){\r
int start = matcher.start() + 1;\r
int end = matcher.end() -1 ;\r
end = end - 1;\r
}\r
titleToParse = titleToParse.substring(start, end);\r
- \r
+\r
ref.setTitleCache(titleToParse);\r
}\r
return titleToParse;\r
}\r
- \r
+\r
/**\r
* @param taxon\r
* @param name\r
*/\r
@Override\r
protected TeamOrPersonBase<?> handleNameUsage(Taxon taxon, NonViralName<?> name, String referenceTitle, TeamOrPersonBase lastTeam) {\r
- Reference<?> ref = ReferenceFactory.newGeneric();\r
- \r
+ Reference ref = ReferenceFactory.newGeneric();\r
+\r
ref.setTitleCache(referenceTitle, true);\r
- \r
+\r
TeamOrPersonBase<?> team = getReferenceAuthor(ref, name);\r
- ref.setAuthorTeam(team);\r
- \r
+ ref.setAuthorship(team);\r
+\r
String[] multipleReferences = ref.getTitleCache().split("&");\r
- \r
+\r
TaxonDescription description = getDescription(taxon);\r
for (String singleReferenceString : multipleReferences){\r
- Reference<?> singleRef = ReferenceFactory.newGeneric();\r
+ Reference singleRef = ReferenceFactory.newGeneric();\r
singleRef.setTitleCache(singleReferenceString.trim(), true);\r
- singleRef.setAuthorTeam(team);\r
- \r
+ singleRef.setAuthorship(team);\r
+\r
String microReference = parseReferenceYearAndDetailForUsage(singleRef);\r
- \r
+\r
singleRef.setTitle( CdmUtils.Nz(singleRef.getTitle()) + " - no title given yet -");\r
- \r
+\r
// parseReferenceType(ref);\r
- \r
+\r
TextData textData = TextData.NewInstance(Feature.CITATION());\r
textData.addSource(OriginalSourceType.PrimaryTaxonomicSource, null, null, singleRef, microReference, name, null);\r
description.addElement(textData);\r
private String parseReferenceYearAndDetailForUsage(Reference ref) {\r
String detailResult = null;\r
String titleToParse = ref.getTitleCache().trim();\r
- \r
+\r
int detailStart = titleToParse.indexOf(":");\r
if (detailStart >= 0){\r
detailResult = titleToParse.substring(detailStart + 1);\r
titleToParse = titleToParse.substring(0, titleToParse.length() - detailResult.length() - 1).trim();\r
detailResult = detailResult.trim();\r
}\r
- \r
+\r
String reYear = "^[1-2]{1}[0-9]{3}[a-e]?$";\r
String reYearPeriod = reYear;\r
-// \r
+//\r
// //pattern for the whole string\r
Pattern patReference = Pattern.compile( reYearPeriod );\r
Matcher matcher = patReference.matcher(titleToParse);\r
TimePeriod datePublished = TimePeriodParser.parseString(titleToParse);\r
ref.setDatePublished(datePublished);\r
return detailResult;\r
- \r
+\r
}\r
\r
protected TeamOrPersonBase getReferenceAuthor (Reference ref, NonViralName name) {\r
logger.warn("Title does not match: " + titleString);\r
return null;\r
}\r
- \r
+\r
}\r
\r
private TeamOrPersonBase getAuthorTeam(String authorString, NonViralName name) {\r
//TODO atomize\r
-// TeamOrPersonBase nameTeam = CdmBase.deproxy(name.getCombinationAuthorTeam(), TeamOrPersonBase.class);\r
+// TeamOrPersonBase nameTeam = CdmBase.deproxy(name.getCombinationAuthorship(), TeamOrPersonBase.class);\r
// String nameTeamTitle = nameTeam == null ? "" : nameTeam.getNomenclaturalTitle();\r
- \r
+\r
// if (nameTeam == null || ! authorTeamsMatch(authorString, nameTeamTitle)){\r
// logger.warn("Author teams do not match: " + authorString + " <-> " + nameTeamTitle);\r
TeamOrPersonBase result = parseSingleTeam(authorString);\r
if (nameTeamString.equalsIgnoreCase(refAuthorTeamString)){\r
return true;\r
}\r
- \r
+\r
if (nameTeamString.endsWith(".")){\r
nameTeamString = nameTeamString.substring(0, nameTeamString.length() - 1 );\r
if (refAuthorTeamString.startsWith(nameTeamString)){\r
}\r
}\r
}\r
- \r
+\r
private boolean checkSingleAndIpniAuthor(TeamOrPersonBase nameTeam, TeamOrPersonBase refAuthorTeam) {\r
if ( nameTeam.isInstanceOf(Team.class) && ((Team)nameTeam).getTeamMembers().size()> 1 ||\r
refAuthorTeam.isInstanceOf(Team.class) && ((Team)refAuthorTeam).getTeamMembers().size()> 1){\r
* @param state\r
* @param elNom\r
* @param taxon\r
- * @param homotypicalGroup \r
+ * @param homotypicalGroup\r
*/\r
@Override\r
protected void handleTypeRef(EfloraImportState state, Element elNom, Taxon taxon, HomotypicalGroup homotypicalGroup) {\r
typeRef = typeRef.trim().replace("Type: ", "").replace("Types: ", "").trim();\r
return typeRef;\r
}\r
- \r
- protected void handleGenus(String value, TaxonNameBase taxonName) {\r
+\r
+ @Override\r
+ protected void handleGenus(String value, TaxonNameBase taxonName) {\r
// do nothing\r
}\r
\r
- \r
- \r
+\r
+\r
}\r