Library - unsorted: Difference between revisions
mNo edit summary |
m (→Docs & notes) |
||
(One intermediate revision by the same user not shown) | |||
Line 186: | Line 186: | ||
Documentation example: | Documentation example: | ||
< | <syntaxhighlight lang="python"> | ||
from PyZ3950 import zoom | from PyZ3950 import zoom | ||
conn = zoom.Connection('z3950.loc.gov', 7090) | conn = zoom.Connection('z3950.loc.gov', 7090) | ||
Line 192: | Line 192: | ||
conn.preferredRecordSyntax = 'USMARC' | conn.preferredRecordSyntax = 'USMARC' | ||
# for | # for example with CCL (there are other options) | ||
query = zoom.Query('CCL', 'ti="this and that"') | query = zoom.Query('CCL', 'ti="this and that"') | ||
results = conn.search(query) | results = conn.search(query) | ||
Line 200: | Line 200: | ||
conn.close() | conn.close() | ||
</ | </syntaxhighlight > | ||
[[Category:Library and research data]] | [[Category:Library and research data]] |
Latest revision as of 17:42, 11 September 2023
Semi-sorted
On what various common identifiers really are, and what that means to mapping between them
MARC field 035 (Local System Number) will often store a (bracketed) string identifier to disambiguate the type of identifier stored there, including:
- OCoLC for OCLC numbers
- DLC for Library of Congress
- ...and many others MARC codes for organizations code/name search
You might for example see 035 $a(OCoLC)ocm69983298
When OCLC numbers are used in the MARC field 001(verify), they are prefixed using:
- ocm for eight-digit numbers (≤99999999)
- ocn for nine-digit numbers (≥100000000)
PyZ3950
Installation
You need the python PLY package or you will get ImportError: No module named lex. Also as of this writing, ubuntu's python-ply package seems to be broken, but since the modules are pure python, manually unpacking lex.py and yacc.py from the download (into the z3950 directory in your site-packages, for example) also works.
The 2.04 tarball has a bug in the install scripts that causes it to raise:
AttributeError: 'float' object has no attribute 'replace'
This seems to mean the version in vers.py should be a string, not a float.
Docs & notes
How to deal with slow/timeouting connects?
Documentation example:
from PyZ3950 import zoom
conn = zoom.Connection('z3950.loc.gov', 7090)
conn.databaseName = 'VOYAGER'
conn.preferredRecordSyntax = 'USMARC'
# for example with CCL (there are other options)
query = zoom.Query('CCL', 'ti="this and that"')
results = conn.search(query)
for result in results:
print result
conn.close()