Changeset 857
- Timestamp:
- 06/19/07 13:50:38 (2 years ago)
- Files:
-
- BADataMunger/trunk/modsmixer.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
BADataMunger/trunk/modsmixer.py
r845 r857 76 76 logging.warning("found multiple matches in on short title library for '%s = %s" % (s_short_title.encode('latin', 'xmlcharrefreplace'), s_title.encode('latin', 'xmlcharrefreplace'))) 77 77 if len(lnodes) == 0: 78 squery = u"*[local-name()='abstract']/descendant::*[local-name()='i' and contains(normalize-space(.),'%s')]/ancestor::mods:mods" % s_title 79 if len(snode.xpath(squery)) == 0: 80 logging.warning("unmatched article '%s'" % s_short_title.encode('latin', 'xmlcharrefreplace')) 81 else: 82 logging.warning("unmatched book '%s = %s" % (s_short_title.encode('latin', 'xmlcharrefreplace'), s_title.encode('latin', 'xmlcharrefreplace'))) 78 squery = u"*[local-name()='abstract']/descendant::*[local-name()='i' and contains(normalize-space(),'%s')]/ancestor::*[local-name() = 'mods']" % s_title.encode('ascii', 'xmlcharrefreplace') 79 try: 80 if len(snode.xpath(squery)) == 0: 81 logging.warning("unmatched article '%s'" % s_short_title.encode('ascii', 'xmlcharrefreplace')) 82 else: 83 logging.warning("unmatched book '%s = %s" % (s_short_title.encode('ascii', 'xmlcharrefreplace'), s_title.encode('latin', 'xmlcharrefreplace'))) 84 except: 85 logging.warning("something went horribly wrong") 86 logging.warning("squery = %s" % squery.encode('ascii', 'backslashreplace')) 83 87 if len(lnodes)==1: 84 88 # one match, so gather up all the data we will need … … 183 187 richecked = 0 184 188 orphtot = 0 189 libfails = [] 185 190 while orphans: 186 191 for relatedItem in relatedItems: … … 190 195 if len(lnodes) != 1: 191 196 logging.warning("failure seeking %s in library file; match count = %s" % (ri_id, len(lnodes))) 192 break197 libfails.append(ri_id) 193 198 else: 194 199 orphtot += 1 … … 197 202 relatedItems = self.student.xpath("//mods:relatedItem", NSD) 198 203 ricount = len(relatedItems) 199 if ricount <= richecked:204 if ricount - len(libfails) <= richecked: 200 205 orphans = False 201 206 richecked = 0
