Browse Source

Toughened pid harvest

main
astanley 2 years ago
parent
commit
e6a83bfe75
  1. 2
      FoxmlWorker.py
  2. 9
      ImportServerUtilities.py

2
FoxmlWorker.py

@ -103,7 +103,7 @@ class FWorker:
re_nodes = self.root.findall(
f'.//foxml:datastream[@ID="RELS-EXT"]/foxml:datastreamVersion/foxml:xmlContent/rdf:RDF',
namespaces=self.namespaces)
if re_nodes is None:
if not re_nodes:
return re_values
re_node = re_nodes[-1]
for child in re_node.iter():

9
ImportServerUtilities.py

@ -46,9 +46,10 @@ class ImportServerUtilities:
# Gets PIDS, filtered by namespace directly from objectStore
@IU.ImportUtilities.timeit
def get_pids_from_objectstore(self, namespace=''):
namespace = f"info%3Afedora%2F{namespace}%3A"
wildcard = '*/*'
if namespace:
wildcard = f'*/*{namespace}*'
wildcard = f'*/{namespace}*'
pids = []
for p in Path(self.objectStore).rglob(wildcard):
pid = unquote(p.name).replace('info:fedora/', '')
@ -158,10 +159,8 @@ class ImportServerUtilities:
self.iu.conn.commit()
MS = ImportServerUtilities('island_archives')
tables = ['bdh', 'craipe', 'sdu', 'herbarium', 'islemag', 'leg', 'herbarium', 'islemag', 'pwc', 'peimag', 'lmmi']
for table in tables:
MS.add_mods_to_database(table)
MS = ImportServerUtilities('climate')
MS.build_record_from_pids('climate', 'outputs/climate_complete.csv')

Loading…
Cancel
Save