OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



How I implemented OAI 'Sets' per each conference.

Are you responsible for making OCS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, michael, John

Forum rules
What to do if you have a technical problem with OCS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved. Please note that this FAQ is OJS-centric, but most issues are applicable to both platforms.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OCS Conference Support and Discussion subforum; if you have a development question, try the OCS Development subforum.

How I implemented OAI 'Sets' per each conference.

Postby bdgregg » Tue Oct 26, 2004 6:49 am

All,

I was able to implement "Sets" via the oai interface via the following changes to the functions.inc.php file in the ocs/oai/include directory. Standard disclaimer.. Use at your own risk. This was only tested in a multiple conference configuration. It should work in a single conference setup as well.

BTW this is for version OCS 1.1.5.

This was the output of 'diff -c functions.inc.php functions.inc.php.orig'.

Code: Select all
*** functions.inc.php   Tue Oct 26 09:07:44 2004
--- functions.inc.php.orig      Mon Oct 25 13:48:25 2004
***************
*** 53,59 ****
  function getIdentifiers($metadataPrefix, $from, $until, $set, &$offset, &$tota
l) {
        global $oai_config, $db, $dbtable;
       
!       $sql = "SELECT cf, id, timestamp FROM $dbtable[papers] WHERE accepted='t
rue' ";
       
        // determine parameters for selective harvesting
        $where = array();
--- 53,59 ----
  function getIdentifiers($metadataPrefix, $from, $until, $set, &$offset, &$tota
l) {
        global $oai_config, $db, $dbtable;
       
!       $sql = "SELECT id, timestamp FROM $dbtable[papers] WHERE accepted='true'
 ";
       
        // determine parameters for selective harvesting
        $where = array();
***************
*** 60,69 ****
        if(isset($from)) { array_push($where, "timestamp>='" . date("Y-m-d", $fr
om) . "'"); }
        if(isset($until)) { array_push($where, "timestamp<='" . date("Y-m-d", $u
ntil) . "'"); }
        if(!empty($where)) { $sql .= "AND " . join(" AND ", $where) . " "; }
!       if(isset($set)) { $sql .= "AND cf='" . $set . "'"; } else {
        $sql .= "ORDER BY id";
!       }
!
        $result = $db->query($sql);
        $total = $db->num_rows($result);
       
--- 60,68 ----
        if(isset($from)) { array_push($where, "timestamp>='" . date("Y-m-d", $fr
om) . "'"); }
        if(isset($until)) { array_push($where, "timestamp<='" . date("Y-m-d", $u
ntil) . "'"); }
        if(!empty($where)) { $sql .= "AND " . join(" AND ", $where) . " "; }
!       
        $sql .= "ORDER BY id";
!       
        $result = $db->query($sql);
        $total = $db->num_rows($result);
       
***************
*** 76,87 ****
                $identifiers = array();
               
                for($offset, $max=$offset + $oai_config[max_identifiers]; $offse
t<$max && $offset<$total; $offset++) {
!                       list($cf, $id, $datestamp) = $db->assoc_array($result, $
offset);
!                       array_push($identifiers, array("identifier" => getIdenti
fierFromID($id),
!                                                       "datestamp" => UTCDate(t
imestamp2php($datestamp)),
!                                                       //"set" => "conference-p
apers")
!                                                       "set" => "$cf")
!                                 );
                }
               
                return $identifiers;
--- 75,82 ----
                $identifiers = array();
               
                for($offset, $max=$offset + $oai_config[max_identifiers]; $offse
t<$max && $offset<$total; $offset++) {
!                       list($id, $datestamp) = $db->assoc_array($result, $offse
t);
!                       array_push($identifiers, array("identifier" => getIdenti
fierFromID($id), "datestamp" => UTCDate(timestamp2php($datestamp)), "set" => "co
nference-papers"));
                }
               
                return $identifiers;
***************
*** 148,172 ****
  function getSets(&$offset, &$total) {
        global $oai_config, $db, $dbtable;
       
!       #return array("conference-papers");
!
!       $result = $db->query("select id,name,intro from $dbtable[conference]");
!       $total = $db->num_rows($result);
!
!       if($total == 0) {
!               return array();
!       } else {
!           $records = array();
!             for($offset, $max=$offset + $oai_config[max_records]; $offset<$max
 && $offset<$total; $offset++) {
!               $items = $db->assoc_array($result,$offset);
!               array_push($records,array(
!                               "spec" => $items[id],
!                               "name" => $items[name],
!                               "description" => $items[intro])
!               );
!           }
!           return $records;
!       }
  }
 
 
--- 143,149 ----
  function getSets(&$offset, &$total) {
        global $oai_config, $db, $dbtable;
       
!       return array("conference-papers");
  }
 
 
***************
*** 277,284 ****
        return array(
                "identifier" => $baseurl . "viewabstract.php?id=$items[id]&cf=$i
tems[cf]",
                "datestamp" => UTCDate(timestamp2php($items[timestamp])),
!               //"set" => "conference-papers",
!               "set" => $items[cf],
                "title" => $items[title],
                "creator" => $creator,
                "subject" => array($items[discipline], $items[topic]),
--- 254,260 ----
        return array(
                "identifier" => $baseurl . "viewabstract.php?id=$items[id]&cf=$i
tems[cf]",
                "datestamp" => UTCDate(timestamp2php($items[timestamp])),
!               "set" => "conference-papers",
                "title" => $items[title],
                "creator" => $creator,
                "subject" => array($items[discipline], $items[topic]),
bdgregg
 
Posts: 117
Joined: Wed Sep 15, 2004 8:21 am
Location: University of Pittsburgh

Return to OCS Technical Support

Who is online

Users browsing this forum: No registered users and 1 guest