项目作者: amasotti

项目描述 :
Extract classifications from the k10+ opac
高级语言: Go
项目地址: git://github.com/amasotti/extract_classifications.git
创建时间: 2021-01-27T12:20:54Z
项目社区:https://github.com/amasotti/extract_classifications

开源协议:GNU General Public License v3.0

下载


Classify (K10+)

Work in progress

The idea is to create a small flexible tool to extract library classifications (rvk, bkl, ddc, lcc) from the GVK Catalogue given a query (keyword, title, author etc…)

  • Sru address

    1. https://sru.k10plus.de/gvk

The SRU protocol supports several output formats. This scritp works (at moment at least) only with the MODS format.

This is a personal project, created mostly for fun, to learn Go and to make some of my daily-tasks easier. It is not perfect at all
but feel free to play with the code or suggest me improvements. Install the code (with correctly installed GO environment) in your directory using

  1. go get github.com/extract_classifications

Build the binary with

  1. go build main.go

Play with it ;)

Usage:

  1. Usage:
  2. $ klassify_10.exe + parameters (at least -q):
  3. -k query Key (bkl, tit, per, slw (default: all)
  4. -q query String (the text to search)
  5. -v verbose (bool) prints everything on the console, not recommended (debug purpose only)
  6. -s save (bool) if true saves the retrieved xml and the json output files (default : false)
  7. -n number of Results (integer) specifiers how many results will be printed on the console
  8. -p path (string) which subdirectory of the current working directory will be used to save the files (works only if -s is set)
  9. -m maxResult how many entries should be retrieved

Subjects Headings

Authority:

Check loc.gov for a complete list of authority codes.

Example of raw data in MODS format:

see test example

Output examples:

Json output example

Classification

  1. {
  2. "lcc": {
  3. "AG": 1,
  4. "B": 2,
  5. "B1-5802": 1,
  6. ...
  7. },
  8. "ddc": {
  9. "000": 6,
  10. "001": 1,
  11. "001.51": 1,
  12. ...
  13. },
  14. "bisacsh": {},
  15. "BISAC": {
  16. "ART 043000": 1,
  17. "ART015000": 2,
  18. "ART015100": 1,
  19. ...
  20. },
  21. "bkl": {
  22. "02.01": 3,
  23. "02.02": 1,
  24. "02.13": 4,
  25. ...
  26. },
  27. "rvk": {
  28. "AK 18000": 2,
  29. "AK 39500": 2,
  30. "AK 39540": 1,
  31. ...
  32. }
  33. }

Console output

  1. $ go run main.go -k swl -q "Umberto Eco" -m 580
  2.  
  3. 2021/01/28 16:21:14 GET https://sru.gbv.de/gvk?version=1.1&operation=searchRetrieve&query=pica.all=Umberto%20Eco&recordSchema=mods&maximumRecords=580
  4.  
  5. Number of results: 580
  6. ------------------------------------------------------------------
  7. SUBJECT HEADINGS
  8. ------------------------------------------------------------------
  9.  
  10. Printing the 5 most common Subject Headings for your query:
  11.  
  12. Geschichte : 54
  13. Literatur : 39
  14. Semiotik : 28
  15. Criticism and interpretation : 27
  16. Kunst : 26
  17. 20th century : 25
  18. History and criticism : 24
  19.  
  20.  
  21. CLASSIFICATIONS
  22. ------------------------------------------------------------------
  23. The 7 most common Lcc classifications for your query
  24.  
  25. PQ4865.C6 : 41
  26. PQ : 18
  27. PN : 10
  28. P99 : 7
  29. PN241 : 5
  30. D : 3
  31. BH81 : 3
  32.  
  33. The 7 most common Ddc classifications for your query
  34.  
  35. 850 : 40
  36. 853 : 24
  37. 800 : 19
  38. 850 B : 19
  39. 853.914 : 15
  40. 700 : 14
  41. 809 : 14
  42.  
  43. The 7 most common BISAC classifications for your query
  44.  
  45. LIT004200 : 2
  46. LIT006000 : 2
  47. LIT 006000 : 2
  48. LIT000000 : 2
  49. ART015000 : 2
  50. LIT 004200 : 2
  51. POL 019000 : 1
  52.  
  53. The 7 most common Bkl classifications for your query
  54.  
  55. 18.27 : 118
  56. 17.97 : 79
  57. 18.00 : 44
  58. 20.06 : 22
  59. 17.73 : 15
  60. 17.08 : 15
  61. 08.41 : 11
  62.  
  63. The 7 most common Rvk classifications for your query
  64.  
  65. IV 25480 : 108
  66. IV 25481 : 35
  67. LH 61040 : 15
  68. CC 6900 : 14
  69. AK 39580 : 8
  70. ER 730 : 8
  71. EC 1070 : 7
  72.  

ToDO

  • Use net/http to download the xml from the web instead of loading it manually (or possibly leave both options open)
  • Allow multiple keywords separated by AND
    1. slw : "Umberto Eco AND Semiotik"
  • Allow for more than one query key (at moment only slw Schlagwort possible)
    • Allow more than one key at the same time
  • Give a closer look at the Go idiomatic way of initializing new structs and saving values passing them to the pointers
  • Implement or use a counter to see if some keywords (Schlagwörter) are used more than other
    • Still to do : sort the mapping

Other databases

B3Kat (Berlin-Brandenburg)

  1. http://bvbr.bib-bvb.de:5661/bvb01sru?version=1.1&recordSchema=marcxml&operation=searchRetrieve&query=marcxml.subject=Umberto%20Eco&maximumRecords=20

Beispiele