Compare commits

..

2 Commits

7 changed files with 38 additions and 37 deletions

View File

@ -182,14 +182,14 @@
<dependency> <dependency>
<groupId>eu.dnetlib.dhp</groupId> <groupId>eu.dnetlib.dhp</groupId>
<artifactId>dhp-dump-schema</artifactId> <artifactId>dhp-dump-schema</artifactId>
<version>[8.0.0]</version> <version>[9.0.0]</version>
</dependency> </dependency>
<!-- Add graph schema dependency --> <!-- Add graph schema dependency -->
<dependency> <dependency>
<groupId>eu.dnetlib.dhp</groupId> <groupId>eu.dnetlib.dhp</groupId>
<artifactId>dhp-schemas</artifactId> <artifactId>dhp-schemas</artifactId>
<version>[6.1.3]</version> <version>[8.0.1]</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>junit</groupId> <groupId>junit</groupId>

View File

@ -16,9 +16,9 @@ import java.util.stream.Collectors;
@Mapper(componentModel = "spring") @Mapper(componentModel = "spring")
public interface DatasourceMapper { public interface DatasourceMapper {
@Mapping(target = "pid", expression = "java( mapPids(payload.getPid()) )") @Mapping(target = "pids", expression = "java( mapPids(payload.getPid()) )")
@Mapping(target = "id", source = "payload.header.id") @Mapping(target = "id", source = "payload.header.id")
@Mapping(target = "originalId", source = "payload.header.originalId") @Mapping(target = "originalIds", source = "payload.header.originalId")
@Mapping(target = "type", expression = "java( mapDatasourceType(payload.getDatasource().getDatasourcetype()))") @Mapping(target = "type", expression = "java( mapDatasourceType(payload.getDatasource().getDatasourcetype()))")
@Mapping(target = "openaireCompatibility", source = "payload.datasource.openairecompatibility.label") @Mapping(target = "openaireCompatibility", source = "payload.datasource.openairecompatibility.label")
@Mapping(target = "officialName", source = "payload.datasource.officialname") @Mapping(target = "officialName", source = "payload.datasource.officialname")

View File

@ -25,7 +25,7 @@ public interface OrganizationMapper {
@Mapping(target = "alternativeNames", source = "payload.organization.alternativeNames") @Mapping(target = "alternativeNames", source = "payload.organization.alternativeNames")
@Mapping(target = "websiteUrl", source = "payload.organization.websiteurl") @Mapping(target = "websiteUrl", source = "payload.organization.websiteurl")
@Mapping(target = "id", source = "payload.header.id") @Mapping(target = "id", source = "payload.header.id")
@Mapping(target = "pid", expression = "java( mapPids(payload.getPid()) )") @Mapping(target = "pids", expression = "java( mapPids(payload.getPid()) )")
Organization toGraphOrganization(SolrRecord payload); Organization toGraphOrganization(SolrRecord payload);
@Named("mapCountry") @Named("mapCountry")

View File

@ -25,11 +25,11 @@ public interface ProjectMapper {
@Mapping(target = "endDate", source = "payload.project.enddate") @Mapping(target = "endDate", source = "payload.project.enddate")
@Mapping(target = "callIdentifier", source = "payload.project.callidentifier") @Mapping(target = "callIdentifier", source = "payload.project.callidentifier")
@Mapping(target = "keywords", source = "payload.project.keywords") @Mapping(target = "keywords", source = "payload.project.keywords")
@Mapping(target = "subject", expression = "java( mapSubjects(payload.getProject().getSubjects()) )") @Mapping(target = "subjects", expression = "java( mapSubjects(payload.getProject().getSubjects()) )")
@Mapping(target = "summary", source = "payload.project.summary") @Mapping(target = "summary", source = "payload.project.summary")
@Mapping(target = "granted", expression = " java(mapFundedAmount(payload.getProject()))") @Mapping(target = "granted", expression = " java(mapFundedAmount(payload.getProject()))")
@Mapping(target = "openAccessMandateForDataset", expression = "java( mapOpenAccessMandate(payload.getProject().getEcarticle29_3()) )") @Mapping(target = "openAccessMandateForDataset", expression = "java( mapOpenAccessMandate(payload.getProject().getEcarticle29_3()) )")
@Mapping(target = "funding", expression = "java( mapFundings(payload.getProject().getFunding()) )") @Mapping(target = "fundings", expression = "java( mapFundings(payload.getProject().getFunding()) )")
Project toGraphProject(SolrRecord payload); Project toGraphProject(SolrRecord payload);
@Named("mapFundedAmount") @Named("mapFundedAmount")

View File

@ -27,39 +27,39 @@ public interface ResearchProductMapper {
//From the model of the dump we miss the fulltext and the eoscIFGuidelines, otherTitles, transformativeAgreement. We need to consider if we want to include them in the dump //From the model of the dump we miss the fulltext and the eoscIFGuidelines, otherTitles, transformativeAgreement. We need to consider if we want to include them in the dump
@Mapping(target = "pid", expression = "java(mapPids(payload.getPid()) )") @Mapping(target = "pids", expression = "java(mapPids(payload.getPid()) )")
@Mapping(target = "indicators", expression = "java(mapIndicators(payload.getMeasures()))") @Mapping(target = "indicators", expression = "java(mapIndicators(payload.getMeasures()))")
@Mapping(target = "id", source = "payload.header.id") @Mapping(target = "id", source = "payload.header.id")
@Mapping(target = "originalId", source = "payload.header.originalId") @Mapping(target = "originalIds", source = "payload.header.originalId")
@Mapping(target = "type", source = "payload.result.resulttype") @Mapping(target = "type", source = "payload.result.resulttype")
@Mapping(target = "author", expression = "java(mapAuthors(payload.getResult().getAuthor()))") @Mapping(target = "authors", expression = "java(mapAuthors(payload.getResult().getAuthor()))")
@Mapping(target = "subjects", expression = "java(mapSubjects(payload.getResult().getSubject()) )") @Mapping(target = "subjects", expression = "java(mapSubjects(payload.getResult().getSubject()) )")
@Mapping(target = "language", expression = "java(mapLanguage(payload.getResult().getLanguage()))") @Mapping(target = "language", expression = "java(mapLanguage(payload.getResult().getLanguage()))")
@Mapping(target = "country", expression = "java(mapCountries(payload.getResult().getCountry()))") @Mapping(target = "countries", expression = "java(mapCountries(payload.getResult().getCountry()))")
@Mapping(target = "mainTitle", source = "payload.result.maintitle") @Mapping(target = "mainTitle", source = "payload.result.maintitle")
@Mapping(target = "description", source = "payload.result.description") @Mapping(target = "descriptions", source = "payload.result.description")
@Mapping(target = "publicationDate", source = "payload.result.publicationdate") @Mapping(target = "publicationDate", source = "payload.result.publicationdate")
@Mapping(target = "publisher", source = "payload.result.publisher") @Mapping(target = "publisher", source = "payload.result.publisher")
@Mapping(target = "embargoEndDate", source = "payload.result.embargoenddate") @Mapping(target = "embargoEndDate", source = "payload.result.embargoenddate")
@Mapping(target = "source", source = "payload.result.source") @Mapping(target = "sources", source = "payload.result.source")
@Mapping(target = "format", source = "payload.result.format") @Mapping(target = "formats", source = "payload.result.format")
@Mapping(target = "contributor", source = "payload.result.contributor") @Mapping(target = "contributors", source = "payload.result.contributor")
@Mapping(target = "coverage", source = "payload.result.coverage") @Mapping(target = "coverages", source = "payload.result.coverage")
@Mapping(target = "bestAccessRight", expression = "java(mapBestAccessRight(payload.getResult().getBestaccessright()))") @Mapping(target = "bestAccessRight", expression = "java(mapBestAccessRight(payload.getResult().getBestaccessright()))")
@Mapping(target = "container", expression = "java(mapJournal(payload.getResult().getJournal()) )") @Mapping(target = "container", expression = "java(mapJournal(payload.getResult().getJournal()) )")
@Mapping(target = "documentationUrl", source = "payload.result.documentationUrl") @Mapping(target = "documentationUrls", source = "payload.result.documentationUrl")
@Mapping(target = "codeRepositoryUrl", source = "payload.result.codeRepositoryUrl") @Mapping(target = "codeRepositoryUrl", source = "payload.result.codeRepositoryUrl")
@Mapping(target = "programmingLanguage", source = "payload.result.programmingLanguage") @Mapping(target = "programmingLanguage", source = "payload.result.programmingLanguage")
@Mapping(target = "contactPerson", source = "payload.result.contactperson") @Mapping(target = "contactPeople", source = "payload.result.contactperson")
@Mapping(target = "contactGroup", source = "payload.result.contactgroup") @Mapping(target = "contactGroups", source = "payload.result.contactgroup")
@Mapping(target = "tool", source = "payload.result.tool") @Mapping(target = "tools", source = "payload.result.tool")
@Mapping(target = "size", source = "payload.result.size") @Mapping(target = "size", source = "payload.result.size")
@Mapping(target = "version", source = "payload.result.version") @Mapping(target = "version", source = "payload.result.version")
@Mapping(target = "isGreen", source = "payload.result.isGreen") @Mapping(target = "isGreen", source = "payload.result.isGreen")
@Mapping(target = "openAccessColor", expression = "java(mapOpenAccessColor(payload.getResult().getOpenAccessColor()))") @Mapping(target = "openAccessColor", expression = "java(mapOpenAccessColor(payload.getResult().getOpenAccessColor()))")
@Mapping(target = "isInDiamondJournal", source = "payload.result.isInDiamondJournal") @Mapping(target = "isInDiamondJournal", source = "payload.result.isInDiamondJournal")
@Mapping(target = "publiclyFunded", source = "payload.result.publiclyFunded") @Mapping(target = "publiclyFunded", source = "payload.result.publiclyFunded")
@Mapping(target = "instance", expression = "java(mapInstances(payload.getResult().getInstance()))") @Mapping(target = "instances", expression = "java(mapInstances(payload.getResult().getInstance()))")
GraphResult toGraphResult(SolrRecord payload); GraphResult toGraphResult(SolrRecord payload);
@ -189,9 +189,10 @@ public interface ResearchProductMapper {
@Mapping(target = "type", source = "instance.instancetype") @Mapping(target = "type", source = "instance.instancetype")
@Mapping(target = "urls", source = "instance.url")
@Mapping(target = "publicationDate", source = "instance.dateofacceptance") @Mapping(target = "publicationDate", source = "instance.dateofacceptance")
@Mapping(target = "pid", expression = "java( mapPids(instance.getPid()) )") @Mapping(target = "pids", expression = "java( mapPids(instance.getPid()) )")
@Mapping(target = "alternateIdentifier", expression = "java( mapAltIds(instance.getAlternateIdentifier()) )") @Mapping(target = "alternateIdentifiers", expression = "java( mapAltIds(instance.getAlternateIdentifier()) )")
@Mapping(target = "accessRight", expression = "java(mapAccessRight(instance.getAccessright()))") @Mapping(target = "accessRight", expression = "java(mapAccessRight(instance.getAccessright()))")
@Mapping(target = "articleProcessingCharge", expression = "java(mapAPC(instance.getProcessingcharges()))") @Mapping(target = "articleProcessingCharge", expression = "java(mapAPC(instance.getProcessingcharges()))")
eu.dnetlib.dhp.oa.model.Instance mapInstance(Instance instance); eu.dnetlib.dhp.oa.model.Instance mapInstance(Instance instance);

View File

@ -34,8 +34,8 @@ public class DatasourceMapperTest {
Datasource graphDatasource = datasourceMapper.toGraphDatasource(solrRecord); Datasource graphDatasource = datasourceMapper.toGraphDatasource(solrRecord);
Assertions.assertEquals("doajarticles::614fdb5f82725ed3f8834ae90b9a0212", graphDatasource.getId()); Assertions.assertEquals("doajarticles::614fdb5f82725ed3f8834ae90b9a0212", graphDatasource.getId());
Assertions.assertEquals(2, graphDatasource.getOriginalId().size()); Assertions.assertEquals(2, graphDatasource.getOriginalIds().size());
Assertions.assertTrue(graphDatasource.getOriginalId().containsAll(Arrays.asList("doajarticles::2196-8403", "issn___print::2196-8403"))); Assertions.assertTrue(graphDatasource.getOriginalIds().containsAll(Arrays.asList("doajarticles::2196-8403", "issn___print::2196-8403")));
Assertions.assertEquals("Journal", graphDatasource.getType().getValue()); Assertions.assertEquals("Journal", graphDatasource.getType().getValue());
Assertions.assertEquals("pubsrepository::journal", graphDatasource.getType().getScheme()); Assertions.assertEquals("pubsrepository::journal", graphDatasource.getType().getScheme());
Assertions.assertEquals("collected from a compatible aggregator", graphDatasource.getOpenaireCompatibility()); Assertions.assertEquals("collected from a compatible aggregator", graphDatasource.getOpenaireCompatibility());

View File

@ -37,29 +37,29 @@ public class ResultProductMapperTest {
GraphResult graphResult = resultMapper.toGraphResult(solrRecord); GraphResult graphResult = resultMapper.toGraphResult(solrRecord);
Assertions.assertEquals("CSC_________::207f2db8a5174e57db3715909a2ffa76", graphResult.getId()); Assertions.assertEquals("CSC_________::207f2db8a5174e57db3715909a2ffa76", graphResult.getId());
Assertions.assertEquals(2, graphResult.getOriginalId().size()); Assertions.assertEquals(2, graphResult.getOriginalIds().size());
Assertions.assertTrue(graphResult.getOriginalId().contains("CSC_________::207f2db8a5174e57db3715909a2ffa76") && Assertions.assertTrue(graphResult.getOriginalIds().contains("CSC_________::207f2db8a5174e57db3715909a2ffa76") &&
graphResult.getOriginalId().contains("oai:virta-jtp.csc.fi:Publications/0389383002")); graphResult.getOriginalIds().contains("oai:virta-jtp.csc.fi:Publications/0389383002"));
Assertions.assertEquals("publication", graphResult.getType()); Assertions.assertEquals("publication", graphResult.getType());
Assertions.assertEquals(11, graphResult.getAuthor().size()); Assertions.assertEquals(11, graphResult.getAuthors().size());
List<String> fullNames = graphResult.getAuthor().stream().map(eu.dnetlib.dhp.oa.model.Author::getFullName).toList(); List<String> fullNames = graphResult.getAuthors().stream().map(eu.dnetlib.dhp.oa.model.Author::getFullName).toList();
Assertions.assertTrue(fullNames.containsAll(Arrays.asList("Ahola, Jari","Alahuhta, Petteri","Kaasinen, Eija","Korhonen, Ilkka","Plomp, Johan","Ari","Virtanen","Rentto, Katja","Pakanen, Jouko","Lappalainen, Veijo","Laikari, Arto"))); Assertions.assertTrue(fullNames.containsAll(Arrays.asList("Ahola, Jari","Alahuhta, Petteri","Kaasinen, Eija","Korhonen, Ilkka","Plomp, Johan","Ari","Virtanen","Rentto, Katja","Pakanen, Jouko","Lappalainen, Veijo","Laikari, Arto")));
Author author = graphResult.getAuthor().stream().filter(a -> a.getFullName().equals("Ahola, Jari")).findFirst().get(); Author author = graphResult.getAuthors().stream().filter(a -> a.getFullName().equals("Ahola, Jari")).findFirst().get();
Assertions.assertEquals("Jari", author.getName()); Assertions.assertEquals("Jari", author.getName());
Assertions.assertEquals("Ahola", author.getSurname()); Assertions.assertEquals("Ahola", author.getSurname());
Assertions.assertEquals(1, author.getRank()); Assertions.assertEquals(1, author.getRank());
Assertions.assertNull(author.getPid()); Assertions.assertNull(author.getPid());
author = graphResult.getAuthor().stream().filter(a -> a.getFullName().equals("Virtanen")).findFirst().get(); author = graphResult.getAuthors().stream().filter(a -> a.getFullName().equals("Virtanen")).findFirst().get();
Assertions.assertNull(author.getPid()); Assertions.assertNull(author.getPid());
Assertions.assertNull(author.getName()); Assertions.assertNull(author.getName());
Assertions.assertNull(author.getSurname()); Assertions.assertNull(author.getSurname());
Assertions.assertEquals(9, author.getRank()); Assertions.assertEquals(9, author.getRank());
author = graphResult.getAuthor().stream().filter(a -> a.getFullName().equals("Plomp, Johan")).findFirst().get(); author = graphResult.getAuthors().stream().filter(a -> a.getFullName().equals("Plomp, Johan")).findFirst().get();
Assertions.assertEquals("Johan", author.getName()); Assertions.assertEquals("Johan", author.getName());
Assertions.assertEquals("Plomp", author.getSurname()); Assertions.assertEquals("Plomp", author.getSurname());
Assertions.assertEquals(11, author.getRank()); Assertions.assertEquals(11, author.getRank());
@ -77,17 +77,17 @@ public class ResultProductMapperTest {
Assertions.assertFalse(graphResult.getPubliclyFunded()); Assertions.assertFalse(graphResult.getPubliclyFunded());
Assertions.assertFalse(graphResult.getIsGreen()); Assertions.assertFalse(graphResult.getIsGreen());
Assertions.assertFalse(graphResult.getIsInDiamondJournal()); Assertions.assertFalse(graphResult.getIsInDiamondJournal());
Assertions.assertEquals(1, graphResult.getInstance().size()); Assertions.assertEquals(1, graphResult.getInstances().size());
Instance instance = graphResult.getInstance().get(0); Instance instance = graphResult.getInstances().get(0);
Assertions.assertEquals(Constants.COAR_ACCESS_RIGHT_SCHEMA, instance.getAccessRight().getScheme()); Assertions.assertEquals(Constants.COAR_ACCESS_RIGHT_SCHEMA, instance.getAccessRight().getScheme());
Assertions.assertEquals(Constants.ACCESS_RIGHTS_COAR_MAP.get("CLOSED"), instance.getAccessRight().getCode()); Assertions.assertEquals(Constants.ACCESS_RIGHTS_COAR_MAP.get("CLOSED"), instance.getAccessRight().getCode());
Assertions.assertEquals(Constants.COAR_CODE_LABEL_MAP.get(Constants.C14CB), instance.getAccessRight().getLabel()); Assertions.assertEquals(Constants.COAR_CODE_LABEL_MAP.get(Constants.C14CB), instance.getAccessRight().getLabel());
Assertions.assertNull(instance.getAccessRight().getOpenAccessRoute()); Assertions.assertNull(instance.getAccessRight().getOpenAccessRoute());
Assertions.assertEquals("0013", instance.getType()); Assertions.assertEquals("0013", instance.getType());
Assertions.assertEquals(1, instance.getUrl().size()); Assertions.assertEquals(1, instance.getUrls().size());
Assertions.assertTrue(instance.getUrl().contains("http://juuli.fi/Record/0389383002")); Assertions.assertTrue(instance.getUrls().contains("http://juuli.fi/Record/0389383002"));
Assertions.assertEquals("0002", instance.getRefereed()); Assertions.assertEquals("0002", instance.getRefereed());
} }