Created
May 14, 2013 18:18
-
-
Save lbjay/5578191 to your computer and use it in GitHub Desktop.
getting keyword data from invenio
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from invenio.search_engine import perform_request_search, get_record, print_record | |
# ... get the bibcodes somehow | |
bibs = ['2012PhRvA..86e3813B', ...] | |
for bib in bibs: | |
for rec_id in perform_request_search(p="970:%" % bib, cc="ADS metadata repository"): | |
# 'rec' is a list/tuple structure that is structured according to the MARC | |
# format. Field #653 is where any "free" keywords are stored; field #695 is for | |
# "controlled" keywords. See http://adsset/trac/ads-invenio/wiki/howtomarcADS for | |
# subfields, etc. | |
rec = get_record(rec_id) | |
free_keywords = rec.get("653", []) | |
controlled_keywords = rec.get("695", []) | |
...or... | |
# you could also get the xml for the record, parse it, and use xpath or whatever | |
# to extract the 653/695 fields | |
xml = print_record(rec_id,'xm') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment