rule out records with NULL dataInfo

This commit is contained in:
Claudio Atzori 2023-07-31 12:35:05 +02:00
parent 1275a07d45
commit 11ffb9bd68
3 changed files with 11 additions and 1 deletions

View File

@ -239,7 +239,7 @@ public class GraphCleaningFunctions extends CleaningFunctions {
d -> Optional d -> Optional
.ofNullable(d.getInvisible()) .ofNullable(d.getInvisible())
.orElse(true)) .orElse(true))
.orElse(true)) .orElse(false))
.orElse(true))) { .orElse(true))) {
return true; return true;
} }

View File

@ -337,6 +337,15 @@ public class GraphCleaningFunctionsTest {
Assertions.assertEquals(true, GraphCleaningFunctions.filter(cleaned)); Assertions.assertEquals(true, GraphCleaningFunctions.filter(cleaned));
} }
@Test
public void testFilterProject() throws IOException {
String json = IOUtils
.toString(getClass().getResourceAsStream("/eu/dnetlib/dhp/oa/graph/clean/project.json"));
Project p_in = MAPPER.readValue(json, Project.class);
Assertions.assertEquals(false, GraphCleaningFunctions.filter(p_in));
}
@Test @Test
public void testCleanDoiBoost2() throws IOException { public void testCleanDoiBoost2() throws IOException {
String json = IOUtils String json = IOUtils

View File

@ -0,0 +1 @@
{"measures": [{"id": "downloads", "unit": [{"dataInfo": {"provenanceaction": {"classid": "measure:usage_counts", "classname": "measure:usage_counts", "schemeid": "dnet:provenanceActions", "schemename": "dnet:provenanceActions"}, "deletedbyinference": false, "inferred": true, "inferenceprovenance": "update", "invisible": false, "trust": ""}, "key": "count", "value": "1"}]}, {"id": "views", "unit": [{"dataInfo": {"provenanceaction": {"classid": "measure:usage_counts", "classname": "measure:usage_counts", "schemeid": "dnet:provenanceActions", "schemename": "dnet:provenanceActions"}, "deletedbyinference": false, "inferred": true, "inferenceprovenance": "update", "invisible": false, "trust": ""}, "key": "count", "value": "0"}]}], "id": "40|aka_________::591da07706352f1195afaeed4065f52e"}