Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

viaf.py 842 B

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
  1. import logging
  2. from invoke import task
  3. import support as s
  4. _log = logging.getLogger(__name__)
  5. @task(s.init, s.build, name='import')
  6. def import_viaf(c, date='20181104', force=False):
  7. "Import VIAF data"
  8. s.start('viaf-import', force=force)
  9. _log.info('initializing VIAF schema')
  10. s.psql(c, 'viaf-schema.sql', True)
  11. infile = s.data_dir / f'viaf-{date}-clusters-marc21.xml.gz'
  12. _log.info('importing VIAF data from %s', infile)
  13. s.pipeline([
  14. [s.bin_dir / 'parse-marc', '--db-schema', 'viaf', '-t', 'marc_field', '--line-mode', infile]
  15. ])
  16. s.finish('viaf-import')
  17. @task(s.init)
  18. def index(c, force=False):
  19. "Index VIAF data"
  20. s.check_prereq('viaf-import')
  21. s.start('viaf-index', force=force)
  22. _log.info('building VIAF indexes')
  23. s.psql(c, 'viaf-index.sql', True)
  24. s.finish('viaf-index')
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...