WIP: dump of the OpenAIRE graph - Changes #103
|
@ -5,18 +5,18 @@ import java.util.*;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import eu.dnetlib.dhp.schema.oaf.Project;
|
|
||||||
import org.junit.jupiter.api.Assertions;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
|
|
||||||
import eu.dnetlib.dhp.schema.common.ModelSupport;
|
import eu.dnetlib.dhp.schema.common.ModelSupport;
|
||||||
import eu.dnetlib.dhp.schema.dump.oaf.graph.Relation;
|
import eu.dnetlib.dhp.schema.dump.oaf.graph.Relation;
|
||||||
import eu.dnetlib.dhp.schema.oaf.Datasource;
|
import eu.dnetlib.dhp.schema.oaf.Datasource;
|
||||||
|
import eu.dnetlib.dhp.schema.oaf.Project;
|
||||||
import eu.dnetlib.dhp.utils.DHPUtils;
|
import eu.dnetlib.dhp.utils.DHPUtils;
|
||||||
|
|
||||||
public class CreateRelationTest {
|
public class CreateRelationTest {
|
||||||
|
@ -443,49 +443,57 @@ public class CreateRelationTest {
|
||||||
" <param name=\"creationdate\">2018-03-01T12:00:00</param>\n" +
|
" <param name=\"creationdate\">2018-03-01T12:00:00</param>\n" +
|
||||||
" <category claim=\"false\" id=\"elixir-gr::projects\" label=\"ELIXIR GR Projects\">\n" +
|
" <category claim=\"false\" id=\"elixir-gr::projects\" label=\"ELIXIR GR Projects\">\n" +
|
||||||
" <concept claim=\"false\" id=\"ni::projects::12\" label=\"\">\n" +
|
" <concept claim=\"false\" id=\"ni::projects::12\" label=\"\">\n" +
|
||||||
" <param name=\"projectfullname\">BIO-INFORMATICS RESEARCH NETWORK COORDINATING CENTER (BIRN-CC)</param>\n" +
|
" <param name=\"projectfullname\">BIO-INFORMATICS RESEARCH NETWORK COORDINATING CENTER (BIRN-CC)</param>\n"
|
||||||
|
+
|
||||||
" <param name=\"acronym\"/>\n" +
|
" <param name=\"acronym\"/>\n" +
|
||||||
" <param name=\"CD_PROJECT_NUMBER\">1U24RR025736-01</param>\n" +
|
" <param name=\"CD_PROJECT_NUMBER\">1U24RR025736-01</param>\n" +
|
||||||
" <param name=\"funder\">NIH</param>\n" +
|
" <param name=\"funder\">NIH</param>\n" +
|
||||||
" </concept>\n" +
|
" </concept>\n" +
|
||||||
" <concept claim=\"false\" id=\"ni::projects::13\" label=\"\">\n" +
|
" <concept claim=\"false\" id=\"ni::projects::13\" label=\"\">\n" +
|
||||||
" <param name=\"projectfullname\">COLLABORATIVE RESEARCH: The Cognitive Neuroscience of Category Learning</param>\n" +
|
" <param name=\"projectfullname\">COLLABORATIVE RESEARCH: The Cognitive Neuroscience of Category Learning</param>\n"
|
||||||
|
+
|
||||||
" <param name=\"acronym\"/>\n" +
|
" <param name=\"acronym\"/>\n" +
|
||||||
" <param name=\"CD_PROJECT_NUMBER\">0223843</param>\n" +
|
" <param name=\"CD_PROJECT_NUMBER\">0223843</param>\n" +
|
||||||
" <param name=\"funder\">NSF</param>\n" +
|
" <param name=\"funder\">NSF</param>\n" +
|
||||||
" </concept>\n" +
|
" </concept>\n" +
|
||||||
" <concept claim=\"false\" id=\"ni::projects::14\" label=\"\">\n" +
|
" <concept claim=\"false\" id=\"ni::projects::14\" label=\"\">\n" +
|
||||||
" <param name=\"projectfullname\">The Cognitive Atlas: Developing an Interdisciplinary Knowledge Base Through Socia</param>\n" +
|
" <param name=\"projectfullname\">The Cognitive Atlas: Developing an Interdisciplinary Knowledge Base Through Socia</param>\n"
|
||||||
|
+
|
||||||
" <param name=\"acronym\"/>\n" +
|
" <param name=\"acronym\"/>\n" +
|
||||||
" <param name=\"CD_PROJECT_NUMBER\">5R01MH082795-05</param>\n" +
|
" <param name=\"CD_PROJECT_NUMBER\">5R01MH082795-05</param>\n" +
|
||||||
" <param name=\"funder\">NIH</param>\n" +
|
" <param name=\"funder\">NIH</param>\n" +
|
||||||
" </concept>\n" +
|
" </concept>\n" +
|
||||||
" <concept claim=\"false\" id=\"ni::projects::15\" label=\"\">\n" +
|
" <concept claim=\"false\" id=\"ni::projects::15\" label=\"\">\n" +
|
||||||
" <param name=\"projectfullname\">Fragmented early life environmental and emotional / cognitive vulnerabilities</param>\n" +
|
" <param name=\"projectfullname\">Fragmented early life environmental and emotional / cognitive vulnerabilities</param>\n"
|
||||||
|
+
|
||||||
" <param name=\"acronym\"/>\n" +
|
" <param name=\"acronym\"/>\n" +
|
||||||
" <param name=\"CD_PROJECT_NUMBER\">1P50MH096889-01A1</param>\n" +
|
" <param name=\"CD_PROJECT_NUMBER\">1P50MH096889-01A1</param>\n" +
|
||||||
" <param name=\"funder\">NIH</param>\n" +
|
" <param name=\"funder\">NIH</param>\n" +
|
||||||
" </concept>\n" +
|
" </concept>\n" +
|
||||||
" <concept claim=\"false\" id=\"ni::projects::16\" label=\"\">\n" +
|
" <concept claim=\"false\" id=\"ni::projects::16\" label=\"\">\n" +
|
||||||
" <param name=\"projectfullname\">Enhancement of the 1000 Functional Connectome Project</param>\n" +
|
" <param name=\"projectfullname\">Enhancement of the 1000 Functional Connectome Project</param>\n"
|
||||||
|
+
|
||||||
" <param name=\"acronym\"/>\n" +
|
" <param name=\"acronym\"/>\n" +
|
||||||
" <param name=\"CD_PROJECT_NUMBER\">1R03MH096321-01A1</param>\n" +
|
" <param name=\"CD_PROJECT_NUMBER\">1R03MH096321-01A1</param>\n" +
|
||||||
" <param name=\"funder\">TUBITAK</param>\n" +
|
" <param name=\"funder\">TUBITAK</param>\n" +
|
||||||
" </concept>\n" +
|
" </concept>\n" +
|
||||||
" <concept claim=\"false\" id=\"ni::projects::17\" label=\"\">\n" +
|
" <concept claim=\"false\" id=\"ni::projects::17\" label=\"\">\n" +
|
||||||
" <param name=\"projectfullname\">CRCNS Data Sharing: An open data repository for cognitive neuroscience: The OpenfMRI Project</param>\n" +
|
" <param name=\"projectfullname\">CRCNS Data Sharing: An open data repository for cognitive neuroscience: The OpenfMRI Project</param>\n"
|
||||||
|
+
|
||||||
" <param name=\"acronym\"/>\n" +
|
" <param name=\"acronym\"/>\n" +
|
||||||
" <param name=\"CD_PROJECT_NUMBER\">1131441</param>\n" +
|
" <param name=\"CD_PROJECT_NUMBER\">1131441</param>\n" +
|
||||||
" <param name=\"funder\">NSF</param>\n" +
|
" <param name=\"funder\">NSF</param>\n" +
|
||||||
" </concept>\n" +
|
" </concept>\n" +
|
||||||
" <concept claim=\"false\" id=\"ni::projects::18\" label=\"\">\n" +
|
" <concept claim=\"false\" id=\"ni::projects::18\" label=\"\">\n" +
|
||||||
" <param name=\"projectfullname\">Enhancing Human Cortical Plasticity: Visual Psychophysics and fMRI</param>\n" +
|
" <param name=\"projectfullname\">Enhancing Human Cortical Plasticity: Visual Psychophysics and fMRI</param>\n"
|
||||||
|
+
|
||||||
" <param name=\"acronym\"/>\n" +
|
" <param name=\"acronym\"/>\n" +
|
||||||
" <param name=\"CD_PROJECT_NUMBER\">0121950</param>\n" +
|
" <param name=\"CD_PROJECT_NUMBER\">0121950</param>\n" +
|
||||||
" <param name=\"funder\">NSF</param>\n" +
|
" <param name=\"funder\">NSF</param>\n" +
|
||||||
" </concept>\n" +
|
" </concept>\n" +
|
||||||
" <concept claim=\"false\" id=\"ni::projects::18\" label=\"\">\n" +
|
" <concept claim=\"false\" id=\"ni::projects::18\" label=\"\">\n" +
|
||||||
" <param name=\"projectfullname\">Transforming statistical methodology for neuroimaging meta-analysis.</param>\n" +
|
" <param name=\"projectfullname\">Transforming statistical methodology for neuroimaging meta-analysis.</param>\n"
|
||||||
|
+
|
||||||
" <param name=\"acronym\"/>\n" +
|
" <param name=\"acronym\"/>\n" +
|
||||||
" <param name=\"CD_PROJECT_NUMBER\">100309</param>\n" +
|
" <param name=\"CD_PROJECT_NUMBER\">100309</param>\n" +
|
||||||
" <param name=\"funder\">WT</param>\n" +
|
" <param name=\"funder\">WT</param>\n" +
|
||||||
|
@ -631,12 +639,11 @@ public class CreateRelationTest {
|
||||||
|
|
||||||
cInfoList.forEach(c -> System.out.println(new Gson().toJson(c)));
|
cInfoList.forEach(c -> System.out.println(new Gson().toJson(c)));
|
||||||
|
|
||||||
|
|
||||||
List<Relation> rList = new ArrayList<>();
|
List<Relation> rList = new ArrayList<>();
|
||||||
|
|
||||||
cInfoList.forEach(cInfo -> Process.getRelation(cInfo).forEach(rList::add));
|
cInfoList.forEach(cInfo -> Process.getRelation(cInfo).forEach(rList::add));
|
||||||
|
|
||||||
Assertions.assertEquals(44 , rList.size());
|
Assertions.assertEquals(44, rList.size());
|
||||||
|
|
||||||
Assertions
|
Assertions
|
||||||
.assertFalse(
|
.assertFalse(
|
||||||
|
@ -705,10 +712,10 @@ public class CreateRelationTest {
|
||||||
Assertions
|
Assertions
|
||||||
.assertTrue(
|
.assertTrue(
|
||||||
tmp.contains("40|corda__h2020::b5a4eb56bf84bef2ebc193306b4d423f") &&
|
tmp.contains("40|corda__h2020::b5a4eb56bf84bef2ebc193306b4d423f") &&
|
||||||
tmp.contains("40|corda_______::ef782b2d85676aa3e5a907427feb18c4") );
|
tmp.contains("40|corda_______::ef782b2d85676aa3e5a907427feb18c4"));
|
||||||
|
|
||||||
rList.forEach(rel -> {
|
rList.forEach(rel -> {
|
||||||
if (rel.getSource().getId().startsWith("40|")){
|
if (rel.getSource().getId().startsWith("40|")) {
|
||||||
String proj = rel.getSource().getId().substring(3);
|
String proj = rel.getSource().getId().substring(3);
|
||||||
Assertions.assertTrue(proj.substring(0, proj.indexOf("::")).length() == 12);
|
Assertions.assertTrue(proj.substring(0, proj.indexOf("::")).length() == 12);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue