OAI-PMH Subject division

Hi everybody

I have two OJS instances: One production site with 2.4.x and a fresh install with a new publication based on 3 version.

I want to publish the OAI-PMH endpoints to be harvested and found that in 2.4.x, the subject occurrences are joined and separated via a semicolon. I need one occurrence for subject. I’ve tried to find the part of the code in 2.4.x that creates the XML exposed but I got stuck in this part

/**
 * @see lib/pkp/plugins/oaiMetadataFormats/dc/PKPOAIMetadataFormat_DC::toXml()
 */
function toXml(&$record, $format = null) {

from \plugins\oaiMetadataFormats\dc\OAIMetadataFormat_DC.inc.php, I’ve found the referenced file, but cannot find where it maps the different metadata. BTW, I’ve found that in OJS3 is note exposed at all the subjects, but perhaps I should update my git copy? Is there any advance with the subject bug in OJS3?

Regards & thanks in advance
Germán

Hi @German_Biozzoli

I believe you are looking for this part of the code: ojs/Dc11SchemaArticleAdapter.inc.php at ojs-stable-2_4_8 · pkp/ojs · GitHub ?

Best,
Bozana

Thank you very much @bozana, I’ve changed

$subjects = $article->getSubject(null);
foreach ($subjects as $subject)
{
$terms = explode(";", $subject);
foreach ($terms as $term)
{
$this->_addLocalizedElements($dc11Description, ‘dc:subject’, $term);
}

}

And with this change, I’ve obtained

<dc:subject xml:lang="0">FOOD CONTROL</dc:subject>
<dc:subject xml:lang="0">WINES</dc:subject>
...

Is there a way to avoid the xml:lang=0? To not call the _localized method?

Regards & thanks
German

Hi @German_Biozzoli

The dc:subject element is defined as multilingual in the system, so it will need even more changes to change that i.e. to avoid the xml:lang attribute. But you could do something like this:
$subjects = $article->getSubject(null);
foreach ($subjects as $locale => $subject) {
$terms = explode(";", $subject);
foreach ($terms as $term) {
$this->_addLocalizedElements($dc11Description, ‘dc:subject’, array($locale => trim($term)));
}
}

This should handle the xml:lang attribute correctly, with the appropriate locale.

Best,
Bozana