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 832 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
31
  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', force=force)
  9. _log.info('initializing VIAF schema')
  10. s.psql(c, 'viaf-schema.sql')
  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', '--line-mode', infile],
  15. ['psql', '-c', '\\copy viaf_marc_field FROM STDIN']
  16. ])
  17. s.finish('viaf')
  18. @task(s.init)
  19. def index(c, force=False):
  20. "Index VIAF data"
  21. s.check_prereq('viaf')
  22. s.start('viaf-index', force=force)
  23. _log.info('building VIAF indexes')
  24. c.run('psql -af viaf-index.sql')
  25. s.finish('viaf-index')
Tip!

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

Comments

Loading...