ajnyga / tsvConverter

Excel to OJS3 XML conversion tool
GNU General Public License v3.0
17 stars 12 forks source link

Warnings/notices and no XML produced #8

Closed martinpub closed 5 years ago

martinpub commented 5 years ago

Hi @ajnyga,

Thank you for this contribution! I'm testing the plugin with the attached test spreadsheet: test_record.xlsx

It passes validation, but no XML file is produced as a result. Here is the log, including some warnings/notices:

14:14:56 Creating a new PHPExcel object 14:14:56 Creating an array 14:14:56 Validating data 14:14:56 Preparing data for output 14:14:56 Starting XML output 14:14:56 Closing XML file PHP Notice: Undefined variable: xmlfile in /usr/local/ojsgit/plugins/importexport/tsvConverter/convert.php on line 379

Notice: Undefined variable: xmlfile in /usr/local/ojsgit/plugins/importexport/tsvConverter/convert.php on line 379 PHP Warning: fwrite() expects parameter 1 to be resource, null given in /usr/local/ojsgit/plugins/importexport/tsvConverter/convert.php on line 379

Warning: fwrite() expects parameter 1 to be resource, null given in /usr/local/ojsgit/plugins/importexport/tsvConverter/convert.php on line 379 PHP Notice: Undefined variable: xmlfile in /usr/local/ojsgit/plugins/importexport/tsvConverter/convert.php on line 380

Notice: Undefined variable: xmlfile in /usr/local/ojsgit/plugins/importexport/tsvConverter/convert.php on line 380 PHP Warning: fwrite() expects parameter 1 to be resource, null given in /usr/local/ojsgit/plugins/importexport/tsvConverter/convert.php on line 380

Warning: fwrite() expects parameter 1 to be resource, null given in /usr/local/ojsgit/plugins/importexport/tsvConverter/convert.php on line 380 PHP Notice: Undefined variable: xmlfile in /usr/local/ojsgit/plugins/importexport/tsvConverter/convert.php on line 381

Notice: Undefined variable: xmlfile in /usr/local/ojsgit/plugins/importexport/tsvConverter/convert.php on line 381 PHP Warning: fwrite() expects parameter 1 to be resource, null given in /usr/local/ojsgit/plugins/importexport/tsvConverter/convert.php on line 381

Warning: fwrite() expects parameter 1 to be resource, null given in /usr/local/ojsgit/plugins/importexport/tsvConverter/convert.php on line 381 14:14:56 Conversion finished

Any ideas? Your example.xlsx works fine.

Thanks!

ajnyga commented 5 years ago

Can you try what happens if you add another row to the file?

martinpub commented 5 years ago

Still the same result, I'm afraid.

ajnyga commented 5 years ago

I updated convert.php in the master branch. Can you check if it works with that version (there was a small bug there that was visible with less than three rows) Should work now I think...

If it does, let me know and I will update the release.

martinpub commented 5 years ago

@ajnyga Yes, thank you very much, it works now!

ajnyga commented 5 years ago

Great! I will update the release. Thanks for the feedback!

martinpub commented 5 years ago

Perfect! I might get back, we are working on a backlist import project and are planning to use tsvConverter to generate the OJS XML import files, as it simplifies the procedure.

ajnyga commented 5 years ago

Ok, I also have a script for converting RefWorks Tagged Format output to Excel supported by this converter. We get that from the library catalogue systems (like https://arto.linneanet.fi/vwebv/searchBasic?sk=sv_FI). It does not contain all the needed data, but you end up with an excel that has 80% of the needed data and you fill in the blanks. Of course the other drawback is that you are relying on the library db of having all the articles and the correct metadata.

martinpub commented 5 years ago

@ajnyga Good to know! We have MODS XML data from DiVA, and are planning to use Catmandu for the transformation to tsvConverter's spreadsheet. Any input is appreciated, I'm working on the mapping right now.

ajnyga commented 5 years ago

The script I made is very very simple php script. The tagged format output is plain text and the content seems to vary from journal to journal. So I usually tweak the script to get the best output possible. In general the metadata production is something that the journals do, we just provide the service of converting it to XML and importing it to OJS, and of course help with the questions concerning the excel sheet. We do not have the resources to actually start filling the sheet on behalf of the journals.

This is the tagged format output:

RT Journal Article
A1 Ainiala, Terhi,
T1 Paikannimien kerrostumat maaseudulla ja kaupungissa nimistöntutkijan kohteina
SN 1456-3010
YR 2018
JF Elore
VO 25 
IS 
LA fin
NO Ajatteleva maisema
K1 paikannimet
K1 nimistöntutkimus
UL https://arto.linneanet.fi/vwebv/holdingsInfo?bibId=2494869
UL https://journal.fi/elore/article/view/72817

RT Journal Article
A1 Anttonen, Salli,
T1 Lectio praecursoria at the University of Eastern Finland 25 November 2017
SN 1456-3010
YR 2018
JF Elore
VO 25 
IS 
LA fin
NO Ajatteleva maisema
UL https://arto.linneanet.fi/vwebv/holdingsInfo?bibId=2502521
UL https://journal.fi/elore/article/view/72822

RT Journal Article
A1 Anttonen, Salli,
T1 The quest for authenticity in popular music cultures : lectio praecursoria at the University of Eastern Finland 25 November 2017
SN 1456-3010
YR 2018
JF Elore
VO 25 
IS 
LA eng
K1 populaarimusiikki
K1 diskurssi
K1 autenttisuus
UL https://arto.linneanet.fi/vwebv/holdingsInfo?bibId=2494872
UL https://journal.fi/elore/article/view/72822
martinpub commented 5 years ago

Thanks @ajnyga! We will go with our MODS XML --> tsvConverter converter though.

Any chance of supporting remote galleys in a future release BTW?

ajnyga commented 5 years ago

What does the XML output from OJS look like for remote galleys?

martinpub commented 5 years ago

It's very simple, here is an example:

  <article_galley xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" approved="false" xsi:schemaLocation="http://pkp.sfu.ca native.xsd">
    <id type="internal" advice="ignore">15902</id>
    <name locale="en_US">PDF (DiVA)</name>
    <seq>2</seq>
    <remote src="http://urn.kb.se/resolve?urn=urn:nbn:se:miun:diva-xyz"/>
  </article_galley>
ajnyga commented 5 years ago

The logic could be that if the file column has a value that starts with http or https, it would be regarded as an external galley. What do you think?

Of course you could even fetch the file contents and save it as a regular galley, but that is not what you want?

martinpub commented 5 years ago

That sounds like a good idea! And no need for a new column (even though the semantics is slightly off when it's a URL and not a file, but that's a minor point).

No, we would like galley links to backlist articles already published in DiVA, to keep backlist statistics there etc., while having full backlist metadata in OJS.

ajnyga commented 5 years ago

Then I think it is better to introduce a new column for the remote url and preserve the current file column for the functionality that would fetch the galley contents from an url.

This should be an easy addition, I will look at it later today.

martinpub commented 5 years ago

Much appreciated! And introducing a new column is a better idea, I agree.

ajnyga commented 5 years ago

Hi,

Added support for remote galleys, but did not introduce a new field after all. So you can just use the current file# field and add an url there starting with http or https. The converter will then check if the file name given there is an url and if it is, it will treat it as a remote galley.

Did not have much time test this, so let me know if it does not work.

martinpub commented 5 years ago

Awesome, thank you very much! Will test asap.