OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Bibtex Parser Plugin

The Plugin Gallery is a venue for users of PKP software to share their plugins.

Moderators: jmacgreg, michael, John

Forum rules
If you post a plugin here, please include information on which versions of which applications it is compatible with. Attach a tarball of the plugin (e.g. tar cvzf myPlugin-0.1.tar.gz plugins/generic/myPlugin). Thanks for contributing!

Bibtex Parser Plugin

Postby beyzak » Thu Feb 13, 2014 7:18 am

Hi,
I have developed a bibtex plugin to use in the citation assistant. When editor writes a reference in bibtex format, it will be parsed via this plugin.
However, I think installing this plugin is different than other plugins such as plugins about citationFormats.
I have written version.xml and "PKPBibtexCitationParserPlugin.inc.php" class that imports "lib.pkp.plugins.citationParser.PKPBibtexCitationParserPlugin". Like the other formats in "lib.pkp.plugins.citationParser", bibtex contains locale and filter folders where the actual parsing is done.
I am not sure how to add this plugin i.e what tar.gz should include.

I would appreciate the quick response, thanks in advance.

Beyza
Software Developer
beyzak
 
Posts: 4
Joined: Thu Feb 13, 2014 6:55 am

Re: Bibtex Parser Plugin

Postby asmecher » Thu Feb 13, 2014 12:36 pm

Hi Beyza,

To distribute the plugin and use the web-based plugin installation tools, include the plugin's directory in the .tar.gz file. For example, if your plugin is called "example", the plugin files should be example/index.php, example/ExamplePlugin.inc.php, example/version.xml, etc.

If you have a github repository containing the code, I'd be happy to review it.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8905
Joined: Wed Aug 10, 2005 12:56 pm

Re: Bibtex Parser Plugin

Postby beyzak » Fri Feb 14, 2014 2:22 am

Hi Alec,

What you have explained is for citaitonFormats, I think. But what I have done is for citationParsers which include ExamplePlugin.inc.php and version.xml as in OJS source code. It is okay so far. But ExamplePlugin.inc.php imports "lib.pkp.plugins.PKPExamplePlugin". So I need to add PKPExamplePlugin and other filter classes where the actual filtering is done to .tar.gz file. I am not sure how to include them.

I have added the code to my github repository: https://github.com/beyzakokcan/bibtexparser-ojs

Thanks.
Beyza
beyzak
 
Posts: 4
Joined: Thu Feb 13, 2014 6:55 am

Re: Bibtex Parser Plugin

Postby asmecher » Fri Feb 14, 2014 8:57 am

HI Beyza,

Plugins involving components in both plugins/... and lib/pkp/plugins/... aren't currently supported by the web-based installer. We've written certain plugins this way in the OJS codebase because we're attempting to re-use code that's also used by other applications making use of the pkp-lib submodule (e.g. OMP); you won't need to do the same thing in your case. Move the superclass contents into the plugins/... component of the plugin instead; you won't need anything in lib/pkp/plugins/... this way.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8905
Joined: Wed Aug 10, 2005 12:56 pm

Re: Bibtex Parser Plugin

Postby beyzak » Tue Feb 18, 2014 7:38 am

Thank you Alec,

I have one more question. Bibtex parser for citation asistant tool that I have written is working, if the type is one of the nlm30-publication-types. I am not sure where to add a different type such as "article".
To validate input against the property specification, first it goes to "isValid" method of "Metadataproperty" class. But it does not translate the value into "controlledVocabEntry".

Regards,
Beyza
beyzak
 
Posts: 4
Joined: Thu Feb 13, 2014 6:55 am

Re: Bibtex Parser Plugin

Postby asmecher » Tue Feb 18, 2014 11:12 am

Hi Beyza,

The controlled vocabulary entries are created upon metadata plugin installation from the "controlledVocabs.xml" file in the plugin's directory; see e.g. metadata/nlm30/schema/controlledVocabs.xml.

Alternately, you should be able to insert new values like...
Code: Select all
INSERT INTO controlled_vocab_entries (controlled_vocab_id, seq) VALUES (controlled_vocab_id_goes_here, 0);
INSERT INTO controlled_vocab_entry_settings (controlled_vocab_entry_id, locale, setting_name, setting_value, setting_type) VALUES (controlled_vocab_entry_id_goes_here, '', 'name', 'journal', 'string');
...replacing controlled_vocab_id_goes_here and controlled_vocab_entry_id_goes_here with the appropriate IDs.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8905
Joined: Wed Aug 10, 2005 12:56 pm

Re: Bibtex Parser Plugin

Postby beyzak » Tue Feb 25, 2014 2:42 am

Hi Alec,
I inserted a new publication type into controlled_vocab_entries and settings.
But, I have a problem in the "execute" method of the "Filter" class. The method is get called by different classes such as Nlm30CitationDemultiplexerFilter,GenericSequencerFilter etc. There is not any problem in the output of these classes but after Nlm30CitationSchemaCitationAdapter calls "execute" method, the output changes and the last "data" in the output becomes empty.
This problem is just for the new publication types. Am I missing something?

Thanks,
Beyza
beyzak
 
Posts: 4
Joined: Thu Feb 13, 2014 6:55 am

Re: Bibtex Parser Plugin

Postby asmecher » Tue Feb 25, 2014 9:11 am

Hi Beyza,

In filter code, when the output is blank it usually means that the filter's generated output didn't pass its own validation. Try temporarily removing the "@" error suppression in lib/pkp/classes/xslt/XMLTypeDescription.inc.php in the "checkType" function where the DTD, schema, and RELAX NG validation is implemented:
Code: Select all
                        case XML_TYPE_DESCRIPTION_VALIDATE_DTD:
                                if (!@$xmlDom->validate()) return false;
                                break;

                        case XML_TYPE_DESCRIPTION_VALIDATE_SCHEMA:
                                if (!@$xmlDom->schemaValidate($this->_validationSource)) return false;
                                break;

                        case XML_TYPE_DESCRIPTION_VALIDATE_RELAX_NG:
                                if (!@$xmlDom->relaxNGValidate($this->_validationSource)) return false;
                                break;
With the "@" characters removed, validation failures should result in an error message.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8905
Joined: Wed Aug 10, 2005 12:56 pm


Return to Plugin Gallery

Who is online

Users browsing this forum: No registered users and 2 guests