[EOSC DUMP] added resources needed for the review as test

This commit is contained in:
Miriam Baglioni 2022-11-25 17:17:03 +01:00
parent 59ba4f5d5e
commit 20409e1106
9 changed files with 155 additions and 31 deletions

View File

@ -20,7 +20,7 @@ public class EoscResult extends CommunityResult {
@JsonSchema(description = "The subject dumped by type associated to the result")
private Map<String, List<Subject>> subject;
@JsonSchema(description = "Te list of keywords associated to the result")
@JsonSchema(description = "The list of keywords associated to the result")
private List<String> keywords;
@JsonSchema(description = "The list of organizations the result is affiliated to")

View File

@ -268,26 +268,30 @@
"description": "Date when the embargo ends and this result turns Open Access"
},
"eoscIF": {
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "EOSC-IF local code. Later on it could be populated with a PID (e.g. DOI), but for the time being we stick to a more loose definition."
"description": "Describes a reference to the EOSC Interoperability Framework (IF) Guidelines",
"type": "array",
"items": {
"type": "object",
"properties": {
"code": {
"type": "string",
"description": "EOSC-IF local code. Later on it could be populated with a PID (e.g. DOI), but for the time being we stick to a more loose definition."
},
"label": {
"type": "string",
"description": "EOSC-IF label"
},
"semanticRelation": {
"type": "string",
"description": "EOSC-IF semantic relation (e.g. compliesWith)"
},
"url": {
"type": "string",
"description": "EOSC-IF url to the guidelines"
}
},
"label": {
"type": "string",
"description": "EOSC-IF label"
},
"semanticRelation": {
"type": "string",
"description": "EOSC-IF semantic relation (e.g. compliesWith)"
},
"url": {
"type": "string",
"description": "EOSC-IF url to the guidelines"
}
},
"description": "Describes a reference to the EOSC Interoperability Framework (IF) Guidelines"
"description": "Describes a reference to the EOSC Interoperability Framework (IF) Guidelines"
}
},
"format": {
"type": "array",
@ -310,6 +314,19 @@
"type": "string",
"description": "The OpenAIRE identifiers for this result"
},
"indicator": {
"type": "object",
"properties": {
"usageCounts": {
"type": "object",
"properties": {
"downloads": {"type": "string"},
"views": {"type": "string"}
}
}
},
"description": "The indicators for this result"
},
"instance": {
"description": "Each instance is one specific materialisation or version of the result. For example, you can have one result with three instance: one is the pre-print, one is the post-print, one is te published version",
"type": "array",
@ -423,11 +440,11 @@
}
},
"keywords": {
"description": "Te list of keywords associated to the result",
"description": "The list of keywords associated to the result",
"type": "array",
"items": {
"type": "string",
"description": "Te list of keywords associated to the result"
"description": "The list of keywords associated to the result"
}
},
"language": {

View File

@ -250,10 +250,16 @@ public class ResultMapper implements Serializable {
if (Optional.ofNullable(input.getEoscifguidelines()).isPresent()) {
((EoscResult) out)
.setEoscIF(input.getEoscifguidelines()
.stream()
.map(eig -> EoscInteroperabilityFramework.newInstance(eig.getCode(), eig.getLabel(), eig.getUrl(), eig.getSemanticRelation()))
.collect(Collectors.toList()));
.setEoscIF(
input
.getEoscifguidelines()
.stream()
.map(
eig -> EoscInteroperabilityFramework
.newInstance(
eig.getCode(), eig.getLabel(), eig.getUrl(),
eig.getSemanticRelation()))
.collect(Collectors.toList()));
}
}

View File

@ -131,8 +131,16 @@ public class ExtendEoscResultWithOrganizationStep2 implements Serializable {
}
EoscResult ret = first._1();
List<eu.dnetlib.dhp.eosc.model.Organization> affiliation = new ArrayList<>();
Set<String> alreadyInsertedAffiliations = new HashSet<>();
affiliation.add(first._2().getAffiliation());
it.forEachRemaining(res -> affiliation.add(res._2().getAffiliation()));
alreadyInsertedAffiliations.add(first._2().getAffiliation().getId());
it.forEachRemaining(res -> {
if (!alreadyInsertedAffiliations.contains(res._2().getAffiliation().getId())) {
affiliation.add(res._2().getAffiliation());
alreadyInsertedAffiliations.add(res._2().getAffiliation().getId());
}
});
ret.setAffiliation(affiliation);
return ret;
}, Encoders.bean(EoscResult.class))

View File

@ -921,15 +921,104 @@ public class DumpJobTest {
Assertions.assertEquals(1, verificationDataset.filter("type = 'dataset'").count());
Assertions.assertEquals(1, tmp.filter(d -> d.getEoscIF().stream().anyMatch(c -> c.getCode().equals("EOSC::Twitter Data"))).count());
Assertions.assertEquals(1, tmp.filter(d -> d.getEoscIF().stream().anyMatch(c -> c.getLabel().equals("EOSC::Twitter Data"))).count());
Assertions.assertEquals(1, tmp.filter(d -> d.getEoscIF().stream().anyMatch(c -> c.getUrl().equals(""))).count());
Assertions.assertEquals(1, tmp.filter(d -> d.getEoscIF().stream().anyMatch(c -> c.getSemanticRelation().equals("compliesWith"))).count());
Assertions
.assertEquals(
1,
tmp
.filter(d -> d.getEoscIF().stream().anyMatch(c -> c.getCode().equals("EOSC::Twitter Data")))
.count());
Assertions
.assertEquals(
1,
tmp
.filter(d -> d.getEoscIF().stream().anyMatch(c -> c.getLabel().equals("EOSC::Twitter Data")))
.count());
Assertions
.assertEquals(1, tmp.filter(d -> d.getEoscIF().stream().anyMatch(c -> c.getUrl().equals(""))).count());
Assertions
.assertEquals(
1,
tmp
.filter(d -> d.getEoscIF().stream().anyMatch(c -> c.getSemanticRelation().equals("compliesWith")))
.count());
System.out.println(OBJECT_MAPPER.writeValueAsString(verificationDataset.first()));
}
@Test
public void testEOSCDumpZenodoReview() throws Exception {
final JavaSparkContext sc = JavaSparkContext.fromSparkContext(spark.sparkContext());
DumpProducts dump = new DumpProducts();
dump
.run(
false, getClass()
.getResource("/eu/dnetlib/dhp/oa/graph/dump/eosc/input/review202211/zenodo7353841")
.getPath(), workingDir.toString() + "/orp", getClass()
.getResource("/eu/dnetlib/dhp/oa/graph/dump/communityMapPath/communitymap.json")
.getPath(), OtherResearchProduct.class,
EoscResult.class, Constants.DUMPTYPE.EOSC.getType());
JavaRDD<EoscResult> tmp = sc
.textFile(workingDir.toString() + "/orp")
.map(item -> OBJECT_MAPPER.readValue(item, EoscResult.class));
System.out.println(OBJECT_MAPPER.writeValueAsString(tmp.first()));
dump
.run(
false, getClass()
.getResource("/eu/dnetlib/dhp/oa/graph/dump/eosc/input/review202211/zenodo7351393")
.getPath(), workingDir.toString() + "/soft", getClass()
.getResource("/eu/dnetlib/dhp/oa/graph/dump/communityMapPath/communitymap.json")
.getPath(), Software.class,
EoscResult.class, Constants.DUMPTYPE.EOSC.getType());
JavaRDD<EoscResult> tmp2 = sc
.textFile(workingDir.toString() + "/soft")
.map(item -> OBJECT_MAPPER.readValue(item, EoscResult.class));
System.out.println(OBJECT_MAPPER.writeValueAsString(tmp2.first()));
dump
.run(
false, getClass()
.getResource("/eu/dnetlib/dhp/oa/graph/dump/eosc/input/review202211/zenodo7351221")
.getPath(), workingDir.toString() + "/soft2", getClass()
.getResource("/eu/dnetlib/dhp/oa/graph/dump/communityMapPath/communitymap.json")
.getPath(), Software.class,
EoscResult.class, Constants.DUMPTYPE.EOSC.getType());
JavaRDD<EoscResult> tmp3 = sc
.textFile(workingDir.toString() + "/soft2")
.map(item -> OBJECT_MAPPER.readValue(item, EoscResult.class));
System.out.println(OBJECT_MAPPER.writeValueAsString(tmp3.first()));
dump
.run(
false, getClass()
.getResource("/eu/dnetlib/dhp/oa/graph/dump/eosc/input/review202211/rohub")
.getPath(), workingDir.toString() + "/orp2", getClass()
.getResource("/eu/dnetlib/dhp/oa/graph/dump/communityMapPath/communitymap.json")
.getPath(), OtherResearchProduct.class,
EoscResult.class, Constants.DUMPTYPE.EOSC.getType());
JavaRDD<EoscResult> tmp4 = sc
.textFile(workingDir.toString() + "/orp2")
.map(item -> OBJECT_MAPPER.readValue(item, EoscResult.class));
System.out.println(OBJECT_MAPPER.writeValueAsString(tmp4.first()));
}
@Test
public void testArticlePCA() {
final String sourcePath = getClass()

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long