Beispiel #1
0
 /**
  * Try to build an array of OCLC Number, ISBN or ISSN-based sub-queries by
  * using OCLC X-services against a record driver object.
  *
  * @param \VuFind\RecordDriver\AbstractBase $driver Record driver object
  *
  * @return array
  */
 protected function getQueryParts($driver)
 {
     $parts = [];
     $oclcNum = $driver->tryMethod('getCleanOCLCNum');
     if (!empty($oclcNum)) {
         $oclcList = $this->wcUtils->getXOCLCNUM($oclcNum);
         foreach ($oclcList as $current) {
             $parts[] = "oclc_num:" . $current;
         }
     }
     $isbn = $driver->tryMethod('getCleanISBN');
     if (!empty($isbn)) {
         $isbnList = $this->wcUtils->getXISBN($isbn);
         foreach ($isbnList as $current) {
             $parts[] = 'isbn:' . $current;
         }
     }
     $issn = $driver->tryMethod('getCleanISSN');
     if (!empty($issn)) {
         $issnList = $this->wcUtils->getXISSN($issn);
         foreach ($issnList as $current) {
             $parts[] = 'issn:' . $current;
         }
     }
     return $parts;
 }
Beispiel #2
0
 /**
  * Get identities related to the query.
  *
  * @return array
  */
 public function getIdentities()
 {
     // Extract the first search term from the search object:
     $search = $this->searchObject->getParams()->getQuery();
     $lookfor = $search instanceof Query ? $search->getString() : '';
     // Get terminology information:
     return $this->worldCatUtils->getRelatedIdentities($lookfor);
 }
Beispiel #3
0
 /**
  * Get terms related to the query.
  *
  * @return array
  */
 public function getTerms()
 {
     // Extract the first search term from the search object:
     $search = $this->searchObject->getParams()->getQuery();
     $lookfor = $search instanceof Query ? $search->getString() : '';
     // Get terminology information:
     $terms = $this->worldCatUtils->getRelatedTerms($lookfor, $this->vocab);
     // Wipe out any empty or unexpected sections of the related terms array;
     // this will make it easier to only display content in the template if
     // we have something worth displaying.
     if (is_array($terms)) {
         $desiredKeys = ['exact', 'broader', 'narrower'];
         foreach ($terms as $key => $value) {
             if (empty($value) || !in_array($key, $desiredKeys)) {
                 unset($terms[$key]);
             }
         }
     }
     return $terms;
 }