Compare commits
2 Commits
master
...
jsonPayloa
Author | SHA1 | Date |
---|---|---|
Miriam Baglioni | 717459be70 | |
Miriam Baglioni | fe7acea5b6 |
4
pom.xml
4
pom.xml
|
@ -182,14 +182,14 @@
|
|||
<dependency>
|
||||
<groupId>eu.dnetlib.dhp</groupId>
|
||||
<artifactId>dhp-dump-schema</artifactId>
|
||||
<version>[8.0.0]</version>
|
||||
<version>[9.0.0]</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Add graph schema dependency -->
|
||||
<dependency>
|
||||
<groupId>eu.dnetlib.dhp</groupId>
|
||||
<artifactId>dhp-schemas</artifactId>
|
||||
<version>[6.1.3]</version>
|
||||
<version>[8.0.1]</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
|
|
|
@ -16,9 +16,9 @@ import java.util.stream.Collectors;
|
|||
@Mapper(componentModel = "spring")
|
||||
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 = "originalId", source = "payload.header.originalId")
|
||||
@Mapping(target = "originalIds", source = "payload.header.originalId")
|
||||
@Mapping(target = "type", expression = "java( mapDatasourceType(payload.getDatasource().getDatasourcetype()))")
|
||||
@Mapping(target = "openaireCompatibility", source = "payload.datasource.openairecompatibility.label")
|
||||
@Mapping(target = "officialName", source = "payload.datasource.officialname")
|
||||
|
|
|
@ -25,7 +25,7 @@ public interface OrganizationMapper {
|
|||
@Mapping(target = "alternativeNames", source = "payload.organization.alternativeNames")
|
||||
@Mapping(target = "websiteUrl", source = "payload.organization.websiteurl")
|
||||
@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);
|
||||
|
||||
@Named("mapCountry")
|
||||
|
|
|
@ -25,11 +25,11 @@ public interface ProjectMapper {
|
|||
@Mapping(target = "endDate", source = "payload.project.enddate")
|
||||
@Mapping(target = "callIdentifier", source = "payload.project.callidentifier")
|
||||
@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 = "granted", expression = " java(mapFundedAmount(payload.getProject()))")
|
||||
@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);
|
||||
|
||||
@Named("mapFundedAmount")
|
||||
|
|
|
@ -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
|
||||
@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 = "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 = "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 = "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 = "description", source = "payload.result.description")
|
||||
@Mapping(target = "descriptions", source = "payload.result.description")
|
||||
@Mapping(target = "publicationDate", source = "payload.result.publicationdate")
|
||||
@Mapping(target = "publisher", source = "payload.result.publisher")
|
||||
@Mapping(target = "embargoEndDate", source = "payload.result.embargoenddate")
|
||||
@Mapping(target = "source", source = "payload.result.source")
|
||||
@Mapping(target = "format", source = "payload.result.format")
|
||||
@Mapping(target = "contributor", source = "payload.result.contributor")
|
||||
@Mapping(target = "coverage", source = "payload.result.coverage")
|
||||
@Mapping(target = "sources", source = "payload.result.source")
|
||||
@Mapping(target = "formats", source = "payload.result.format")
|
||||
@Mapping(target = "contributors", source = "payload.result.contributor")
|
||||
@Mapping(target = "coverages", source = "payload.result.coverage")
|
||||
@Mapping(target = "bestAccessRight", expression = "java(mapBestAccessRight(payload.getResult().getBestaccessright()))")
|
||||
@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 = "programmingLanguage", source = "payload.result.programmingLanguage")
|
||||
@Mapping(target = "contactPerson", source = "payload.result.contactperson")
|
||||
@Mapping(target = "contactGroup", source = "payload.result.contactgroup")
|
||||
@Mapping(target = "tool", source = "payload.result.tool")
|
||||
@Mapping(target = "contactPeople", source = "payload.result.contactperson")
|
||||
@Mapping(target = "contactGroups", source = "payload.result.contactgroup")
|
||||
@Mapping(target = "tools", source = "payload.result.tool")
|
||||
@Mapping(target = "size", source = "payload.result.size")
|
||||
@Mapping(target = "version", source = "payload.result.version")
|
||||
@Mapping(target = "isGreen", source = "payload.result.isGreen")
|
||||
@Mapping(target = "openAccessColor", expression = "java(mapOpenAccessColor(payload.getResult().getOpenAccessColor()))")
|
||||
@Mapping(target = "isInDiamondJournal", source = "payload.result.isInDiamondJournal")
|
||||
@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);
|
||||
|
||||
|
||||
|
@ -189,9 +189,10 @@ public interface ResearchProductMapper {
|
|||
|
||||
|
||||
@Mapping(target = "type", source = "instance.instancetype")
|
||||
@Mapping(target = "urls", source = "instance.url")
|
||||
@Mapping(target = "publicationDate", source = "instance.dateofacceptance")
|
||||
@Mapping(target = "pid", expression = "java( mapPids(instance.getPid()) )")
|
||||
@Mapping(target = "alternateIdentifier", expression = "java( mapAltIds(instance.getAlternateIdentifier()) )")
|
||||
@Mapping(target = "pids", expression = "java( mapPids(instance.getPid()) )")
|
||||
@Mapping(target = "alternateIdentifiers", expression = "java( mapAltIds(instance.getAlternateIdentifier()) )")
|
||||
@Mapping(target = "accessRight", expression = "java(mapAccessRight(instance.getAccessright()))")
|
||||
@Mapping(target = "articleProcessingCharge", expression = "java(mapAPC(instance.getProcessingcharges()))")
|
||||
eu.dnetlib.dhp.oa.model.Instance mapInstance(Instance instance);
|
||||
|
|
|
@ -34,8 +34,8 @@ public class DatasourceMapperTest {
|
|||
Datasource graphDatasource = datasourceMapper.toGraphDatasource(solrRecord);
|
||||
|
||||
Assertions.assertEquals("doajarticles::614fdb5f82725ed3f8834ae90b9a0212", graphDatasource.getId());
|
||||
Assertions.assertEquals(2, graphDatasource.getOriginalId().size());
|
||||
Assertions.assertTrue(graphDatasource.getOriginalId().containsAll(Arrays.asList("doajarticles::2196-8403", "issn___print::2196-8403")));
|
||||
Assertions.assertEquals(2, graphDatasource.getOriginalIds().size());
|
||||
Assertions.assertTrue(graphDatasource.getOriginalIds().containsAll(Arrays.asList("doajarticles::2196-8403", "issn___print::2196-8403")));
|
||||
Assertions.assertEquals("Journal", graphDatasource.getType().getValue());
|
||||
Assertions.assertEquals("pubsrepository::journal", graphDatasource.getType().getScheme());
|
||||
Assertions.assertEquals("collected from a compatible aggregator", graphDatasource.getOpenaireCompatibility());
|
||||
|
|
|
@ -37,29 +37,29 @@ public class ResultProductMapperTest {
|
|||
GraphResult graphResult = resultMapper.toGraphResult(solrRecord);
|
||||
|
||||
Assertions.assertEquals("CSC_________::207f2db8a5174e57db3715909a2ffa76", graphResult.getId());
|
||||
Assertions.assertEquals(2, graphResult.getOriginalId().size());
|
||||
Assertions.assertTrue(graphResult.getOriginalId().contains("CSC_________::207f2db8a5174e57db3715909a2ffa76") &&
|
||||
graphResult.getOriginalId().contains("oai:virta-jtp.csc.fi:Publications/0389383002"));
|
||||
Assertions.assertEquals(2, graphResult.getOriginalIds().size());
|
||||
Assertions.assertTrue(graphResult.getOriginalIds().contains("CSC_________::207f2db8a5174e57db3715909a2ffa76") &&
|
||||
graphResult.getOriginalIds().contains("oai:virta-jtp.csc.fi:Publications/0389383002"));
|
||||
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")));
|
||||
|
||||
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("Ahola", author.getSurname());
|
||||
Assertions.assertEquals(1, author.getRank());
|
||||
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.getName());
|
||||
Assertions.assertNull(author.getSurname());
|
||||
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("Plomp", author.getSurname());
|
||||
Assertions.assertEquals(11, author.getRank());
|
||||
|
@ -77,17 +77,17 @@ public class ResultProductMapperTest {
|
|||
Assertions.assertFalse(graphResult.getPubliclyFunded());
|
||||
Assertions.assertFalse(graphResult.getIsGreen());
|
||||
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.ACCESS_RIGHTS_COAR_MAP.get("CLOSED"), instance.getAccessRight().getCode());
|
||||
Assertions.assertEquals(Constants.COAR_CODE_LABEL_MAP.get(Constants.C14CB), instance.getAccessRight().getLabel());
|
||||
Assertions.assertNull(instance.getAccessRight().getOpenAccessRoute());
|
||||
|
||||
Assertions.assertEquals("0013", instance.getType());
|
||||
Assertions.assertEquals(1, instance.getUrl().size());
|
||||
Assertions.assertTrue(instance.getUrl().contains("http://juuli.fi/Record/0389383002"));
|
||||
Assertions.assertEquals(1, instance.getUrls().size());
|
||||
Assertions.assertTrue(instance.getUrls().contains("http://juuli.fi/Record/0389383002"));
|
||||
Assertions.assertEquals("0002", instance.getRefereed());
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue