Skip to content

Add Controlled Vocabulary Splitter 1.0.1.1 for OJS 3.5 - #541

Open
edersotto wants to merge 1 commit into
pkp:mainfrom
OJSBR:add-controlledVocabSplitter
Open

edersotto wants to merge 1 commit into
pkp:mainfrom
OJSBR:add-controlledVocabSplitter

Conversation

@edersotto

Copy link
Copy Markdown

Adds Controlled Vocabulary Splitter 1.0.1.1, a generic plugin for OJS 3.5 that splits keywords, subjects, disciplines and supporting agencies pasted as a single line into the separate terms the author meant.

The problem

Authors often copy the whole keyword line of their manuscript and paste it into the keyword field:

Palatal Expansion Technique. Clinical Protocol. Orthopedic appliance.

That is stored as one controlled-vocabulary entry. Readers see a sentence where tags should be, keyword clouds show the whole phrase and citation_keywords goes out as a single meta tag. In one journal we found it in every published article, in all three languages: 24 records that should have been 107 terms. Nothing in the current plugins.xml addresses it.

What it does

  • Splits the four publication vocabularies when a publication is saved (metadata form, submission wizard, REST API), created, or imported with the native XML import — including a command-line import.
  • Per journal: which vocabularies are split and which separators are honoured (semicolon; comma followed by a space; period followed by a space). Only the first separator found in an entry is used, so an inverted heading such as Hypertension, Pregnancy-Induced survives a list separated by semicolons.
  • Never cuts a period without a following space (Law 13.964/2019) or a period closing a single letter (S. aureus, E. coli).
  • A command-line tool (PKP\cliTool\CommandLineTool) repairs an existing archive, dry run by default.

How it plugs in

Core hooks only — Publication::edit, Publication::add and nativexmlpublicationfilter::execute — with every write going through Repo::controlledVocab(). No core class, template or UI component is replaced, and nothing is added to the reader-facing site. The hooks are registered unconditionally and each callback checks whether the plugin is enabled in the publication's journal, following pkp/pkp-lib#11793, so command-line imports are covered. Settings use the standard plugin settings form with POST and CSRF validation; at site level there is nothing to configure.

Tests

  • PHPUnit tests on PKP\tests\PKPTestCase (plugin classes against the installed PKP, splitting rules, the edit hook, site level, templates, 38 locales).
  • Cypress spec run by pkp/pkp-github-actions on OJS 3.5 (PHP 8.2/8.3, MySQL/PostgreSQL) — green for this release.
  • Regression suites for test installations (359 rule and write cases, 29 end-to-end cases with a real login), and a command-line native XML import checked by hand on OJS 3.5.0-3.
  • Tests stay in the repository; the release package contains only the plugin.

Checks run before opening this

  • xmllint --schema ./plugins.xsd ./plugins.xml --noout — validates.
  • The package URL resolves, the md5 in the entry matches the published tarball (bae6c99265adfa4960a6b81603edfa0c) and the tarball unpacks as a single controlledVocabSplitter/ directory.
  • Every hook and API used exists in pkp-lib 3_5_0-0, hence ~3.5.0.0.

Use of generative AI

Generative AI (Claude, by Anthropic) was used to write and run tests, improve the code and bring it in line with PKP standards. Every change was reviewed and tested by OJSBR, which maintains the plugin and is responsible for its releases.

GPL-3.0 · https://github.com/OJSBR/controlledVocabSplitter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant