From df425777ca102a6109b4f565d6e059a59d339fd3 Mon Sep 17 00:00:00 2001 From: Martin Fenner Date: Thu, 27 Dec 2018 14:17:05 +0100 Subject: [PATCH] handle namespaced xml in metadata import. #165 --- app/models/concerns/crosscitable.rb | 3 +- spec/concerns/crosscitable_spec.rb | 5 + spec/fixtures/files/datacite_namespace.xml | 311 +++++++++++++++++++++ 3 files changed, 318 insertions(+), 1 deletion(-) create mode 100644 spec/fixtures/files/datacite_namespace.xml diff --git a/app/models/concerns/crosscitable.rb b/app/models/concerns/crosscitable.rb index 6157a35ed..01b6682ad 100644 --- a/app/models/concerns/crosscitable.rb +++ b/app/models/concerns/crosscitable.rb @@ -101,7 +101,8 @@ def clean_xml(string) # remove leading and trailing whitespace string = string.strip - return nil unless string.start_with?(' and additional namespace + return nil unless string.start_with?('') diff --git a/spec/fixtures/files/datacite_namespace.xml b/spec/fixtures/files/datacite_namespace.xml new file mode 100644 index 000000000..0bc0b5b9c --- /dev/null +++ b/spec/fixtures/files/datacite_namespace.xml @@ -0,0 +1,311 @@ + + 10.5880/PIK.2017.010 + + + Gosling, Simon + 0000-0001-5973-6862 + School of Geography, University of Nottingham, UK + + + Müller Schmied, Hannes + 0000-0001-5330-9923 + Institute of Physical Geography (IPG), Goethe-University Frankfurt, Germany + + + Betts, Richard + P-8976-2015 + University of Exeter, UK + + + Chang, Jinfeng + 56582989700 + Laboratoire des Sciences du Climat et de l'Environnement (LSCE), France + + + Ciais, Philippe + 0000-0001-8560-4943 + Institute Pierre Simon Laplace (IPSL), France + + + Dankers, Rutger + 0000-0003-2375-5468 + Met Office, UK + + + Döll, Petra + 0000-0003-2238-4546 + Universität Frankfurt, Germany + + + Eisner, Stephanie + 37046987400 + Center for Environmental Systems Research (CESR), University of Kassel, Germany + + + Flörke, Martina + 0000-0003-2943-5289 + Center of Environmental Systems Research (CESR), University of Kassel, Germany + + + Gerten, Dieter + B-2975-2013 + Potsdam-Institute for Climate Impact Research (PIK), Germany + + + Grillakis, Manolis + 0000-0002-4228-1803 + Technical University of Crete, Greece + + + Hanasaki, Naota + 0000-0002-5092-7563 + National Institute for Environmental Studies, Japan + + + Hagemann, Stefan + 0000-0001-5444-2945 + Max-Planck-Institute for Meteorology, Germany + + + Huang, Maoyi + 0000-0001-9154-9485 + Pacific Northwest National Laboratory (PNNL), USA + + + Huang, Zhongwei + K-5484-2013 + Chinese Academy of Sciences, China + + + Jerez, Sonia + 0000-0002-2153-1658 + University of Murcia, Spain + + + Kim, Hyungjun + I-5099-2014 + Institute of Industrial Science, University of Tokyo, Japan + + + Koutroulis, Aristeidis + 0000-0002-2999-7575 + Technical University of Crete, Greece + + + Leng, Guoyong + 55073323400 + Pacific Northwest National Laboratory (PNNL), USA + + + Liu, Xingcai + 0000-0001-5726-7353 + Chinese Academy of Sciences, China + + + Masaki, Yoshimitsu + 55804883700 + Hirosaki University, Japan + + + Montavez, Pedro + 0000-0001-6117-3528 + University of Murcia, Spain + + + Morfopoulos, Catherine + L-2484-2014 + University of Exeter, UK + + + Oki, Taikan + 0000-0003-4067-4678 + Institute of Industrial Science, University of Tokyo, Japan + + + Papadimitriou, Lamprini + 55992696200 + Technical University of Crete, Greece + + + Pokhrel, Yadu + 46461963400 + Michigan State University, USA + + + Portmann, Felix T. + 24438491200 + Universität Frankfurt, Germany + + + Orth, Rene + 55346607800 + Institute for Atmospheric and Climate Science, ETH Zürich + + + Ostberg, Sebastian + 6507766991 + Potsdam-Institute for Climate Impact Research (PIK), Germany + + + Satoh, Yusuke + 56061688700 + International Institute for Applied Systems Analysis, Austria + + + Seneviratne, Sonia + 0000-0001-9528-2917 + ETH Zurich, Switzerland + + + Sommer, Philipp + 0000-0001-6171-7716 + University of Lausanne, Switzerland + + + Stacke, Tobias + 0000-0003-4637-5337 + Max Planck Institute for Meteorology, Germany + + + Tang, Qiuhong + 14523673200 + Institute of Geographic Sciences and Natural Resources Research, Chinese Academy of Sciences, China + + + Tsanis, Ioannis + 56840353800 + Technical University of Crete, Greece + + + Wada, Yoshihide + 57195195518 + International Institute for Applied Systems Analysis, Austria + + + Zhou, Tian + 7402989545 + Pacific Northwest National Laboratory (PNNL), USA + + + Büchner, Matthias + 0000-0002-1382-7424 + Potsdam-Institute for Climate Impact Research (PIK), Germany + + + Schewe, Jacob + 0000-0001-9455-4159 + Potsdam-Institute for Climate Impact Research (PIK), Germany + + + Zhao, Fang + 0000-0002-4819-3724 + Potsdam-Institute for Climate Impact Research (PIK), Germany + + + + ISIMIP2a Simulation Data from Water (global) Sector + + GFZ Data Services + 2017 + + + Gosling, Simon + 0000-0001-5973-6862 + School of Geography, University of Nottingham, UK + + + Gosling, Simon + 0000-0001-5973-6862 + School of Geography, University of Nottingham, UK + + + Müller Schmied, Hannes + 0000-0001-5330-9923 + Institute of Physical Geography (IPG), Goethe-University Frankfurt, Germany + + + Müller Schmied, Hannes + 0000-0001-5330-9923 + Institute of Physical Geography (IPG), Goethe-University Frankfurt, Germany + + + Büchner, Matthias + 0000-0002-1382-7424 + Potsdam-Institute for Climate Impact Research (PIK), Germany + + + Büchner, Matthias + 0000-0002-1382-7424 + Potsdam-Institute for Climate Impact Research (PIK), Germany + + + Büchner, Matthias + 0000-0002-1382-7424 + Potsdam-Institute for Climate Impact Research (PIK), Germany + + + Schewe, Jacob + 0000-0001-9455-4159 + Potsdam-Institute for Climate Impact Research (PIK), Germany + + + Schewe, Jacob + 0000-0001-9455-4159 + Potsdam-Institute for Climate Impact Research (PIK), Germany + + + Zhao, Fang + 0000-0002-4819-3724 + Potsdam-Institute for Climate Impact Research (PIK), Germany + + + Zhao, Fang + 0000-0002-4819-3724 + Potsdam-Institute for Climate Impact Research (PIK), Germany + + + + 2017 + 1971/2012 + + eng + Dataset + + https://esg.pik-potsdam.de/projects/isimip/ + https://www.earthsystemcog.org/projects/cog/tutorials_web + https://www.isimip.org/outcomes/#papers-isimip2a + https://www.isimip.org/protocol/#isimip2a + https://www.isimip.org/impactmodels + https://www.isimip.org/gettingstarted/#input-data-bias-correction + + + 547 Bytes + 2 Files + + + text/plain + application/octet-stream + + + Model data are licensed under CC BY 4.0 + EXCEPTIONS: data from model WaterGAP2 and MATSIRO are licensed under CC BY-NC 4.0 + + + The Inter-Sectoral Impact Model Intercomparison Project (ISIMIP) provides a framework for the collation of a set of consistent, multi-sector, multi-scale climate-impact simulations, based on scientifically and politically-relevant historical and future scenarios. This framework serves as a basis for robust projections of climate impacts, as well as facilitating model evaluation and improvement, allowing for improved estimates of the biophysical and socio-economic impacts of climate change at different levels of global warming. It also provides a unique opportunity to consider interactions between climate change impacts across sectors. + ISIMIP2a is the second ISIMIP simulation round, focusing on historical simulations (1971-2010 approx.) of climate impacts on agriculture, fisheries, permafrost, biomes, regional and global water and forests. This may serve as a basis for model evaluation and improvement, allowing for improved estimates of the biophysical and socio-economic impacts of climate change at different levels of global warming. + The focus topic for ISIMIP2a is model evaluation and validation, in particular with respect to the representation of impacts of extreme weather events and climate variability. During this phase, four common global observational climate data sets were provided across all impact models and sectors. In addition, appropriate observational data sets of impacts for each sector were collected, against which the models can be benchmarked. Access to the input data for the impact models is provided through a central ISIMIP archive (see https://www.isimip.org/gettingstarted/#input-data-bias-correction). + This entry refers to the ISIMIP2a simulation data from global hydrology models: CLM4, DBH, H08, JULES_W1, JULES_B1, LPJmL, MATSIRO, MPI-HM, ORCHIDEE, PCR-GLOBWB, SWBM, VIC, WaterGAP2. + The ISIMIP2a water (global) outputs are based on simulations from 13 global hydrology models (see listing) according to the ISIMIP2a protocol (https://www.isimip.org/protocol/#isimip2a). The models simulate hydrological processes and dynamics (part of the models also considering human water abstractions and reservoir regulation) based on climate and physio-geographical information. A more detailed description of the models and model-specific amendments of the protocol are available here: https://www.isimip.org/impactmodels/. + + + + + -180 + 180 + -90 + 90 + + global, annual, monthly, daily + + + \ No newline at end of file