Bug 329750 - Add support to import bibliography in RIS format
Summary: Add support to import bibliography in RIS format
Status: RESOLVED FIXED
Alias: None
Product: KBibTeX
Classification: Applications
Component: Loading/saving files (show other bugs)
Version: 0.5
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: Thomas Fischer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-09 07:51 UTC by auxsvr
Modified: 2014-01-27 20:34 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
KBibTeX's main window showing an opened RIS file (57.50 KB, image/png)
2014-01-10 08:14 UTC, Thomas Fischer
Details
File association settings to use KBibTeX's part to show/open .ris files (23.18 KB, image/png)
2014-01-10 08:19 UTC, Thomas Fischer
Details
Patch to test whether kbibtex 0.5 is default editor for .bib and .ris files (14.39 KB, patch)
2014-01-12 15:35 UTC, auxsvr
Details
Patch to test whether kbibtex 0.5 is default editor for .bib and .ris files (16.54 KB, patch)
2014-01-26 20:41 UTC, auxsvr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description auxsvr 2014-01-09 07:51:11 UTC
Nature offers bibliographies only in RIS format, and the only way I know to import them in kbibtex is to convert them to bibtex first with

cat file.ris| ris2xml | xml2bib > file.bib

using bibutils. It would be nice if kbibtex incorporated this function. Also, importing bibliographies in bibtex format would be useful.

Reproducible: Always
Comment 1 Thomas Fischer 2014-01-09 21:25:02 UTC
KBibTeX has support for RIS. The file open dialog allows you to open files of the mime type "application/x-research-info-systems" which should map to *.ris files. As this mime type is not part of the default database of mime types, KBibTeX (should) install this mime type in your system (see the "mime" subdirectory in KBibTeX's sources).
As the next step, please see if either the .ris file extension or the "application/x-research-info-systems" are known to your KDE installation. Use "File Associations" control module for that.
Comment 2 auxsvr 2014-01-09 23:07:15 UTC
I just tried to open http://www.nature.com/nature/journal/v416/n6883/ris/416823a.ris and kbibtex opens it as a text file, even though the filter in the file open dialog includes RIS. The mimetype is "RIS bibliograph file" and kbibtex is set to open it in file associations, as expected. 

By "import bibliography" I mean that it would be time-saving, when using some websites that only allow downloading of a .bib file, if an import function would append the bibliographies in that file to the file already open. The alternative is to manually copy & paste the bibtex record to a new record, which is more involved, for example, than importing via online search.
Comment 3 Thomas Fischer 2014-01-10 08:14:28 UTC
Created attachment 84546 [details]
KBibTeX's main window showing an opened RIS file
Comment 4 Thomas Fischer 2014-01-10 08:19:57 UTC
Created attachment 84547 [details]
File association settings to use KBibTeX's part to show/open .ris files
Comment 5 Thomas Fischer 2014-01-10 08:22:36 UTC
As shown in my recently submitted screenshots, opening a .ris file is no problem (I took the KBibTeX 0.5 code). Your description in comment 2 sounds like the file associations in your system are not configured to use KBibTeX's part to open the .ris file. You have to ensure that KBibTeX's part is top in this list.
Comment 6 auxsvr 2014-01-10 09:09:23 UTC
The configuration regarding kbibtexpart was missing, thanks. Is this a problem with the installation or is everyone supposed to configure this afterwards?
Comment 7 Thomas Fischer 2014-01-10 21:11:00 UTC
On git master (commit b56e97d3775eb2af2f1c3d7ab8a3997be90496cd), I added a test if KBibTeX is default editor for known bibliographic file formats (BibTeX and RIS for now). Test applies both to the application and the KPart.
It works for me, but please test it by setting various (correct and wrong) settings in the File Association module and see if KBibTeX now recognizes and corrects them for you. You may have to restart the File Association module to see the changes KBibTeX performs.
Comment 8 auxsvr 2014-01-12 15:35:13 UTC
Created attachment 84601 [details]
Patch to test whether kbibtex 0.5 is default editor for .bib and .ris files

This woks, but some times I must run kbuildsycoca4 before the change in mimetype handling is registered.

By the way, the diff to create a new file is invalid as generated by git, because the old file (/dev/null) has line properties -1,1, while only -0,0 is accepted by patch.
Comment 9 Thomas Fischer 2014-01-14 19:10:40 UTC
(In reply to comment #8)
> Created attachment 84601 [details]
> Patch to test whether kbibtex 0.5 is default editor for .bib and .ris files
I would like to see this patch tested more before backporting it to a stable branch. See kbuildsycoca4 issues below as an example...

> This woks, but some times I must run kbuildsycoca4 before the change in
> mimetype handling is registered.
Addressed in commit 4002280e3cfdb491a376e90cad91e6458d8af56e (master).

> By the way, the diff to create a new file is invalid as generated by git,
> because the old file (/dev/null) has line properties -1,1, while only -0,0
> is accepted by patch.
"git diff" is not equal to the command line tool "diff". Use "git apply" instead of "patch" to apply patches.
Comment 10 auxsvr 2014-01-26 20:41:52 UTC
Created attachment 84852 [details]
Patch to test whether kbibtex 0.5 is default editor for .bib and .ris files

Updated the patch and did some tests. It works fine so far and kbuildsycoca runs after the mimetypes are updated.
Comment 11 Thomas Fischer 2014-01-27 20:34:17 UTC
The code has been backported from master to kbibtex/0.5, see commit 6a2486040d2f768379754d0f9f2b540213ce9aa0 for details.