How to add new set (ojs 2.4.8)

Hello community.

How are you.
I have a question. Do not type this query in another post. I nesesti or add a new set to my ojs (OJS 2.4.8) (set is an optional construct for grouping items for the purpose of selective harvesting).
In what place do you manage the “set” that part of the code, folder, plugin I should look and modify (either a file or several) to be able to add a new set?

set1

In the code I found in two parts with references to OAI:

lib/pkp/classes/oai/OAI.inc.php

classes/oai/ojs/JournalOAI.inc.php

Which of the two handles the OAI in OJS. What should I modify to add a new set in my ojs. The two files or one of them?

This is what I do not understand. as the set adds the ojs. I understand that it does it automatically, the name of Jounal read it from the database and I add it as an automatic set. Can I do the same for a new set?

I hope you can help me and guide me.
Best Regards
Cristian

Hi @cristianviza,

OJS by default includes sets for each journal and each journal section. For OJS 2.x, you can see an example of a plugin adding another set in the OpenAIRE and DRIVER plugins.

Regards,
Alec Smecher
Public Knowledge Project Team

Hello @asmecher and community.

I add new set with a new SNRD plugin link. (basically the modified DRIVER plugin). Now I want to filter some items in that set. I just want to list the articles that have certain information in the metadata (now list all) in table article_setting (database). I think I can link it by modifying the functions isSNRDRecord , isSNRDArticle (snrd/SNRDPlugin.inc.php) . but y don’t know how. how do I want get the value of an article setting for compare →
example:
title or date publisher. $ article-> ??
if ( ($journal->getSetting(‘publishingMode’) == PUBLISHING_MODE_OPEN) && article-> ?? ) …

Regads
Cristian

Hi @cristianviza,

I would suggest browsing the Doxygen documentation for the Article class for available functions:
https://pkp.sfu.ca/ojs/doxygen/master/html/classArticle.html

Regards,
Alec Smecher
Public Knowledge Project Team

1 Like

hi
how are everybody .

@asmecher
finally I can filter articles (in set SNRD) by element in metadata of article. This applies to each magazine that activates the plugin ( web oai magazine: http://…/ojs248/index.php/papeles/oai?verb=ListSets → list my new set and filter OK).

Now I’m working on the next step. I need to apply this filtering to all system articles, regardless of which magazine they belong to ( general web url oai: http://127.0.0.1/ojs248/index.php/index/oai?verb=ListSets → don’t list my new set).

where you recommend I place my plugin and I need modify so that its filtering is taken in the url of the general site oai for all articles.

Regards
Cristian

Hi @cristianviza,

This would need to be a site-wide plugin. You’ll need to implement the isSitePlugin function to return true in your plugin class; you may also need to update its entry in the versions table (the sitewide column).

Regards,
Alec Smecher
Public Knowledge Project Team

Hello @asmecher

I code isSitePlugin in php function and sitewide=1 in database as you indicated. Now my set appear in http://XXXXXX/ojs248/index.php/index/oai?verb=ListSets :smile::smile:

but when I filter with srt snrd

http://XXXXXX/ojs248/index.php/index/oai?verb=ListIdentifiers&metadataPrefix=oai_dc&set=snrd

Return this: noRecordsMatch->No matching records in this repository :frowning_face:

When I make the same query, positioned in a magazine if I correctly return the marked items. Example in: http://XXX/ojs248/index.php/papeles/oai?verb=ListSets

I’m baffled. I think he looks for the magazine named “index” and does not resolve to return null, but I don’t know where to start looking. I want plugin browse all the articles (all journals in the system).

Do have any recommendation for my problem @asmecher ?

Regards
Cristian

hello @asmecher

how are you? thanks for you response.

I have this function (in OpenSNRDPlugin.inc.php):

/**
* Get OpenSNRD records or identifiers
*/
function recordsOrIdentifiers($hookName, $params) {
$journalOAI =& $params[0];
$from = $params[1];
$until = $params[2];
$set = $params[3];
$offset = $params[4];
$limit = $params[5];
$total = $params[6];
$records =& $params[7];

	$records = array();
	if (isset($set) && $set == 'snrd') {		
		$openSNRDDao =& DAORegistry::getDAO('OpenSNRDDAO');
		$openSNRDDao->setOAI($journalOAI);
		if ($hookName == 'JournalOAI::records') {
			$funcName = '_returnRecordFromRow';
		} else if ($hookName == 'JournalOAI::identifiers') {
			$funcName = '_returnIdentifierFromRow';
		}

		//list($journalId, null) = $this->getAllJournalsIds(......);
		$journalId = $journalOAI->journalId;
		$records = $openSNRDDao->getOpenSNRDRecordsOrIdentifiers(array($journalId, null), $from, $until, $offset, $limit, $total, $funcName);
		return true;
	}
	return false;
}

query oai set works ok for a one journal (in web of the jornaul), but when I execute th same query set in site-wide no return record. why? .
I want to build a function that returns all the journals,
Something like
$this->dao->setOAI($this);
$sectionSpec=null;
$journalId = null;
$journalSpec = ‘snrd’;
list($journalsIds, null) = $this->dao->getAllJournalsId($journalSpec, $sectionSpec, $journalId);

to pass the result to

$records = $openSNRDDao->getOpenSNRDRecordsOrIdentifiers(array( **$journalsIds** , null), $from, $until, $offset, $limit, $total, $funcName)

is this possible pass a get records o identifier list of all ids of journal and return a full record (all de journals) ?

Regards
Cristian