Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for references #24

Open
2 of 3 tasks
Vitaliy-1 opened this issue Jun 24, 2020 · 9 comments
Open
2 of 3 tasks

Support for references #24

Vitaliy-1 opened this issue Jun 24, 2020 · 9 comments

Comments

@Vitaliy-1
Copy link
Owner

Vitaliy-1 commented Jun 24, 2020

  • - Parse references from JATS XML and save the raw text in the citations table.
  • - Reflect the reference structure in the citation_settings table.
  • - Consider making a background for the support of different citation styles.
@Vitaliy-1
Copy link
Owner Author

@NateWr, Currently there isn't an easy way to save citations from a hook as they are being rewritten in PKPPublicationService::edit: https://github.com/pkp/pkp-lib/blob/d5c9d956ba6f611253f06853c01d3309b7ca57b6/classes/services/PKPPublicationService.inc.php#L530
Ideally, this code should be executed before the hook or allow modification of params by reference.

@NateWr
Copy link

NateWr commented Aug 17, 2020

Have you considered just removing the existing saved citations and saving your own? It's not the most performant approach, but typically write actions aren't where we see performance bottlenecks, so it may be alright.

I'm a little nervous about letting plugins modify the $params because it can lead to cross-plugin errors that are hard to identify and debug. For example, if someone wrote a separate plugin that hooked in and took some actions based on references in $params, the two plugins would conflict depending on their load order. How would this impact the Crossref Reference Linking plugin, for example?

@Vitaliy-1
Copy link
Owner Author

@NateWr, yes, this was the initial plan. I've saved citations in a citationsRaw and they have been successfully parsed. The problem is that I can't add anything to the citation_settings. The hook appears before the importCitations which deletes all of the citations associated with the current publication id.

@NateWr
Copy link

NateWr commented Aug 17, 2020

Ah, I understand now. For the hook system to work like this you probably would want a citation service class and something like a Citation::add hook. It may be that we just need to add a hook to CitationDAO::insertObject() in the interim.

Can you describe what you're trying to do in more detail? I'm wondering if it's better to handle your citation needs in a different way.

@Vitaliy-1
Copy link
Owner Author

The idea is to parse references from the JATS XML, convert to the raw text but preserve the structure in the citation_settings:
example

@NateWr
Copy link

NateWr commented Aug 17, 2020

What about removing the existing citationsRaw field from the form altogether? In that case, you'd do all of the citation stuff yourself from the XML.

@Vitaliy-1
Copy link
Owner Author

I thought about that but didn't find a way to do this easily from a plugin.

@Vitaliy-1
Copy link
Owner Author

I mean depending on user input. Say, if an option with a file from which to parse references is selected.

@Vitaliy-1
Copy link
Owner Author

Or I can add an option to the plugin's settings and if it's chosen to remove that field...

Vitaliy-1 added a commit that referenced this issue Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants