Esempio n. 1
0
 def _extract_holdings_type(self, record):
     ''' Extract holdings type from 007 field & 856 $u field. '''
     h856u = _extract(record, '856', 'u')
     if h856u and h856u.startswith('http://'):
         h_type = 'Online Resource'
     else:
         h_type = _holdings_type(_extract(record, '007'))
     return h_type
Esempio n. 2
0
 def _extract_holdings_type(self, record):
     ''' Extract holdings type from 007 field & 856 $u field. '''
     h856u = _extract(record, '856', 'u')
     if h856u and h856u.startswith('http://'):
         h_type = 'Online Resource'
     else:
         h_type = _holdings_type(_extract(record, '007'))
     return h_type
Esempio n. 3
0
    def load_xml_holding(self, record):
        # get the oclc number to link to
        oclc = _normal_oclc(_extract(record, '004'))
        if not oclc:
            _logger.error("holding record missing title: record %s, oclc %s" %
                         (self.records_processed, oclc))
            self.errors += 1
            return

        titles = self._get_related_title(oclc)
        if not titles:
            return

        # get the institution to link to
        inst_code = _extract(record, '852', 'a')
        inst = self._get_related_inst_code(inst_code)
        if not inst:
            return

        # get the holdings type
        holding_type = self._extract_holdings_type(record)

        # get the description
        desc = _extract(record, '866', 'a') or _extract(record, '866', 'z')
        notes = _extract(record, '852', 'z')

        # get the last modified date
        f008 = _extract(record, '008')
        date = self._parse_date(f008)

        # persist it
        for title in titles:
            holding = models.Holding(title=title,
                                     institution=inst,
                                     description=desc,
                                     type=holding_type,
                                     last_updated=date,
                                     notes=notes)
            holding.save()
            self.holding_created += 1
        reset_queries()
Esempio n. 4
0
    def load_xml_holding(self, record):
        # get the oclc number to link to
        oclc = _normal_oclc(_extract(record, '004'))
        if not oclc:
            _logger.error("holding record missing title: record %s, oclc %s" %
                          (self.records_processed, oclc))
            self.errors += 1
            return

        titles = self._get_related_title(oclc)
        if not titles:
            return

        # get the institution to link to
        inst_code = _extract(record, '852', 'a')
        inst = self._get_related_inst_code(inst_code)
        if not inst:
            return

        # get the holdings type
        holding_type = self._extract_holdings_type(record)

        # get the description
        desc = _extract(record, '866', 'a') or _extract(record, '866', 'z')
        notes = _extract(record, '852', 'z')

        # get the last modified date
        f008 = _extract(record, '008')
        date = self._parse_date(f008)

        # persist it
        for title in titles:
            holding = models.Holding(title=title,
                                     institution=inst,
                                     description=desc,
                                     type=holding_type,
                                     last_updated=date,
                                     notes=notes)
            holding.save()
            self.holding_created += 1
        reset_queries()