Library - unsorted: Difference between revisions

From Helpful
Jump to navigation Jump to search
(Created page with "{{Library related}} {{stub}} =Semi-sorted= ==On what various common identifiers really are, and what that means to mapping between them== {{stub}} <!-- '''Mapping betwee...")
 
 
(2 intermediate revisions by the same user not shown)
Line 186: Line 186:


Documentation example:
Documentation example:
<code lang="python">
<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 exxample with CCL (there are other options)
# 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()
</code>
</syntaxhighlight >




[[Category:Library related]]
[[Category:Library and research data]]

Latest revision as of 17:42, 11 September 2023

This article/section is a stub — some half-sorted notes, not necessarily checked, not necessarily correct. Feel free to ignore, or tell me about it.


Semi-sorted

On what various common identifiers really are, and what that means to mapping between them

This article/section is a stub — some half-sorted notes, not necessarily checked, not necessarily correct. Feel free to ignore, or tell me about it.




MARC field 035 (Local System Number) will often store a (bracketed) string identifier to disambiguate the type of identifier stored there, including:

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

This article/section is a stub — some half-sorted notes, not necessarily checked, not necessarily correct. Feel free to ignore, or tell me about it.

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()