1
0
Fork 0

changed logic to compute only onece PacePerson for each Author to be enriched

This commit is contained in:
Miriam Baglioni 2020-05-25 10:35:02 +02:00
parent 8f51af4e9b
commit f754c424bd
1 changed files with 11 additions and 13 deletions

View File

@ -122,29 +122,24 @@ public class SparkOrcidToResultFromSemRelJob {
} }
private static void enrichAuthor(Author a, List<AutoritativeAuthor> au) { private static void enrichAuthor(Author a, List<AutoritativeAuthor> au) {
PacePerson pp = new PacePerson(a.getFullname(), false);
for (AutoritativeAuthor aa : au) { for (AutoritativeAuthor aa : au) {
if (enrichAuthor(aa, a)) { if (enrichAuthor(aa, a, pp.getNormalisedFirstName(), pp.getNormalisedSurname() )) {
return; return;
} }
} }
} }
private static boolean enrichAuthor(AutoritativeAuthor autoritative_author, Author author) { private static boolean enrichAuthor(AutoritativeAuthor autoritative_author, Author author,
String author_name,
String author_surname) {
boolean toaddpid = false; boolean toaddpid = false;
String author_name = author.getName();
String author_surname = author.getSurname();
if(StringUtils.isEmpty(author_name) || StringUtils.isEmpty(author_surname)){
PacePerson pp = new PacePerson(author.getFullname(), false);
if (pp.isAccurate()){
author_name = pp.getNormalisedFirstName();
author_surname = pp.getNormalisedSurname();
}
}
if (StringUtils.isNotEmpty(autoritative_author.getSurname())) { if (StringUtils.isNotEmpty(autoritative_author.getSurname())) {
if (StringUtils.isNotEmpty(author.getSurname())){
author_surname = author.getSurname();
}
if (StringUtils.isNotEmpty(author_surname)) { if (StringUtils.isNotEmpty(author_surname)) {
if (autoritative_author if (autoritative_author
.getSurname() .getSurname()
@ -153,6 +148,9 @@ public class SparkOrcidToResultFromSemRelJob {
// have the same surname. Check the name // have the same surname. Check the name
if (StringUtils.isNotEmpty(autoritative_author.getName())) { if (StringUtils.isNotEmpty(autoritative_author.getName())) {
if(StringUtils.isNotEmpty(author.getName())){
author_name = author.getName();
}
if (StringUtils.isNotEmpty(author_name)) { if (StringUtils.isNotEmpty(author_name)) {
if (autoritative_author if (autoritative_author
.getName() .getName()