From b47d8e8a102585f0105e7b3b8232c312462749fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriele=20H=C3=B6fler?= Date: Mon, 18 Nov 2019 13:04:03 +0100 Subject: [PATCH] Update documentation Add specific READMEs for almasru and marc_extractor --- marc_tools/README.md | 33 ++++++++++++++++++++++++++ setup.py | 2 +- sru/README.md | 56 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 marc_tools/README.md create mode 100644 sru/README.md diff --git a/marc_tools/README.md b/marc_tools/README.md new file mode 100644 index 0000000..bb34e1c --- /dev/null +++ b/marc_tools/README.md @@ -0,0 +1,33 @@ +# MARC Extractor + +Create extraction patterns for MARC-categories, indicators and subfields and extract the according data from XML files. + +## Usage + +The function **build\_extractor** lets you construct an extractor. It contains a pattern, a selector and a collector character. + +``` +pattern = '700 1 _ $$a ; 700 1 _ $$0 ; 700 1 _ $$a ; 700 1 _ $$0' +selector = '$$4 egr ; $$4 egr ; $$4 ill ; $$4 ill' +collector_char = ';' +build_extractor(pattern, selector, collector_char) +``` + +### Pattern +A pattern may contain a series of MARC-categories with the following attributes: +* tag only (if it is a controlfield, like 009) +* tag with inds only +* tag with both inds and subfield + +It is possible to list more than one MARC-category with a delimiter of a semicolon or a greater than sign. +* semicolon delimits a list of MARC-categories where the values should be concatenated with the given delimiter. +* greater than delimits a list of MARC-categories where the first that is actually encountered will be used, but none of the following. + +### Selector +Use the selector if you need to restrict by content of a specific subfield. So far this was mainly used to restrict 700 $$a (contributer) to a specific relationship to the work 700 $$4 (e. g. illustrator) and can only be used between subfields of the same category. + +### Collector Character +Delimiter used in the output for categories that are concatenated. + +# Author +Stefan Karner diff --git a/setup.py b/setup.py index 2e65a0c..e780ace 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ with open ("README.md", "r") as fh: setuptools.setup( name="catalogue-onb-labs", - version="2019.06", + version="2019.11", author="ÖNB Labs Team", author_email="labs@onb.ac.at", description="Ex Libris Alma interfaces and MARC tools", diff --git a/sru/README.md b/sru/README.md new file mode 100644 index 0000000..e9c223e --- /dev/null +++ b/sru/README.md @@ -0,0 +1,56 @@ +# Alma SRU + +This module is intended for searching the library software system Alma +for single or multiple records. The search for single records must be +done with a unique ID (e. g. Barcode) and will return exactly one +xml.etree.ElementTree Element. The search for multiple records will +return an iterable containing such Elements. + +When querying for multiple records, keep in mind that Ex Libris limits +the retrieval of records to 10k. + +To use this module you will need to know at least the following +information: +* The subdomain of the Alma installation +* The institution code of the institution you want to query +* Which format you want returned + +See also [Ex Libris' documentation on SRU](https://developers.exlibrisgroup.com/alma/integrations/SRU/) and +[general information on SRU by the LOC](http://www.loc.gov/standards/sru/). + +## Usage + +From almasru instantiate RecordRetriever with the necessary information: +``` +onbalma = almasru.RecordRetriever('obv-at-oenb', '43ACC_ONB', 'marcxml') +``` + +If you want to query the Austrian National Library's catalogue, take a look at onbsru. + +You can either query by unique ID (usually AC-number, MMS-ID or Barcode) or get multiple +records at once. If you query by unique ID and more than one record is returned, +you will get a Not Unique-Exception. + +### By Unique ID + +There are shorthands for AC-number, MMS-ID or Barcode: +``` +onbalma.by_marc_009('AC13425588') +onbalma.by_barcode('+Z171377605') +onbalma.by_mms_id('990000063950503338') +``` + +They all are based on a more general method for retrieving records by unique ID: +``` +onbalma.get_unique('alma.local_control_field_009=AC13425588') +``` + +### By Any Query +For documentation on what can be queried here, look at the out of the box +[search indexes](https://knowledge.exlibrisgroup.com/Alma/Product_Documentation/010Alma_Online_Help_(English)/040Resource_Management/040Metadata_Management/180Search_Indexes/050MARC_21_Search_Indexes) of Alma and at the [explain operation](https://obv-at-oenb.alma.exlibrisgroup.com/view/sru/43ACC_ONB?version=1.2&operation=explain) of SRU. +``` +onbalma.get_multiple('alma.date_of_publication=1848 and alma.country_of_publication=XA-AAAT') +``` + +# Author +Gabriele Höfler -- GitLab