diff --git a/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/CreateEntityTest.java b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/CreateEntityTest.java new file mode 100644 index 000000000..f3c7e6fdd --- /dev/null +++ b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/CreateEntityTest.java @@ -0,0 +1,113 @@ +package eu.dnetlib.dhp.oa.graph.dump.graph; + +import com.google.gson.Gson; + + +import eu.dnetlib.dhp.schema.dump.oaf.graph.ResearchCommunity; +import eu.dnetlib.dhp.schema.dump.oaf.graph.ResearchInitiative; +import eu.dnetlib.dhp.utils.DHPUtils; +import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException; +import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; +import java.util.function.Consumer; + +import static org.mockito.Mockito.lenient; + +@ExtendWith(MockitoExtension.class) +public class CreateEntityTest { + + private static final String XQUERY_ENTITY = "for $x in collection('/db/DRIVER/ContextDSResources/ContextDSResourceType') " + + + "where $x//context[./@type='community' or ./@type = 'ri'] and $x//context/param[./@name = 'status']/text() = 'all' return " + + + "concat(data($x//context/@id) , '@@', $x//context/param[./@name =\"name\"]/text(), '@@', " + + "$x//context/param[./@name=\"description\"]/text(), '@@', $x//context/param[./@name = \"subject\"]/text(), '@@', " + + + "$x//context/param[./@name = \"zenodoCommunity\"]/text(), '@@', $x//context/@type)"; + + List communityMap = Arrays + .asList( + "clarin@@Common Language Resources and Technology Infrastructure@@CLARIN@@@@oac_clarin@@ri", + "ee@@Sustainable Development Solutions Network - Greece@@The UN Sustainable Development Solutions Network (SDSN) has been operating since 2012 under the auspices of the UN Secretary-General. " + + "SDSN mobilizes global scientific and technological expertise to promote practical solutions for sustainable development, including the implementation of the Sustainable Development Goals (SDGs) and the Paris Climate Agreement. The Greek hub of SDSN has been included in the SDSN network in 2017 and is co-hosted by ICRE8: International Center for Research on the Environment and the Economy and the Political Economy of Sustainable Development Lab.@@SDG13 - Climate action,SDG8 - Decent work and economic growth,SDG15 - " + + "Life on land,SDG2 - Zero hunger,SDG17 - Partnerships for the ´goals,SDG10 - Reduced inequalities,SDG5 - Gender equality,SDG12 - Responsible consumption and production,SDG14 - Life below water,SDG6 - Clean water and sanitation,SDG11 - Sustainable cities and communities,SDG1 - No poverty,SDG3 - Good health and well being,SDG7 - Affordable and clean energy,SDG4 - Quality education,SDG9 - Industry innovation and infrastructure,SDG16 - Peace justice and strong institutions@@oac_sdsn-greece@@community", + "dh-ch@@Digital Humanities and Cultural Heritage@@This community gathers research results, data, scientific publications and projects related to the domain of Digital Humanities. This broad definition includes Humanities, Cultural Heritage, History, Archaeology and related fields.@@modern art,monuments,europeana data model,sites,field walking,frescoes,LIDO metadata schema,art history,excavation,Arts and Humanities General,cities,coins,temples,numismatics,lithics,roads,environmental archaeology,digital cultural heritage,archaeological reports,history,CRMba,churches,cultural heritage,archaeological stratigraphy,religious art,buidings,digital humanities,survey,archaeological sites,linguistic studies,bioarchaeology,architectural orders,palaeoanthropology,fine arts,europeana,CIDOC CRM,decorations,classic art,stratigraphy,digital archaeology,intangible cultural heritage,walls,humanities,chapels,CRMtex,Language and Literature,paintings,archaeology,fair data,mosaics,burials,architecture,medieval art,castles,CARARE metadata schema,statues,natural language processing,inscriptions,CRMsci,vaults,contemporary art,Arts and Humanities,CRMarchaeo,pottery,site,architectural,vessels@@oac_dh-ch@@community", + "fam@@Fisheries and Aquaculture Management@@Conservation of marine resources for sustainable development. The Fisheries and Aquaculture community focus on resources (document, data, codes..) which have been produced in the framework of projects (H2020, FP7, ..) related to the domain of fisheries and aquaculture.@@Stock Assessment,pelagic,Acoustic,Fish farming,Fisheries,Fishermen,maximum sustainable yield,trawler,Fishing vessel,Fisherman,Fishing gear,mackerel,RFMO,Fish Aggregating Device,Bycatch,Fishery,common fisheries policy,Fishing fleet,Aquaculture@@fisheries@@community", + "ni@@Neuroinformatics@@The neuroinformatics dashboard gathers research outputs from the 'neuroinformatics' community at large including the fields of: neuroscience, neuroinformatics, brain imaging databases and standards, brain imaging techniques, neuroimaging methods including statistics and machine learning. The dashboard covers a wide range of imaging methods including (but not limited to): MRI, TEP, EEG, MEG, and studies involving human participants as well as animal studies.@@brain mapping,brain imaging,electroencephalography,arterial spin labelling,brain fingerprinting,brain,neuroimaging,Multimodal Brain Image Analysis,fMRI,neuroinformatics,fetal brain,brain ultrasonic imaging,topographic brain mapping,diffusion tensor imaging,computerized knowledge assessment,connectome mapping,brain magnetic resonance imaging,brain abnormalities@@oac_ni@@community", + "mes@@European Marine Science@@This community was initially defined to include a very broad range of topics, with the intention to generate a number of more focused and sustainable dashboards for research communities and initiatives. As outlined in the logo of this community, we intend to setup a community dashboard for EuroMarine (a consortium of 56 research and academic organisations) and monitoring dashboards for marine research initiatives, including infrastructures (e.g. EMBRC & EMSO), advisory boards (e.g. Marine Boards & ICES), and transnational funding bodies (e.g. JPI-Oceans and Tara Foundation).@@marine,ocean,fish,aqua,sea@@oac_mes@@community", + "instruct@@Instruct-ERIC@@Instruct-ERIC is the European Research Infrastructure for Structural Biology@@@@oac_instruct@@community", + "elixir-gr@@The Greek National Node of the ESFRI European RI ELIXIR@@ELIXIR-GR enhances the potential of the Greek bioinformatics community to offer open, easily accessible and state -of- the- art services to the Greek and the international academic community and other stakeholders, such as industry and the health sector. More importantly, by providing these services, the infrastructure facilitates discoveries in the field of the life-sciences, having strong spill over effects in promoting innovation in sectors such as discovery of new drug targets and development of novel therapeutic agents, development of innovative diagnostics, personalized medicine, and development of innovative biotechnological products and processes.@@@@oaa_elixir-gr@@ri", + "aginfra@@Agricultural and Food Sciences@@The scope of this community is to provide access to publications, research data, projects and software that are related to agricultural and food sciences@@animal production and health,fisheries and aquaculture,food safety and human nutrition,information management,food technology,agri-food education and extension,natural resources and environment,food system,engineering technology and Research,agriculture,food safety risk assessment,food security,farming practices and systems,plant production and protection,agri-food economics and policy,Agri-food,food distribution,forestry@@oac_aginfra@@community", + "dariah@@DARIAH EU@@The Digital Research Infrastructure for the Arts and Humanities (DARIAH) aims to enhance and support digitally-enabled research and teaching across the arts and humanities. It develops, maintains and operates an infrastructure in support of ICT-based research practices and sustains researchers in using them to build, analyse and interpret digital resources. DARIAH was established as a European Research Infrastructure Consortium (ERIC) in August 2014. Currently, DARIAH has 18 Members and several cooperating partners in eight non-member countries. Here you will find a growing collection of DARIAH-affiliated research outputs and other documents. @@@@dariah@@ri", + "epos@@European Plate Observing System@@EPOS, the European Plate Observing System, is a long-term plan to facilitate integrated use of data, data products, and facilities from distributed research infrastructures for solid Earth science in Europe.@@@@@@ri", + "covid-19@@Corona Virus Disease@@This portal provides access to publications, research data, projects and software that may be relevant to the Corona Virus Disease (COVID-19). The OpenAIRE COVID-19 Gateway aggregates COVID-19 related records, links them and provides a single access point for discovery and navigation. We tag content from the OpenAIRE Research Graph (10,000+ data sources) and additional sources. All COVID-19 related research results are linked to people, organizations and projects, providing a contextualized navigation.@@COVID19,SARS-CoV,HCoV-19,mesh:C000657245,MERS-CoV,Síndrome Respiratorio Agudo Severo,mesh:COVID-19,COVID2019,COVID-19,SARS-CoV-2,2019 novel coronavirus,severe acute respiratory syndrome coronavirus 2,Orthocoronavirinae,Coronaviridae,mesh:D045169,coronavirus,SARS,coronaviruses,coronavirus disease-19,sars cov 2,Middle East Respiratory Syndrome,Severe acute respiratory syndrome coronavirus 2,Severe Acute Respiratory Syndrome,coronavirus disease 2019,2019-nCoV@@covid-19@@community"); + + + @Mock + private ISLookUpService isLookUpService; + + private QueryInformationSystem queryInformationSystem; + + private Map map; + + @BeforeEach + public void setUp() throws ISLookUpException { + lenient().when(isLookUpService.quickSearchProfile(XQUERY_ENTITY)).thenReturn(communityMap); + queryInformationSystem = new QueryInformationSystem(); + queryInformationSystem.setIsLookUp(isLookUpService); + } + + @Test + public void test1() throws ISLookUpException, IOException { + List cInfoList = new ArrayList<>(); + final Consumer consumer = ci -> cInfoList.add(ci); + queryInformationSystem.getContextInformation(consumer); + + List riList = new ArrayList<>(); + cInfoList.forEach(cInfo -> riList.add(Process.getEntity(cInfo))); + + Assertions.assertEquals(12, riList.size()); + + riList.stream().forEach(c -> { + switch (c.getOriginalId()){ + case "mes": + Assertions.assertTrue(c.getType().equals(eu.dnetlib.dhp.oa.graph.dump.Constants.RESEARCH_COMMUNITY)); + Assertions.assertTrue(((ResearchCommunity)c).getSubject().size() == 5); + Assertions.assertTrue(((ResearchCommunity)c).getSubject().contains("marine")); + Assertions.assertTrue(((ResearchCommunity)c).getSubject().contains("ocean")); + Assertions.assertTrue(((ResearchCommunity)c).getSubject().contains("fish")); + Assertions.assertTrue(((ResearchCommunity)c).getSubject().contains("aqua")); + Assertions.assertTrue(((ResearchCommunity)c).getSubject().contains("sea")); + Assertions.assertTrue(c.getId().equals(String.format("%s|%s::%s", Constants.CONTEXT_ID, Constants.CONTEXT_NS_PREFIX, + DHPUtils.md5(c.getOriginalId())))); + Assertions.assertTrue(c.getZenodo_community().equals("https://zenodo.org/communities/oac_mes")); + Assertions.assertTrue("mes".equals(c.getOriginalId())); + break; + case "clarin": + Assertions.assertTrue(c.getType().equals(eu.dnetlib.dhp.oa.graph.dump.Constants.RESEARCH_INFRASTRUCTURE)); + Assertions.assertTrue(c.getId().equals(String.format("%s|%s::%s", Constants.CONTEXT_ID, Constants.CONTEXT_NS_PREFIX, + DHPUtils.md5(c.getOriginalId())))); + Assertions.assertTrue(c.getZenodo_community().equals("https://zenodo.org/communities/oac_clarin")); + Assertions.assertTrue("clarin".equals(c.getOriginalId())); + break; + } + //TODO add check for all the others Entities + + + }); + + + riList.forEach(c -> System.out.println(new Gson().toJson(c))); + } +} diff --git a/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/CreateRelationTest.java b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/CreateRelationTest.java new file mode 100644 index 000000000..7d8265402 --- /dev/null +++ b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/CreateRelationTest.java @@ -0,0 +1,451 @@ +package eu.dnetlib.dhp.oa.graph.dump.graph; + +import com.google.gson.Gson; +import eu.dnetlib.dhp.schema.common.ModelSupport; + +import eu.dnetlib.dhp.schema.dump.oaf.graph.Relation; + +import eu.dnetlib.dhp.schema.oaf.Datasource; + +import eu.dnetlib.dhp.utils.DHPUtils; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import java.util.*; +import java.util.function.Consumer; +import java.util.stream.Collectors; + + +public class CreateRelationTest { + + + List communityContext = Arrays.asList("\n" + + " all\n" + + " CLARIN\n" + + " https://www.clarin.eu/sites/default/files/clarin-frontpage-logo.jpg\n" + + " Common Language Resources and Technology Infrastructure\n" + + " maria@clarin.eu,dieter@clarin.eu,f.m.g.dejong@uu.nl,paolo.manghi@isti.cnr.it\n" + + " \n" + + " (Part of) the work reported here was made possible by using the CLARIN infrastructure.\n" + + " The work reported here has received funding through <CLARIN national consortium member, e.g. CLARIN.SI>, <XYZ> project, grant no. <XYZ>.\n" + + " The work reported here has received funding (through CLARIN ERIC) from the European Union’s Horizon 2020 research and innovation programme under grant agreement No <0-9> for project <XYZ>.\n" + + " (E.g. No 676529 for project CLARIN-PLUS.)\n" + + " oac_clarin\n" + + " 2018-03-01T12:00:00\n" + + " \n" + + " \n" + + " CLARIN-PLUS\n" + + " \n" + + " \n" + + " 676529\n" + + " http://www.clarin.eu\n" + + " EC\n" + + " H2020-INFRADEV-1-2015-1\n" + + " CLARIN+\n" + + " \n" + + " \n" + + " Common Language Resources and Technology Infrastructure\n" + + " CLARIN\n" + + " 212230\n" + + " EC\n" + + " corda_______::ef782b2d85676aa3e5a907427feb18c4\n" + + " \n" + + " \n" + + " " + + "\n" + + " \n" + + " LINDAT/CLARIN repository\n" + + " LINDAT/CLARIN repository\n" + + " true\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " CLARIN-D\n" + + " https://www.clarin-d.de/en/\n" + + " \n" + + " http://www.lrec-conf.org/proceedings/lrec2018/pdf/504.pdf\n" + + " Germany\n" + + " \n" + + " \n" + + " \n" + + " \n" + + "", + "\n" + + " all\n" + + " This community gathers research results, data, scientific publications and projects related to the domain of Digital Humanities. This broad definition includes Humanities, Cultural Heritage, History, Archaeology and related fields.\n" + + " http://sanmamante.org/DH_CH_logo.png\n" + + " Digital Humanities and Cultural Heritage\n" + + " ileniagalluccio87@gmail.com,achille.felicetti@gmail.com,paolo.manghi@isti.cnr.it,tim.evans@york.ac.uk\n" + + " modern art,monuments,europeana data model,sites,field walking,frescoes,LIDO metadata schema,art history,excavation,Arts and Humanities General,cities,coins,temples,numismatics,lithics,roads,environmental archaeology,digital cultural heritage,archaeological reports,history,CRMba,churches,cultural heritage,archaeological stratigraphy,religious art,buidings,digital humanities,survey,archaeological sites,linguistic studies,bioarchaeology,architectural orders,palaeoanthropology,fine arts,europeana,CIDOC CRM,decorations,classic art,stratigraphy,digital archaeology,intangible cultural heritage,walls,humanities,chapels,CRMtex,Language and Literature,paintings,archaeology,fair data,mosaics,burials,architecture,medieval art,castles,CARARE metadata schema,statues,natural language processing,inscriptions,CRMsci,vaults,contemporary art,Arts and Humanities,CRMarchaeo,pottery,site,architectural,vessels\n" + + " The present work has been partially supported by the PARTHENOS project, funded by the European Commission (Grant Agreement No. 654119) under the HORIZON 2020 - INFRADEV-4-2014/2015 call\n" + + " oac_dh-ch\n" + + " 2018-03-01T12:00:00\n" + + " \n" + + " \n" + + " Pooling Activities, Resources and Tools for Heritage E-research Networking, Optimization and Synergies\n" + + " The present work has been partially supported by the PARTHENOS project, funded by the European Commission (Grant Agreement No. 654119) under the HORIZON 2020 - INFRADEV-4-2014/2015 call\n" + + " \n" + + " 654119\n" + + " http://www.parthenos-project.eu\n" + + " EC\n" + + " PARTHENOS\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " re3data_____::9ebe127e5f3a0bf401875690f3bb6b81\n" + + " The UK's largest collection of digital research data in the social sciences and humanities\n" + + " UK Data Archive\n" + + " true\n" + + " \n" + + " \n" + + " doajarticles::c6cd4b532e12868c1d760a8d7cda6815\n" + + " Journal of Data Mining and Digital Humanities\n" + + " Journal of Data Mining and Digital Humanities\n" + + " true\n" + + " \n" + + " \n" + + " doajarticles::a6de4499bb87bf3c01add0a9e2c9ed0b\n" + + " Frontiers in Digital Humanities\n" + + " Frontiers in Digital Humanities\n" + + " true\n" + + " \n" + + " \n" + + " doajarticles::6eb31d13b12bc06bbac06aef63cf33c9\n" + + " Il Capitale Culturale: Studies on the Value of Cultural Heritage\n" + + " Il Capitale Culturale: Studies on the Value of Cultural Heritage\n" + + " true\n" + + " \n" + + " \n" + + " doajarticles::0da84e9dfdc8419576169e027baa8028\n" + + " Conservation Science in Cultural Heritage\n" + + " Conservation Science in Cultural Heritage\n" + + " true\n" + + " \n" + + " \n" + + " re3data_____::84e123776089ce3c7a33db98d9cd15a8\n" + + " Electronic Archiving System\n" + + " EASY\n" + + " true\n" + + " \n" + + " \n" + + " openaire____::c5502a43e76feab55dd00cf50f519125\n" + + " DANS-KB Harvester\n" + + " Gemeenschappelijke Harvester DANS-KB\n" + + " true\n" + + " \n" + + " \n" + + " re3data_____::a48f09c562b247a9919acfe195549b47\n" + + " ads\n" + + " Archaeology Data Service\n" + + " true\n" + + " \n" + + " \n" + + " opendoar____::97275a23ca44226c9964043c8462be96\n" + + " KNAW Repository\n" + + " KNAW Repository\n" + + " true\n" + + " \n" + + " \n" + + " doajarticles::2899208a99aa7d142646e0a80bfeef05\n" + + " Internet Archaeology\n" + + " Internet Archaeology\n" + + " true\n" + + " \n" + + " \n" + + " \n" + + "\n" , + "\n" + + " all\n" + + " The neuroinformatics dashboard gathers research outputs from the 'neuroinformatics' community at large including the fields of: neuroscience, neuroinformatics, brain imaging databases and standards, brain imaging techniques, neuroimaging methods including statistics and machine learning. The dashboard covers a wide range of imaging methods including (but not limited to): MRI, TEP, EEG, MEG, and studies involving human participants as well as animal studies.\n" + + " https://docs.google.com/drawings/u/0/d/10e191xGoGf4uaRluMqbt_7cCj6LSCs2a29im4CmWjqU/export/png\n" + + " Neuroinformatics\n" + + " sorina.pop@creatis.insa-lyon.fr,camille.maumet@inria.fr,christian.barillot@irisa.fr,xavier.rolland@irisa.fr,axel.bonnet@creatis.insa-lyon.fr,paolo.manghi@isti.cnr.it\n" + + " brain mapping,brain imaging,electroencephalography,arterial spin labelling,brain fingerprinting,brain,neuroimaging,Multimodal Brain Image Analysis,fMRI,neuroinformatics,fetal brain,brain ultrasonic imaging,topographic brain mapping,diffusion tensor imaging,computerized knowledge assessment,connectome mapping,brain magnetic resonance imaging,brain abnormalities\n" + + " \n" + + " oac_ni\n" + + " 2018-03-01T12:00:00\n" + + " \n" + + " \n" + + " re3data_____::5b9bf9171d92df854cf3c520692e9122\n" + + " Formerly:OpenFMRI\n" + + " OpenNeuro\n" + + " true\n" + + " \n" + + " \n" + + " doajarticles::c7d3de67dc77af72f6747157441252ec\n" + + " Research Ideas and Outcomes\n" + + " Research Ideas and Outcomes\n" + + " true\n" + + " \n" + + " \n" + + " re3data_____::8515794670370f49c1d176c399c714f5\n" + + " Neuroimaging Informatics Tools and Resources Clearinghouse\n" + + " NITRC\n" + + " true\n" + + " \n" + + " \n" + + " doajarticles::d640648c84b10d425f96f11c3de468f3\n" + + " Frontiers in Neuroinformatics\n" + + " Frontiers in Neuroinformatics\n" + + " true\n" + + " \n" + + " \n" + + " doajarticles::0c0e74daa5d95504eade9c81ebbd5b8a\n" + + " NeuroImage: Clinical\n" + + " NeuroImage: Clinical\n" + + " true\n" + + " \n" + + " \n" + + " rest________::fb1a3d4523c95e63496e3bc7ba36244b\n" + + " NeuroVault\n" + + " NeuroVault\n" + + " true\n" + + " \n" + + " \n" + + "\n" , + "\n" + + " all\n" + + " Instruct-ERIC is the European Research Infrastructure for Structural Biology\n" + + " https://instruct-eric.eu/templates/instructeric/images/logos/instruct-eric-logo-noline.png\n" + + " Instruct-ERIC\n" + + " claudia@instruct-eric.eu,carazo@cnb.csic.es,echrysina@eie.gr,susan@instruct-eric.eu,naomi@instruct-eric.eu,natalie@instruct-eric.eu,pmarie@igbmc.fr,darren.hart@ibs.fr,claudia@strubi.ox.ac.uk,paolo.manghi@isti.cnr.it\n" + + " \n" + + " The authors acknowledge the support and the use of resources of Instruct-ERIC.\n" + + " The authors acknowledge the support and the use of resources of Instruct (PID # or APPID #), a Landmark ESFRI project\n" + + " oac_instruct\n" + + " 2018-03-01T12:00:00\n" + + " \n" + + " \n" + + " Authentication and Authorisation For Research and Collaboration\n" + + " \n" + + " 730941\n" + + " \n" + + " H2020-EINFRA-2016-1\n" + + " AARC2\n" + + " EC\n" + + " \n" + + " \n" + + " Building data bridges between biological and medical infrastructures in Europe\n" + + " \n" + + " 284209\n" + + " \n" + + " FP7-INFRASTRUCTURES-2011-1\n" + + " EC\n" + + " BioMedBridges\n" + + " \n" + + " \n" + + " Transnational access and enhancement of integrated Biological Structure determination at synchrotron X-ray radiation facilities\n" + + " \n" + + " 283570\n" + + " \n" + + " FP7-INFRASTRUCTURES-2011-1\n" + + " EC\n" + + " BioStruct-X\n" + + " \n" + + " \n" + + " Coordinated Research Infrastructures Building Enduring Life-science services\n" + + " \n" + + " 654248\n" + + " \n" + + " H2020-INFRADEV-1-2014-1\n" + + " EC\n" + + " CORBEL\n" + + " \n" + + " \n" + + " Infrastructure for NMR, EM and X-rays for translational research\n" + + " \n" + + " 653706\n" + + " \n" + + " H2020-INFRAIA-2014-2015\n" + + " EC\n" + + " iNEXT\n" + + " \n" + + " \n" + + " Integrated Structural Biology Infrastructure\n" + + " \n" + + " 211252\n" + + " \n" + + " FP7-INFRASTRUCTURES-2007-1\n" + + " EC\n" + + " INSTRUCT\n" + + " \n" + + " \n" + + " Releasing the full potential of Instruct to expand and consolidate infrastructure services for integrated structural life science research\n" + + " \n" + + " 731005\n" + + " \n" + + " H2020-INFRADEV-2016-1\n" + + " EC\n" + + " INSTRUCT-ULTRA\n" + + " \n" + + " \n" + + " Opening Synchrotron Light for Experimental Science and Applications in the Middle East\n" + + " \n" + + " 730943\n" + + " \n" + + " H2020-INFRASUPP-2016-1\n" + + " EC\n" + + " OPEN SESAME\n" + + " \n" + + " \n" + + " Infrastructure for Protein Production Platforms\n" + + " \n" + + " 227764\n" + + " \n" + + " FP7-INFRASTRUCTURES-2008-1\n" + + " EC\n" + + " PCUBE\n" + + " \n" + + " \n" + + " European Vaccine Research and Development Infrastructure\n" + + " \n" + + " 730964\n" + + " \n" + + " H2020-INFRAIA-2016-1\n" + + " EC\n" + + " TRAMSVAC2\n" + + " \n" + + " \n" + + " World-wide E-infrastructure for structural biology\n" + + " \n" + + " 675858\n" + + " \n" + + " H2020-EINFRA-2015-1\n" + + " EC\n" + + " West-Life\n" + + " \n" + + " \n" + + " Expanding research infrastructure visibility to strengthen strategic partnerships\n" + + " RI-VIS\n" + + " 824063\n" + + " EC\n" + + " corda__h2020::af93b591b76991d8437993a8f6fc6538\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " instruct\n" + + " \n" + + " \n" + + " \n" + + " west-life\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " FRISBI\n" + + " aHR0cDovL2ZyaXNiaS5ldS9zdGF0aWMvaW1hZ2VzL2xvZ29zL2xvZ28tZnJpc2JpLnBuZw==\n" + + " aHR0cDovL2ZyaXNiaS5ldS8=\n" + + " \n" + + " \n" + + " RI-VIS\n" + + " aHR0cHM6Ly9yaS12aXMuZXUvbmV0d29yay9yaXZpcy90ZW1wbGF0ZXMvcml2aXMvaW1hZ2VzL1JJLVZJU0xvZ29GaW5hbC0wNi5wbmc=\n" + + " aHR0cHM6Ly9yaS12aXMuZXU=\n" + + " \n" + + " \n" + + " CIISB\n" + + " aHR0cDovL2JpYy5jZWl0ZWMuY3ovZmlsZXMvMjkyLzEyNS5KUEc=\n" + + " aHR0cHM6Ly93d3cuY2lpc2Iub3Jn\n" + + " \n" + + " \n" + + "\n" , + "\n" + + " all\n" + + " ELIXIR-GR enhances the potential of the Greek bioinformatics community to offer open, easily accessible and state -of- the- art services to the Greek and the international academic community and other stakeholders, such as industry and the health sector. More importantly, by providing these services, the infrastructure facilitates discoveries in the field of the life-sciences, having strong spill over effects in promoting innovation in sectors such as discovery of new drug targets and development of novel therapeutic agents, development of innovative diagnostics, personalized medicine, and development of innovative biotechnological products and processes.\n" + + " https://elixir-greece.org/sites/default/files/ELIXIR_GREECE_white_background.png\n" + + " The Greek National Node of the ESFRI European RI ELIXIR\n" + + " vergoulis@imis.athena-innovation.gr,schatz@imis.athena-innovation.gr,paolo.manghi@isti.cnr.it\n" + + " \n" + + " \n" + + " oaa_elixir-gr\n" + + " 2018-03-01T12:00:00\n" + + " \n" + + " \n" + + " \n" + + " rest________::b8e502674c3c3499d5374e9b2ea6d8d5\n" + + " bio.tools\n" + + " bio.tools\n" + + " false\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " ATHENA RC\n" + + " aHR0cHM6Ly9lbGl4aXItZ3JlZWNlLm9yZy9zaXRlcy9kZWZhdWx0L2ZpbGVzL3N0eWxlcy90aHVtYm5haWwvcHVibGljL3BhcnRuZXJfbG9nb3MvYXRoZW5hX2xvZ28uanBnP2l0b2s9VXdGWFNpZng=\n" + + " aHR0cHM6Ly93d3cuYXRoZW5hLWlubm92YXRpb24uZ3IvZW4=\n" + + " \n" + + " \n" + + ""); + + private QueryInformationSystem queryInformationSystem; + + private Map map; + + @BeforeEach + public void setUp() { + + queryInformationSystem = new QueryInformationSystem(); + queryInformationSystem.setContextRelationResult(communityContext); + } + + @Test + public void test1(){ + List cInfoList = new ArrayList<>(); + final Consumer consumer = ci -> cInfoList.add(ci); + + queryInformationSystem.getContextRelation(consumer, "contentproviders", ModelSupport.getIdPrefix(Datasource.class)); + + + cInfoList.forEach(c -> System.out.println(new Gson().toJson(c))); + + List rList = new ArrayList<>(); + + + cInfoList.forEach(cInfo -> Process.getRelation(cInfo).forEach(rList::add)); + + Assertions.assertEquals(34, rList.size()); + + Assertions.assertTrue(rList.stream().map(r -> r.getSource().getId()).collect(Collectors.toSet()).contains( + String.format("%s|%s::%s", Constants.CONTEXT_ID, + Constants.CONTEXT_NS_PREFIX, + DHPUtils.md5("dh-ch")))); + + Assertions.assertEquals(10, rList.stream().filter(r->r.getSource().getId().equals(String.format("%s|%s::%s", Constants.CONTEXT_ID, + Constants.CONTEXT_NS_PREFIX, + DHPUtils.md5("dh-ch")))).collect(Collectors.toList()).size()); + + + Assertions.assertEquals(10, rList.stream().filter(r->r.getTarget().getId().equals(String.format("%s|%s::%s", Constants.CONTEXT_ID, + Constants.CONTEXT_NS_PREFIX, + DHPUtils.md5("dh-ch")))).collect(Collectors.toList()).size()); + + Set tmp = rList.stream().filter(r -> r.getSource().getId().equals(String.format("%s|%s::%s", Constants.CONTEXT_ID, + Constants.CONTEXT_NS_PREFIX, + DHPUtils.md5("dh-ch")))).map(r -> r.getTarget().getId()).collect(Collectors.toSet()); + + Assertions.assertTrue(tmp.contains("10|re3data_____::9ebe127e5f3a0bf401875690f3bb6b81") && + tmp.contains("10|doajarticles::c6cd4b532e12868c1d760a8d7cda6815") && + tmp.contains("10|doajarticles::a6de4499bb87bf3c01add0a9e2c9ed0b") && + tmp.contains("10|doajarticles::6eb31d13b12bc06bbac06aef63cf33c9") && + tmp.contains("10|doajarticles::0da84e9dfdc8419576169e027baa8028") && + tmp.contains("10|re3data_____::84e123776089ce3c7a33db98d9cd15a8") && + tmp.contains("10|openaire____::c5502a43e76feab55dd00cf50f519125") && + tmp.contains("10|re3data_____::a48f09c562b247a9919acfe195549b47") && + tmp.contains("10|opendoar____::97275a23ca44226c9964043c8462be96") && + tmp.contains("10|doajarticles::2899208a99aa7d142646e0a80bfeef05") ); + + + } +} diff --git a/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/DumpOrganizationProjectTest.java b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/DumpOrganizationProjectTest.java index 967573eba..053b5285c 100644 --- a/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/DumpOrganizationProjectTest.java +++ b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/DumpOrganizationProjectTest.java @@ -1,4 +1,121 @@ + package eu.dnetlib.dhp.oa.graph.dump.graph; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.HashMap; + +import org.apache.commons.io.FileUtils; +import org.apache.spark.SparkConf; +import org.apache.spark.api.java.JavaRDD; +import org.apache.spark.api.java.JavaSparkContext; +import org.apache.spark.sql.Encoders; +import org.apache.spark.sql.SparkSession; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import eu.dnetlib.dhp.schema.oaf.Organization; +import eu.dnetlib.dhp.schema.oaf.Project; + public class DumpOrganizationProjectTest { + + private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); + + private static SparkSession spark; + + private static Path workingDir; + + private static final Logger log = LoggerFactory + .getLogger(DumpOrganizationProjectTest.class); + + private static HashMap map = new HashMap<>(); + + @BeforeAll + public static void beforeAll() throws IOException { + workingDir = Files + .createTempDirectory(DumpOrganizationProjectTest.class.getSimpleName()); + log.info("using work dir {}", workingDir); + + SparkConf conf = new SparkConf(); + conf.setAppName(DumpOrganizationProjectTest.class.getSimpleName()); + + conf.setMaster("local[*]"); + conf.set("spark.driver.host", "localhost"); + conf.set("hive.metastore.local", "true"); + conf.set("spark.ui.enabled", "false"); + conf.set("spark.sql.warehouse.dir", workingDir.toString()); + conf.set("hive.metastore.warehouse.dir", workingDir.resolve("warehouse").toString()); + + spark = SparkSession + .builder() + .appName(DumpOrganizationProjectTest.class.getSimpleName()) + .config(conf) + .getOrCreate(); + } + + @AfterAll + public static void afterAll() throws IOException { + FileUtils.deleteDirectory(workingDir.toFile()); + spark.stop(); + } + + @Test + public void dumpOrganizationTest() throws Exception { + + final String sourcePath = getClass() + .getResource("/eu/dnetlib/dhp/oa/graph/dump/graph/organization") + .getPath(); + + DumpGraphEntities dg = new DumpGraphEntities(); + + dg.run(false, sourcePath, workingDir.toString() + "/dump", Organization.class, null); + + final JavaSparkContext sc = JavaSparkContext.fromSparkContext(spark.sparkContext()); + + JavaRDD tmp = sc + .textFile(workingDir.toString() + "/dump") + .map(item -> OBJECT_MAPPER.readValue(item, eu.dnetlib.dhp.schema.dump.oaf.graph.Organization.class)); + + org.apache.spark.sql.Dataset verificationDataset = spark + .createDataset(tmp.rdd(), Encoders.bean(eu.dnetlib.dhp.schema.dump.oaf.graph.Organization.class)); + + Assertions.assertEquals(34, verificationDataset.count()); + + verificationDataset.foreach(o -> System.out.println(OBJECT_MAPPER.writeValueAsString(o))); + + } + + @Test + public void dumpProjectTest() { + + final String sourcePath = getClass() + .getResource("/eu/dnetlib/dhp/oa/graph/dump/graph/project") + .getPath(); + + DumpGraphEntities dg = new DumpGraphEntities(); + + dg.run(false, sourcePath, workingDir.toString() + "/dump", Project.class, null); + + final JavaSparkContext sc = JavaSparkContext.fromSparkContext(spark.sparkContext()); + + JavaRDD tmp = sc + .textFile(workingDir.toString() + "/dump") + .map(item -> OBJECT_MAPPER.readValue(item, eu.dnetlib.dhp.schema.dump.oaf.graph.Project.class)); + + org.apache.spark.sql.Dataset verificationDataset = spark + .createDataset(tmp.rdd(), Encoders.bean(eu.dnetlib.dhp.schema.dump.oaf.graph.Project.class)); + + Assertions.assertEquals(12, verificationDataset.count()); + + verificationDataset.foreach(o -> System.out.println(OBJECT_MAPPER.writeValueAsString(o))); + + } + } diff --git a/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/DumpRelationTest.java b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/DumpRelationTest.java index 1f0328f2a..2ec352874 100644 --- a/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/DumpRelationTest.java +++ b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/DumpRelationTest.java @@ -1,4 +1,109 @@ package eu.dnetlib.dhp.oa.graph.dump.graph; +import com.fasterxml.jackson.databind.ObjectMapper; +import eu.dnetlib.dhp.schema.dump.oaf.graph.Relation; +import org.apache.commons.io.FileUtils; +import org.apache.spark.SparkConf; +import org.apache.spark.api.java.JavaRDD; +import org.apache.spark.api.java.JavaSparkContext; +import org.apache.spark.sql.Dataset; +import org.apache.spark.sql.Encoders; +import org.apache.spark.sql.Row; +import org.apache.spark.sql.SparkSession; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.HashMap; + public class DumpRelationTest { + + private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); + + private static SparkSession spark; + + private static Path workingDir; + + private static final Logger log = LoggerFactory + .getLogger(DumpRelationTest.class); + + private static HashMap map = new HashMap<>(); + + @BeforeAll + public static void beforeAll() throws IOException { + workingDir = Files + .createTempDirectory(DumpRelationTest.class.getSimpleName()); + log.info("using work dir {}", workingDir); + + SparkConf conf = new SparkConf(); + conf.setAppName(DumpRelationTest.class.getSimpleName()); + + conf.setMaster("local[*]"); + conf.set("spark.driver.host", "localhost"); + conf.set("hive.metastore.local", "true"); + conf.set("spark.ui.enabled", "false"); + conf.set("spark.sql.warehouse.dir", workingDir.toString()); + conf.set("hive.metastore.warehouse.dir", workingDir.resolve("warehouse").toString()); + + spark = SparkSession + .builder() + .appName(DumpRelationTest.class.getSimpleName()) + .config(conf) + .getOrCreate(); + } + + @AfterAll + public static void afterAll() throws IOException { + FileUtils.deleteDirectory(workingDir.toFile()); + spark.stop(); + } + + @Test + public void test1() throws Exception { + + final String sourcePath = getClass() + .getResource("/eu/dnetlib/dhp/oa/graph/dump/relation") + .getPath(); + + SparkDumpRelationJob.main(new String[] { + "-isSparkSessionManaged", Boolean.FALSE.toString(), + "-outputPath", workingDir.toString() + "/relation", + "-sourcePath", sourcePath + }); + +// dumpCommunityProducts.exec(MOCK_IS_LOOK_UP_URL,Boolean.FALSE, workingDir.toString()+"/dataset",sourcePath,"eu.dnetlib.dhp.schema.oaf.Dataset","eu.dnetlib.dhp.schema.dump.oaf.Dataset"); + + final JavaSparkContext sc = JavaSparkContext.fromSparkContext(spark.sparkContext()); + + JavaRDD tmp = sc + .textFile(workingDir.toString() + "/relation") + .map(item -> OBJECT_MAPPER.readValue(item, Relation.class)); + + org.apache.spark.sql.Dataset verificationDataset = spark + .createDataset(tmp.rdd(), Encoders.bean(Relation.class)); + + verificationDataset.createOrReplaceTempView("table"); + + Dataset check = spark.sql("SELECT reltype.name, source.id source, source.type stype, target.id target,target.type ttype, provenance.provenance " + + "from table "); + + Assertions.assertEquals(22, check.filter("name = 'isProvidedBy'").count()); + Assertions.assertEquals(22, check.filter("name = 'isProvidedBy' and stype = 'datasource' and ttype = 'organization' and " + + "provenance = 'Harvested'").count()); + + Assertions.assertEquals(7, check.filter("name = 'isParticipant'").count()); + Assertions.assertEquals(7, check.filter("name = 'isParticipant' and stype = 'organization' and ttype = 'project' " + + "and provenance = 'Harvested'").count()); + + Assertions.assertEquals(1, check.filter("name = 'isAuthorInstitutionOf'").count()); + Assertions.assertEquals(1, check.filter("name = 'isAuthorInstitutionOf' and stype = 'organization' and ttype = 'result' " + + "and provenance = 'Inferred by OpenAIRE'").count()); + } + } diff --git a/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/ExtractRelationFromEntityTest.java b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/ExtractRelationFromEntityTest.java new file mode 100644 index 000000000..99574d8b5 --- /dev/null +++ b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/ExtractRelationFromEntityTest.java @@ -0,0 +1,129 @@ +package eu.dnetlib.dhp.oa.graph.dump.graph; + +import com.fasterxml.jackson.databind.ObjectMapper; +import eu.dnetlib.dhp.oa.graph.dump.community.CommunityMap; +import eu.dnetlib.dhp.schema.dump.oaf.graph.Relation; +import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; +import org.apache.commons.io.FileUtils; +import org.apache.spark.SparkConf; +import org.apache.spark.api.java.JavaRDD; +import org.apache.spark.api.java.JavaSparkContext; +import org.apache.spark.sql.Dataset; +import org.apache.spark.sql.Encoders; +import org.apache.spark.sql.Row; +import org.apache.spark.sql.SparkSession; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.HashMap; + + +public class ExtractRelationFromEntityTest { + + private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper(); + + private static SparkSession spark; + + private static Path workingDir; + + private static final Logger log = LoggerFactory + .getLogger(ExtractRelationFromEntityTest.class); + + private static CommunityMap map = new CommunityMap(); + + static { + map.put("egi", "EGI Federation"); + map.put("fet-fp7", "FET FP7"); + map.put("fet-h2020", "FET H2020"); + map.put("clarin", "CLARIN"); + map.put("fam", "Fisheries and Aquaculture Management"); + map.put("ni", "Neuroinformatics"); + map.put("mes", "European Marine Scinece"); + map.put("instruct", "Instruct-Eric"); + map.put("rda", "Research Data Alliance"); + map.put("elixir-gr", "ELIXIR GR"); + map.put("aginfra", "Agricultural and Food Sciences"); + map.put("dariah", "DARIAH EU"); + map.put("risis", "RISI"); + map.put("ee", "SDSN - Greece"); + map.put("oa-pg", "EC Post-Grant Open Access Pilot"); + map.put("beopen", "Transport Research"); + map.put("euromarine", "Euromarine"); + map.put("ifremer", "Ifremer"); + map.put("dh-ch", "Digital Humanities and Cultural Heritage"); + map.put("science-innovation-policy", "Science and Innovation Policy Studies"); + map.put("covid-19", "COVID-19"); + map.put("enrmaps", "Energy Research"); + map.put("epos", "EPOS"); + + } + + + + @BeforeAll + public static void beforeAll() throws IOException { + workingDir = Files + .createTempDirectory(ExtractRelationFromEntityTest.class.getSimpleName()); + log.info("using work dir {}", workingDir); + + SparkConf conf = new SparkConf(); + conf.setAppName(ExtractRelationFromEntityTest.class.getSimpleName()); + + conf.setMaster("local[*]"); + conf.set("spark.driver.host", "localhost"); + conf.set("hive.metastore.local", "true"); + conf.set("spark.ui.enabled", "false"); + conf.set("spark.sql.warehouse.dir", workingDir.toString()); + conf.set("hive.metastore.warehouse.dir", workingDir.resolve("warehouse").toString()); + + spark = SparkSession + .builder() + .appName(ExtractRelationFromEntityTest.class.getSimpleName()) + .config(conf) + .getOrCreate(); + } + + @AfterAll + public static void afterAll() throws IOException { + FileUtils.deleteDirectory(workingDir.toFile()); + spark.stop(); + } + + @Test + public void test1() { + + final String sourcePath = getClass() + .getResource("/eu/dnetlib/dhp/oa/graph/dump/resultDump/singelRecord_pub.json") + .getPath(); + + Extractor ex = new Extractor(); + ex.run(false, sourcePath, workingDir.toString() + "/relation", + eu.dnetlib.dhp.schema.oaf.Publication.class, map); + + final JavaSparkContext sc = JavaSparkContext.fromSparkContext(spark.sparkContext()); + + JavaRDD tmp = sc + .textFile(workingDir.toString() + "/relation") + .map(item -> OBJECT_MAPPER.readValue(item, Relation.class)); + + org.apache.spark.sql.Dataset verificationDataset = spark + .createDataset(tmp.rdd(), Encoders.bean(Relation.class)); + + Assertions.assertEquals(9, verificationDataset.filter("source.id = '50|dedup_wf_001::15270b996fa8fd2fb5723daeab3685c3'").count()); + + Assertions.assertEquals(9, verificationDataset.filter("source.id = '50|dedup_wf_001::15270b996fa8fd2fb5723daxab3685c3'").count()); + + + } + +} diff --git a/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/FunderParsingTest.java b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/FunderParsingTest.java index 80519d7ac..2d925abd4 100644 --- a/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/FunderParsingTest.java +++ b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/FunderParsingTest.java @@ -1,4 +1,65 @@ + package eu.dnetlib.dhp.oa.graph.dump.graph; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; + +import eu.dnetlib.dhp.schema.dump.oaf.graph.Funder; + public class FunderParsingTest { + + @Test + public void testFunderTwoLevels() { + + String funding_Stream = "nsf_________::NSFNSFNational Science " + + + "FoundationUSnsf_________::NSF::CISE/OAD::CISE/CCFDivision " + + + "of Computing and Communication FoundationsDivision of Computing and Communication " + + "Foundationsnsf_________::NSF::CISE/OADDirectorate for " + + + "Computer & Information Science & EngineeringDirectorate for Computer & " + + "Information Science & Engineeringnsf:fundingStream"; + + Funder f = DumpGraphEntities.getFunder(funding_Stream); + + Assertions.assertEquals("NSF", f.getShortName()); + Assertions.assertEquals("National Science Foundation", f.getName()); + Assertions.assertEquals("US", f.getJurisdiction()); + + Assertions.assertEquals("NSF::CISE/OAD::CISE/CCF", f.getFunding_stream().getId()); + Assertions.assertEquals("Directorate for Computer & Information Science & Engineering - Division of Computing and Communication Foundations", + f.getFunding_stream().getDescription()); + + } + + @Test + public void testFunderThreeeLevels() { + String funding_stream = "ec__________::EC" + + "EC" + + "European Commission" + + "EU" + + "" + + "ec__________::EC::H2020::ERC::ERC-COG" + + "Consolidator Grant" + + "ERC-COGec:h2020toas" + + "ec__________::EC::H2020::ERC" + + "European Research Council" + + "ERCec:h2020fundings" + + "ec__________::EC::H2020H2020" + + "Horizon 2020 Framework Programme" + + "ec:h2020fundings"; + + Funder f = DumpGraphEntities.getFunder(funding_stream); + + Assertions.assertEquals("EC", f.getShortName()); + Assertions.assertEquals("European Commission", f.getName()); + Assertions.assertEquals("EU", f.getJurisdiction()); + + Assertions.assertEquals("EC::H2020::ERC::ERC-COG", f.getFunding_stream().getId()); + Assertions.assertEquals("Horizon 2020 Framework Programme - European Research Council - Consolidator Grant", + f.getFunding_stream().getDescription()); + + + } } diff --git a/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/QueryInformationSystemTest.java b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/QueryInformationSystemTest.java index b93226c45..46739fdbf 100644 --- a/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/QueryInformationSystemTest.java +++ b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/QueryInformationSystemTest.java @@ -1,4 +1,638 @@ package eu.dnetlib.dhp.oa.graph.dump.graph; +import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpException; +import eu.dnetlib.enabling.is.lookup.rmi.ISLookUpService; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; + +import java.util.*; +import java.util.function.Consumer; +import static org.mockito.Mockito.lenient; + +@ExtendWith(MockitoExtension.class) public class QueryInformationSystemTest { + + private static final String XQUERY = "for $x in collection('/db/DRIVER/ContextDSResources/ContextDSResourceType') " + + + " where $x//CONFIGURATION/context[./@type='community' or ./@type='ri'] " + + " and $x//context/param[./@name = 'status']/text() = 'all' " + + " return " + + "$x//context"; + + private static final String XQUERY_ENTITY = "for $x in collection('/db/DRIVER/ContextDSResources/ContextDSResourceType') " + + + "where $x//context[./@type='community' or ./@type = 'ri'] and $x//context/param[./@name = 'status']/text() = 'all' return " + + + "concat(data($x//context/@id) , '@@', $x//context/param[./@name =\"name\"]/text(), '@@', " + + "$x//context/param[./@name=\"description\"]/text(), '@@', $x//context/param[./@name = \"subject\"]/text(), '@@', " + + + "$x//context/param[./@name = \"zenodoCommunity\"]/text(), '@@', $x//context/@type)"; + + List communityMap = Arrays + .asList( + "clarin@@Common Language Resources and Technology Infrastructure@@CLARIN@@@@oac_clarin@@ri", + "ee@@Sustainable Development Solutions Network - Greece@@The UN Sustainable Development Solutions Network (SDSN) has been operating since 2012 under the auspices of the UN Secretary-General. " + + "SDSN mobilizes global scientific and technological expertise to promote practical solutions for sustainable development, including the implementation of the Sustainable Development Goals (SDGs) and the Paris Climate Agreement. The Greek hub of SDSN has been included in the SDSN network in 2017 and is co-hosted by ICRE8: International Center for Research on the Environment and the Economy and the Political Economy of Sustainable Development Lab.@@SDG13 - Climate action,SDG8 - Decent work and economic growth,SDG15 - " + + "Life on land,SDG2 - Zero hunger,SDG17 - Partnerships for the ´goals,SDG10 - Reduced inequalities,SDG5 - Gender equality,SDG12 - Responsible consumption and production,SDG14 - Life below water,SDG6 - Clean water and sanitation,SDG11 - Sustainable cities and communities,SDG1 - No poverty,SDG3 - Good health and well being,SDG7 - Affordable and clean energy,SDG4 - Quality education,SDG9 - Industry innovation and infrastructure,SDG16 - Peace justice and strong institutions@@oac_sdsn-greece@@community", + "dh-ch@@Digital Humanities and Cultural Heritage@@This community gathers research results, data, scientific publications and projects related to the domain of Digital Humanities. This broad definition includes Humanities, Cultural Heritage, History, Archaeology and related fields.@@modern art,monuments,europeana data model,sites,field walking,frescoes,LIDO metadata schema,art history,excavation,Arts and Humanities General,cities,coins,temples,numismatics,lithics,roads,environmental archaeology,digital cultural heritage,archaeological reports,history,CRMba,churches,cultural heritage,archaeological stratigraphy,religious art,buidings,digital humanities,survey,archaeological sites,linguistic studies,bioarchaeology,architectural orders,palaeoanthropology,fine arts,europeana,CIDOC CRM,decorations,classic art,stratigraphy,digital archaeology,intangible cultural heritage,walls,humanities,chapels,CRMtex,Language and Literature,paintings,archaeology,fair data,mosaics,burials,architecture,medieval art,castles,CARARE metadata schema,statues,natural language processing,inscriptions,CRMsci,vaults,contemporary art,Arts and Humanities,CRMarchaeo,pottery,site,architectural,vessels@@oac_dh-ch@@community", + "fam@@Fisheries and Aquaculture Management@@Conservation of marine resources for sustainable development. The Fisheries and Aquaculture community focus on resources (document, data, codes..) which have been produced in the framework of projects (H2020, FP7, ..) related to the domain of fisheries and aquaculture.@@Stock Assessment,pelagic,Acoustic,Fish farming,Fisheries,Fishermen,maximum sustainable yield,trawler,Fishing vessel,Fisherman,Fishing gear,mackerel,RFMO,Fish Aggregating Device,Bycatch,Fishery,common fisheries policy,Fishing fleet,Aquaculture@@fisheries@@community", +"ni@@Neuroinformatics@@The neuroinformatics dashboard gathers research outputs from the 'neuroinformatics' community at large including the fields of: neuroscience, neuroinformatics, brain imaging databases and standards, brain imaging techniques, neuroimaging methods including statistics and machine learning. The dashboard covers a wide range of imaging methods including (but not limited to): MRI, TEP, EEG, MEG, and studies involving human participants as well as animal studies.@@brain mapping,brain imaging,electroencephalography,arterial spin labelling,brain fingerprinting,brain,neuroimaging,Multimodal Brain Image Analysis,fMRI,neuroinformatics,fetal brain,brain ultrasonic imaging,topographic brain mapping,diffusion tensor imaging,computerized knowledge assessment,connectome mapping,brain magnetic resonance imaging,brain abnormalities@@oac_ni@@community", +"mes@@European Marine Science@@This community was initially defined to include a very broad range of topics, with the intention to generate a number of more focused and sustainable dashboards for research communities and initiatives. As outlined in the logo of this community, we intend to setup a community dashboard for EuroMarine (a consortium of 56 research and academic organisations) and monitoring dashboards for marine research initiatives, including infrastructures (e.g. EMBRC & EMSO), advisory boards (e.g. Marine Boards & ICES), and transnational funding bodies (e.g. JPI-Oceans and Tara Foundation).@@marine,ocean,fish,aqua,sea@@oac_mes@@community", +"instruct@@Instruct-ERIC@@Instruct-ERIC is the European Research Infrastructure for Structural Biology@@@@oac_instruct@@community", +"elixir-gr@@The Greek National Node of the ESFRI European RI ELIXIR@@ELIXIR-GR enhances the potential of the Greek bioinformatics community to offer open, easily accessible and state -of- the- art services to the Greek and the international academic community and other stakeholders, such as industry and the health sector. More importantly, by providing these services, the infrastructure facilitates discoveries in the field of the life-sciences, having strong spill over effects in promoting innovation in sectors such as discovery of new drug targets and development of novel therapeutic agents, development of innovative diagnostics, personalized medicine, and development of innovative biotechnological products and processes.@@@@oaa_elixir-gr@@ri", +"aginfra@@Agricultural and Food Sciences@@The scope of this community is to provide access to publications, research data, projects and software that are related to agricultural and food sciences@@animal production and health,fisheries and aquaculture,food safety and human nutrition,information management,food technology,agri-food education and extension,natural resources and environment,food system,engineering technology and Research,agriculture,food safety risk assessment,food security,farming practices and systems,plant production and protection,agri-food economics and policy,Agri-food,food distribution,forestry@@oac_aginfra@@community", +"dariah@@DARIAH EU@@The Digital Research Infrastructure for the Arts and Humanities (DARIAH) aims to enhance and support digitally-enabled research and teaching across the arts and humanities. It develops, maintains and operates an infrastructure in support of ICT-based research practices and sustains researchers in using them to build, analyse and interpret digital resources. DARIAH was established as a European Research Infrastructure Consortium (ERIC) in August 2014. Currently, DARIAH has 18 Members and several cooperating partners in eight non-member countries. Here you will find a growing collection of DARIAH-affiliated research outputs and other documents. @@@@dariah@@ri", +"epos@@European Plate Observing System@@EPOS, the European Plate Observing System, is a long-term plan to facilitate integrated use of data, data products, and facilities from distributed research infrastructures for solid Earth science in Europe.@@@@@@ri", + "covid-19@@Corona Virus Disease@@This portal provides access to publications, research data, projects and software that may be relevant to the Corona Virus Disease (COVID-19). The OpenAIRE COVID-19 Gateway aggregates COVID-19 related records, links them and provides a single access point for discovery and navigation. We tag content from the OpenAIRE Research Graph (10,000+ data sources) and additional sources. All COVID-19 related research results are linked to people, organizations and projects, providing a contextualized navigation.@@COVID19,SARS-CoV,HCoV-19,mesh:C000657245,MERS-CoV,Síndrome Respiratorio Agudo Severo,mesh:COVID-19,COVID2019,COVID-19,SARS-CoV-2,2019 novel coronavirus,severe acute respiratory syndrome coronavirus 2,Orthocoronavirinae,Coronaviridae,mesh:D045169,coronavirus,SARS,coronaviruses,coronavirus disease-19,sars cov 2,Middle East Respiratory Syndrome,Severe acute respiratory syndrome coronavirus 2,Severe Acute Respiratory Syndrome,coronavirus disease 2019,2019-nCoV@@covid-19@@community"); + + List communityContext = Arrays.asList("\n" + + " all\n" + + " CLARIN\n" + + " https://www.clarin.eu/sites/default/files/clarin-frontpage-logo.jpg\n" + + " Common Language Resources and Technology Infrastructure\n" + + " maria@clarin.eu,dieter@clarin.eu,f.m.g.dejong@uu.nl,paolo.manghi@isti.cnr.it\n" + + " \n" + + " (Part of) the work reported here was made possible by using the CLARIN infrastructure.\n" + + " The work reported here has received funding through <CLARIN national consortium member, e.g. CLARIN.SI>, <XYZ> project, grant no. <XYZ>.\n" + + " The work reported here has received funding (through CLARIN ERIC) from the European Union’s Horizon 2020 research and innovation programme under grant agreement No <0-9> for project <XYZ>.\n" + + " (E.g. No 676529 for project CLARIN-PLUS.)\n" + + " oac_clarin\n" + + " 2018-03-01T12:00:00\n" + + " \n" + + " \n" + + " CLARIN-PLUS\n" + + " \n" + + " \n" + + " 676529\n" + + " http://www.clarin.eu\n" + + " EC\n" + + " H2020-INFRADEV-1-2015-1\n" + + " CLARIN+\n" + + " \n" + + " \n" + + " Common Language Resources and Technology Infrastructure\n" + + " CLARIN\n" + + " 212230\n" + + " EC\n" + + " corda_______::ef782b2d85676aa3e5a907427feb18c4\n" + + " \n" + + " \n" + + " " + + "\n" + + " \n" + + " LINDAT/CLARIN repository\n" + + " LINDAT/CLARIN repository\n" + + " true\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " CLARIN-D\n" + + " https://www.clarin-d.de/en/\n" + + " \n" + + " http://www.lrec-conf.org/proceedings/lrec2018/pdf/504.pdf\n" + + " Germany\n" + + " \n" + + " \n" + + " \n" + + " \n" + + "", + "\n" + + " all\n" + + " This community gathers research results, data, scientific publications and projects related to the domain of Digital Humanities. This broad definition includes Humanities, Cultural Heritage, History, Archaeology and related fields.\n" + + " http://sanmamante.org/DH_CH_logo.png\n" + + " Digital Humanities and Cultural Heritage\n" + + " ileniagalluccio87@gmail.com,achille.felicetti@gmail.com,paolo.manghi@isti.cnr.it,tim.evans@york.ac.uk\n" + + " modern art,monuments,europeana data model,sites,field walking,frescoes,LIDO metadata schema,art history,excavation,Arts and Humanities General,cities,coins,temples,numismatics,lithics,roads,environmental archaeology,digital cultural heritage,archaeological reports,history,CRMba,churches,cultural heritage,archaeological stratigraphy,religious art,buidings,digital humanities,survey,archaeological sites,linguistic studies,bioarchaeology,architectural orders,palaeoanthropology,fine arts,europeana,CIDOC CRM,decorations,classic art,stratigraphy,digital archaeology,intangible cultural heritage,walls,humanities,chapels,CRMtex,Language and Literature,paintings,archaeology,fair data,mosaics,burials,architecture,medieval art,castles,CARARE metadata schema,statues,natural language processing,inscriptions,CRMsci,vaults,contemporary art,Arts and Humanities,CRMarchaeo,pottery,site,architectural,vessels\n" + + " The present work has been partially supported by the PARTHENOS project, funded by the European Commission (Grant Agreement No. 654119) under the HORIZON 2020 - INFRADEV-4-2014/2015 call\n" + + " oac_dh-ch\n" + + " 2018-03-01T12:00:00\n" + + " \n" + + " \n" + + " Pooling Activities, Resources and Tools for Heritage E-research Networking, Optimization and Synergies\n" + + " The present work has been partially supported by the PARTHENOS project, funded by the European Commission (Grant Agreement No. 654119) under the HORIZON 2020 - INFRADEV-4-2014/2015 call\n" + + " \n" + + " 654119\n" + + " http://www.parthenos-project.eu\n" + + " EC\n" + + " PARTHENOS\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " re3data_____::9ebe127e5f3a0bf401875690f3bb6b81\n" + + " The UK's largest collection of digital research data in the social sciences and humanities\n" + + " UK Data Archive\n" + + " true\n" + + " \n" + + " \n" + + " doajarticles::c6cd4b532e12868c1d760a8d7cda6815\n" + + " Journal of Data Mining and Digital Humanities\n" + + " Journal of Data Mining and Digital Humanities\n" + + " true\n" + + " \n" + + " \n" + + " doajarticles::a6de4499bb87bf3c01add0a9e2c9ed0b\n" + + " Frontiers in Digital Humanities\n" + + " Frontiers in Digital Humanities\n" + + " true\n" + + " \n" + + " \n" + + " doajarticles::6eb31d13b12bc06bbac06aef63cf33c9\n" + + " Il Capitale Culturale: Studies on the Value of Cultural Heritage\n" + + " Il Capitale Culturale: Studies on the Value of Cultural Heritage\n" + + " true\n" + + " \n" + + " \n" + + " doajarticles::0da84e9dfdc8419576169e027baa8028\n" + + " Conservation Science in Cultural Heritage\n" + + " Conservation Science in Cultural Heritage\n" + + " true\n" + + " \n" + + " \n" + + " re3data_____::84e123776089ce3c7a33db98d9cd15a8\n" + + " Electronic Archiving System\n" + + " EASY\n" + + " true\n" + + " \n" + + " \n" + + " openaire____::c5502a43e76feab55dd00cf50f519125\n" + + " DANS-KB Harvester\n" + + " Gemeenschappelijke Harvester DANS-KB\n" + + " true\n" + + " \n" + + " \n" + + " re3data_____::a48f09c562b247a9919acfe195549b47\n" + + " ads\n" + + " Archaeology Data Service\n" + + " true\n" + + " \n" + + " \n" + + " opendoar____::97275a23ca44226c9964043c8462be96\n" + + " KNAW Repository\n" + + " KNAW Repository\n" + + " true\n" + + " \n" + + " \n" + + " doajarticles::2899208a99aa7d142646e0a80bfeef05\n" + + " Internet Archaeology\n" + + " Internet Archaeology\n" + + " true\n" + + " \n" + + " \n" + + " \n" + + "\n" , + "\n" + + " all\n" + + " The neuroinformatics dashboard gathers research outputs from the 'neuroinformatics' community at large including the fields of: neuroscience, neuroinformatics, brain imaging databases and standards, brain imaging techniques, neuroimaging methods including statistics and machine learning. The dashboard covers a wide range of imaging methods including (but not limited to): MRI, TEP, EEG, MEG, and studies involving human participants as well as animal studies.\n" + + " https://docs.google.com/drawings/u/0/d/10e191xGoGf4uaRluMqbt_7cCj6LSCs2a29im4CmWjqU/export/png\n" + + " Neuroinformatics\n" + + " sorina.pop@creatis.insa-lyon.fr,camille.maumet@inria.fr,christian.barillot@irisa.fr,xavier.rolland@irisa.fr,axel.bonnet@creatis.insa-lyon.fr,paolo.manghi@isti.cnr.it\n" + + " brain mapping,brain imaging,electroencephalography,arterial spin labelling,brain fingerprinting,brain,neuroimaging,Multimodal Brain Image Analysis,fMRI,neuroinformatics,fetal brain,brain ultrasonic imaging,topographic brain mapping,diffusion tensor imaging,computerized knowledge assessment,connectome mapping,brain magnetic resonance imaging,brain abnormalities\n" + + " \n" + + " oac_ni\n" + + " 2018-03-01T12:00:00\n" + + " \n" + + " \n" + + " re3data_____::5b9bf9171d92df854cf3c520692e9122\n" + + " Formerly:OpenFMRI\n" + + " OpenNeuro\n" + + " true\n" + + " \n" + + " \n" + + " doajarticles::c7d3de67dc77af72f6747157441252ec\n" + + " Research Ideas and Outcomes\n" + + " Research Ideas and Outcomes\n" + + " true\n" + + " \n" + + " \n" + + " re3data_____::8515794670370f49c1d176c399c714f5\n" + + " Neuroimaging Informatics Tools and Resources Clearinghouse\n" + + " NITRC\n" + + " true\n" + + " \n" + + " \n" + + " doajarticles::d640648c84b10d425f96f11c3de468f3\n" + + " Frontiers in Neuroinformatics\n" + + " Frontiers in Neuroinformatics\n" + + " true\n" + + " \n" + + " \n" + + " doajarticles::0c0e74daa5d95504eade9c81ebbd5b8a\n" + + " NeuroImage: Clinical\n" + + " NeuroImage: Clinical\n" + + " true\n" + + " \n" + + " \n" + + " rest________::fb1a3d4523c95e63496e3bc7ba36244b\n" + + " NeuroVault\n" + + " NeuroVault\n" + + " true\n" + + " \n" + + " \n" + + "\n" , + "\n" + + " all\n" + + " Instruct-ERIC is the European Research Infrastructure for Structural Biology\n" + + " https://instruct-eric.eu/templates/instructeric/images/logos/instruct-eric-logo-noline.png\n" + + " Instruct-ERIC\n" + + " claudia@instruct-eric.eu,carazo@cnb.csic.es,echrysina@eie.gr,susan@instruct-eric.eu,naomi@instruct-eric.eu,natalie@instruct-eric.eu,pmarie@igbmc.fr,darren.hart@ibs.fr,claudia@strubi.ox.ac.uk,paolo.manghi@isti.cnr.it\n" + + " \n" + + " The authors acknowledge the support and the use of resources of Instruct-ERIC.\n" + + " The authors acknowledge the support and the use of resources of Instruct (PID # or APPID #), a Landmark ESFRI project\n" + + " oac_instruct\n" + + " 2018-03-01T12:00:00\n" + + " \n" + + " \n" + + " Authentication and Authorisation For Research and Collaboration\n" + + " \n" + + " 730941\n" + + " \n" + + " H2020-EINFRA-2016-1\n" + + " AARC2\n" + + " EC\n" + + " \n" + + " \n" + + " Building data bridges between biological and medical infrastructures in Europe\n" + + " \n" + + " 284209\n" + + " \n" + + " FP7-INFRASTRUCTURES-2011-1\n" + + " EC\n" + + " BioMedBridges\n" + + " \n" + + " \n" + + " Transnational access and enhancement of integrated Biological Structure determination at synchrotron X-ray radiation facilities\n" + + " \n" + + " 283570\n" + + " \n" + + " FP7-INFRASTRUCTURES-2011-1\n" + + " EC\n" + + " BioStruct-X\n" + + " \n" + + " \n" + + " Coordinated Research Infrastructures Building Enduring Life-science services\n" + + " \n" + + " 654248\n" + + " \n" + + " H2020-INFRADEV-1-2014-1\n" + + " EC\n" + + " CORBEL\n" + + " \n" + + " \n" + + " Infrastructure for NMR, EM and X-rays for translational research\n" + + " \n" + + " 653706\n" + + " \n" + + " H2020-INFRAIA-2014-2015\n" + + " EC\n" + + " iNEXT\n" + + " \n" + + " \n" + + " Integrated Structural Biology Infrastructure\n" + + " \n" + + " 211252\n" + + " \n" + + " FP7-INFRASTRUCTURES-2007-1\n" + + " EC\n" + + " INSTRUCT\n" + + " \n" + + " \n" + + " Releasing the full potential of Instruct to expand and consolidate infrastructure services for integrated structural life science research\n" + + " \n" + + " 731005\n" + + " \n" + + " H2020-INFRADEV-2016-1\n" + + " EC\n" + + " INSTRUCT-ULTRA\n" + + " \n" + + " \n" + + " Opening Synchrotron Light for Experimental Science and Applications in the Middle East\n" + + " \n" + + " 730943\n" + + " \n" + + " H2020-INFRASUPP-2016-1\n" + + " EC\n" + + " OPEN SESAME\n" + + " \n" + + " \n" + + " Infrastructure for Protein Production Platforms\n" + + " \n" + + " 227764\n" + + " \n" + + " FP7-INFRASTRUCTURES-2008-1\n" + + " EC\n" + + " PCUBE\n" + + " \n" + + " \n" + + " European Vaccine Research and Development Infrastructure\n" + + " \n" + + " 730964\n" + + " \n" + + " H2020-INFRAIA-2016-1\n" + + " EC\n" + + " TRAMSVAC2\n" + + " \n" + + " \n" + + " World-wide E-infrastructure for structural biology\n" + + " \n" + + " 675858\n" + + " \n" + + " H2020-EINFRA-2015-1\n" + + " EC\n" + + " West-Life\n" + + " \n" + + " \n" + + " Expanding research infrastructure visibility to strengthen strategic partnerships\n" + + " RI-VIS\n" + + " 824063\n" + + " EC\n" + + " corda__h2020::af93b591b76991d8437993a8f6fc6538\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " instruct\n" + + " \n" + + " \n" + + " \n" + + " west-life\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " FRISBI\n" + + " aHR0cDovL2ZyaXNiaS5ldS9zdGF0aWMvaW1hZ2VzL2xvZ29zL2xvZ28tZnJpc2JpLnBuZw==\n" + + " aHR0cDovL2ZyaXNiaS5ldS8=\n" + + " \n" + + " \n" + + " RI-VIS\n" + + " aHR0cHM6Ly9yaS12aXMuZXUvbmV0d29yay9yaXZpcy90ZW1wbGF0ZXMvcml2aXMvaW1hZ2VzL1JJLVZJU0xvZ29GaW5hbC0wNi5wbmc=\n" + + " aHR0cHM6Ly9yaS12aXMuZXU=\n" + + " \n" + + " \n" + + " CIISB\n" + + " aHR0cDovL2JpYy5jZWl0ZWMuY3ovZmlsZXMvMjkyLzEyNS5KUEc=\n" + + " aHR0cHM6Ly93d3cuY2lpc2Iub3Jn\n" + + " \n" + + " \n" + + "\n" , + "\n" + + " all\n" + + " ELIXIR-GR enhances the potential of the Greek bioinformatics community to offer open, easily accessible and state -of- the- art services to the Greek and the international academic community and other stakeholders, such as industry and the health sector. More importantly, by providing these services, the infrastructure facilitates discoveries in the field of the life-sciences, having strong spill over effects in promoting innovation in sectors such as discovery of new drug targets and development of novel therapeutic agents, development of innovative diagnostics, personalized medicine, and development of innovative biotechnological products and processes.\n" + + " https://elixir-greece.org/sites/default/files/ELIXIR_GREECE_white_background.png\n" + + " The Greek National Node of the ESFRI European RI ELIXIR\n" + + " vergoulis@imis.athena-innovation.gr,schatz@imis.athena-innovation.gr,paolo.manghi@isti.cnr.it\n" + + " \n" + + " \n" + + " oaa_elixir-gr\n" + + " 2018-03-01T12:00:00\n" + + " \n" + + " \n" + + " \n" + + " rest________::b8e502674c3c3499d5374e9b2ea6d8d5\n" + + " bio.tools\n" + + " bio.tools\n" + + " false\n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " \n" + + " ATHENA RC\n" + + " aHR0cHM6Ly9lbGl4aXItZ3JlZWNlLm9yZy9zaXRlcy9kZWZhdWx0L2ZpbGVzL3N0eWxlcy90aHVtYm5haWwvcHVibGljL3BhcnRuZXJfbG9nb3MvYXRoZW5hX2xvZ28uanBnP2l0b2s9VXdGWFNpZng=\n" + + " aHR0cHM6Ly93d3cuYXRoZW5hLWlubm92YXRpb24uZ3IvZW4=\n" + + " \n" + + " \n" + + ""); + + @Mock + private ISLookUpService isLookUpService; + + private QueryInformationSystem queryInformationSystem; + + private Map map; + + @BeforeEach + public void setUp() throws ISLookUpException { + lenient().when(isLookUpService.quickSearchProfile(XQUERY_ENTITY)).thenReturn(communityMap); + lenient().when(isLookUpService.quickSearchProfile(XQUERY)).thenReturn(communityContext); + queryInformationSystem = new QueryInformationSystem(); + queryInformationSystem.setIsLookUp(isLookUpService); + } + + @Test + public void testSizeEntity() throws ISLookUpException { + + List cInfoList = new ArrayList<>(); + final Consumer consumer = ci -> cInfoList.add(ci); + queryInformationSystem.getContextInformation(consumer); + + Assertions.assertEquals(12, cInfoList.size()); + } + + @Test + public void testSizeRelation() throws ISLookUpException { + + List cInfoList = new ArrayList<>(); + final Consumer consumer = ci -> cInfoList.add(ci); + queryInformationSystem.execContextRelationQuery(); + queryInformationSystem.getContextRelation(consumer, "contentproviders", "10|"); + + Assertions.assertEquals(5, cInfoList.size()); + } + + @Test + public void testContentRelation() throws ISLookUpException { + + List cInfoList = new ArrayList<>(); + final Consumer consumer = ci -> cInfoList.add(ci); + queryInformationSystem.execContextRelationQuery(); + queryInformationSystem.getContextRelation(consumer, "contentproviders", "10|"); + + cInfoList.forEach(contextInfo -> { + switch (contextInfo.getId()){ + case "elixir-gr": + Assertions.assertEquals(1, contextInfo.getDatasourceList().size()); + Assertions.assertEquals("10|rest________::b8e502674c3c3499d5374e9b2ea6d8d5", + contextInfo.getDatasourceList().get(0)); + break; + case "instruct": + Assertions.assertEquals(0, contextInfo.getDatasourceList().size()); + break; + case "ni": + Assertions.assertEquals(6, contextInfo.getDatasourceList().size()); + Assertions.assertTrue(contextInfo.getDatasourceList().contains(("10|rest________::fb1a3d4523c95e63496e3bc7ba36244b"))); + break; + case "dh-ch": + Assertions.assertEquals(10, contextInfo.getDatasourceList().size()); + break; + case "clarin": + Assertions.assertEquals(0, contextInfo.getDatasourceList().size()); + break; + } + }); + } + + @Test + public void testContentEntity() throws ISLookUpException { + + List cInfoList = new ArrayList<>(); + final Consumer consumer = ci -> cInfoList.add(ci); + queryInformationSystem.getContextInformation(consumer); + + cInfoList.forEach(context ->{ + switch (context.getId()){ + case "clarin"://clarin@@Common Language Resources and Technology Infrastructure@@CLARIN@@@@oac_clarin", + Assertions.assertEquals("Common Language Resources and Technology Infrastructure", context.getName()); + Assertions.assertEquals("CLARIN", context.getDescription()); + Assertions.assertTrue( Optional.ofNullable(context.getSubject()).map(value -> false) + .orElse(true)); + Assertions.assertEquals("oac_clarin", context.getZenodocommunity()); + Assertions.assertEquals("ri" , context.getType()); + break; + case "ee": + Assertions.assertEquals("Sustainable Development Solutions Network - Greece", context.getName()); + Assertions.assertTrue( context.getDescription().length() > 0); + Assertions.assertFalse( Optional.ofNullable(context.getSubject()).map(value -> false) + .orElse(true)); + Assertions.assertEquals(17, context.getSubject().size()); + Assertions.assertEquals("oac_sdsn-greece", context.getZenodocommunity()); + Assertions.assertEquals("community" , context.getType()); + break; + case "dh-ch": + Assertions.assertEquals("Digital Humanities and Cultural Heritage", context.getName()); + Assertions.assertTrue( context.getDescription().length() > 0); + Assertions.assertFalse( Optional.ofNullable(context.getSubject()).map(value -> false) + .orElse(true)); + Assertions.assertEquals(67, context.getSubject().size()); + Assertions.assertEquals("oac_dh-ch", context.getZenodocommunity()); + Assertions.assertEquals("community" , context.getType()); + break; + case "fam": + Assertions.assertEquals("Fisheries and Aquaculture Management", context.getName()); + Assertions.assertTrue( context.getDescription().length() > 0); + Assertions.assertTrue(context.getDescription().startsWith("Conservation of marine resources for sustainable development")); + Assertions.assertFalse( Optional.ofNullable(context.getSubject()).map(value -> false) + .orElse(true)); + Assertions.assertEquals(19, context.getSubject().size()); + Assertions.assertEquals("fisheries", context.getZenodocommunity()); + Assertions.assertEquals("community" , context.getType()); + break; + case "ni": + Assertions.assertEquals("Neuroinformatics", context.getName()); + Assertions.assertTrue( context.getDescription().length() > 0); + Assertions.assertTrue(context.getDescription() + .startsWith("The neuroinformatics dashboard gathers research outputs from the")); + Assertions.assertFalse( Optional.ofNullable(context.getSubject()).map(value -> false) + .orElse(true)); + Assertions.assertEquals(18, context.getSubject().size()); + Assertions.assertEquals("oac_ni", context.getZenodocommunity()); + Assertions.assertEquals("community" , context.getType()); + Assertions.assertTrue(context.getSubject().contains("brain")); + break; + case "mes": + Assertions.assertEquals("European Marine Science", context.getName()); + Assertions.assertTrue( context.getDescription().length() > 0); + Assertions.assertTrue(context.getDescription() + .startsWith("This community was initially defined to include a very broad range of topics")); + Assertions.assertFalse( Optional.ofNullable(context.getSubject()).map(value -> false) + .orElse(true)); + Assertions.assertEquals(5, context.getSubject().size()); + Assertions.assertEquals("oac_mes", context.getZenodocommunity()); + Assertions.assertEquals("community" , context.getType()); + Assertions.assertTrue(context.getSubject().contains("sea")); + Assertions.assertTrue(context.getSubject().contains("fish")); + Assertions.assertTrue(context.getSubject().contains("ocean")); + Assertions.assertTrue(context.getSubject().contains("aqua")); + Assertions.assertTrue(context.getSubject().contains("marine")); + break; + case "instruct": + Assertions.assertEquals("Instruct-ERIC", context.getName()); + Assertions.assertTrue( context.getDescription().length() > 0); + Assertions.assertTrue(context.getDescription() + .equals("Instruct-ERIC is the European Research Infrastructure for Structural Biology")); + Assertions.assertTrue( Optional.ofNullable(context.getSubject()).map(value -> false) + .orElse(true)); + Assertions.assertEquals("oac_instruct", context.getZenodocommunity()); + Assertions.assertEquals("community" , context.getType()); + + break; + case "elixir-gr": + Assertions.assertEquals("The Greek National Node of the ESFRI European RI ELIXIR", context.getName()); + Assertions.assertTrue( context.getDescription().length() > 0); + Assertions.assertTrue(context.getDescription() + .startsWith("ELIXIR-GR enhances the potential of the Greek bioinformatics community to offer open")); + Assertions.assertTrue( Optional.ofNullable(context.getSubject()).map(value -> false) + .orElse(true)); + Assertions.assertEquals("oaa_elixir-gr", context.getZenodocommunity()); + Assertions.assertEquals("ri" , context.getType()); + + break; + case "aginfra": + Assertions.assertEquals("Agricultural and Food Sciences", context.getName()); + Assertions.assertTrue( context.getDescription().length() > 0); + Assertions.assertTrue(context.getDescription() + .startsWith("The scope of this community is to provide access to publications, research data, projects and software")); + Assertions.assertFalse( Optional.ofNullable(context.getSubject()).map(value -> false) + .orElse(true)); + Assertions.assertEquals(18, context.getSubject().size()); + Assertions.assertEquals("oac_aginfra", context.getZenodocommunity()); + Assertions.assertEquals("community" , context.getType()); + Assertions.assertTrue(context.getSubject().contains("food distribution")); + break; + case "dariah": + Assertions.assertEquals("DARIAH EU", context.getName()); + Assertions.assertTrue( context.getDescription().length() > 0); + Assertions.assertTrue(context.getDescription() + .startsWith("The Digital Research Infrastructure for the Arts and Humanities (DARIAH) aims to enhance and support ")); + Assertions.assertTrue( Optional.ofNullable(context.getSubject()).map(value -> false) + .orElse(true)); + + Assertions.assertEquals("dariah", context.getZenodocommunity()); + Assertions.assertEquals("ri" , context.getType()); + + break; + case "epos": + Assertions.assertEquals("European Plate Observing System", context.getName()); + Assertions.assertTrue( context.getDescription().length() > 0); + Assertions.assertTrue(context.getDescription() + .startsWith("EPOS, the European Plate Observing System, is a long-term plan to facilitate integrated use of ")); + Assertions.assertTrue( Optional.ofNullable(context.getSubject()).map(value -> false) + .orElse(true)); + + Assertions.assertEquals("", context.getZenodocommunity()); + Assertions.assertEquals("ri" , context.getType()); + + + break; + case "covid-19": + Assertions.assertEquals("Corona Virus Disease", context.getName()); + Assertions.assertTrue( context.getDescription().length() > 0); + Assertions.assertTrue(context.getDescription() + .startsWith("This portal provides access to publications, research data, projects and ")); + Assertions.assertFalse( Optional.ofNullable(context.getSubject()).map(value -> false) + .orElse(true)); + Assertions.assertEquals(25, context.getSubject().size()); + Assertions.assertEquals("covid-19", context.getZenodocommunity()); + Assertions.assertEquals("community" , context.getType()); + Assertions.assertTrue(context.getSubject().contains("coronavirus disease 2019")); + break; + + } + }); + + } } diff --git a/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/RelationFromOrganizationTest.java b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/RelationFromOrganizationTest.java new file mode 100644 index 000000000..1c4a961e1 --- /dev/null +++ b/dhp-workflows/dhp-graph-mapper/src/test/java/eu/dnetlib/dhp/oa/graph/dump/graph/RelationFromOrganizationTest.java @@ -0,0 +1,4 @@ +package eu.dnetlib.dhp.oa.graph.dump.graph; + +public class RelationFromOrganizationTest { +}