1
0
Fork 0

added related author's given name and family name in the solr json payload serialisation

This commit is contained in:
Claudio Atzori 2024-11-20 15:52:40 +01:00
parent 4e55ddc547
commit 15227f82b8
2 changed files with 22 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import java.io.StringReader;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import eu.dnetlib.dhp.schema.solr.PersonTopic;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.dom4j.Document; import org.dom4j.Document;
import org.dom4j.DocumentException; import org.dom4j.DocumentException;
@ -39,7 +40,6 @@ import eu.dnetlib.dhp.schema.solr.OpenAccessColor;
import eu.dnetlib.dhp.schema.solr.OpenAccessRoute; import eu.dnetlib.dhp.schema.solr.OpenAccessRoute;
import eu.dnetlib.dhp.schema.solr.Organization; import eu.dnetlib.dhp.schema.solr.Organization;
import eu.dnetlib.dhp.schema.solr.Person; import eu.dnetlib.dhp.schema.solr.Person;
import eu.dnetlib.dhp.schema.solr.PersonTopic;
import eu.dnetlib.dhp.schema.solr.Pid; import eu.dnetlib.dhp.schema.solr.Pid;
import eu.dnetlib.dhp.schema.solr.Project; import eu.dnetlib.dhp.schema.solr.Project;
import eu.dnetlib.dhp.schema.solr.Result; import eu.dnetlib.dhp.schema.solr.Result;
@ -174,6 +174,8 @@ public class ProvisionModelSupport {
&& StringUtils.isNotBlank(relation.getValidationDate())) { && StringUtils.isNotBlank(relation.getValidationDate())) {
rr.setValidationDate(relation.getValidationDate()); rr.setValidationDate(relation.getValidationDate());
} }
rr.setGivenName(re.getGivenName());
rr.setFamilyName(re.getFamilyName());
return rr; return rr;
} }
@ -208,11 +210,28 @@ public class ProvisionModelSupport {
ps.setAlternativeNames(p.getAlternativeNames()); ps.setAlternativeNames(p.getAlternativeNames());
ps.setBiography(p.getBiography()); ps.setBiography(p.getBiography());
ps.setConsent(p.getConsent()); ps.setConsent(p.getConsent());
// ps.setSubject(...)); ps.setSubject(mapPersonTopics(p.getSubject()));
return ps; return ps;
} }
private static List<PersonTopic> mapPersonTopics(List<eu.dnetlib.dhp.schema.oaf.PersonTopic> subjects) {
return Optional.ofNullable(subjects)
.map(ss -> ss.stream()
.map(ProvisionModelSupport::mapPersonTopic)
.collect(Collectors.toList()))
.orElse(null);
}
private static PersonTopic mapPersonTopic(eu.dnetlib.dhp.schema.oaf.PersonTopic pt) {
PersonTopic topic = new PersonTopic();
topic.setValue(pt.getValue());
topic.setSchema(pt.getSchema());
topic.setFromYear(pt.getFromYear());
topic.setToYear(pt.getToYear());
return topic;
}
private static Funding mapFunding(List<String> fundingtree, VocabularyGroup vocs) { private static Funding mapFunding(List<String> fundingtree, VocabularyGroup vocs) {
SAXReader reader = new SAXReader(); SAXReader reader = new SAXReader();
return Optional return Optional

View File

@ -937,7 +937,7 @@
<commons.logging.version>1.1.3</commons.logging.version> <commons.logging.version>1.1.3</commons.logging.version>
<commons-validator.version>1.7</commons-validator.version> <commons-validator.version>1.7</commons-validator.version>
<dateparser.version>1.0.7</dateparser.version> <dateparser.version>1.0.7</dateparser.version>
<dhp-schemas.version>[9.0.0]</dhp-schemas.version> <dhp-schemas.version>[10.0.0]</dhp-schemas.version>
<dhp.cdh.version>cdh5.9.2</dhp.cdh.version> <dhp.cdh.version>cdh5.9.2</dhp.cdh.version>
<dhp.commons.lang.version>3.5</dhp.commons.lang.version> <dhp.commons.lang.version>3.5</dhp.commons.lang.version>
<dhp.guava.version>11.0.2</dhp.guava.version> <dhp.guava.version>11.0.2</dhp.guava.version>