Commit 51b8c183 authored by Georg Petz's avatar Georg Petz

list ONB OAI-PMH Sets

parent 4df120ae
......@@ -3,14 +3,19 @@
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"collapsed": true
},
"metadata": {},
"outputs": [],
"source": [
"from sickle import Sickle"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"get a ABO MMS-ID"
]
},
{
"cell_type": "code",
"execution_count": 2,
......@@ -44,6 +49,138 @@
"mms[0].strip('alma:43ACC_ONB/bibs/')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"list all available OAI-PMH Sets of the Austrian National Library"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"setSpec value for selective harvesting: PAPYRUSDC\n",
"Name of the set (setName): Papyri records in DC simple\n",
"\n",
"setSpec value for selective harvesting: FULLMARC\n",
"Name of the set (setName): Complete set of ONB records in MARC\n",
"\n",
"setSpec value for selective harvesting: HANNAMARC\n",
"Name of the set (setName): HANNA records in MARC\n",
"\n",
"setSpec value for selective harvesting: ESPERANTOMARC\n",
"Name of the set (setName): Esperanto records in MARC\n",
"\n",
"setSpec value for selective harvesting: ESPERANTODC\n",
"Name of the set (setName): Esperanto Records in DC simple\n",
"\n",
"setSpec value for selective harvesting: PAPYRUSMARC\n",
"Name of the set (setName): Papyri records in MARC\n",
"\n",
"setSpec value for selective harvesting: HANNADC\n",
"Name of the set (setName): HANNA records in DC simple\n",
"\n",
"setSpec value for selective harvesting: ABODC\n",
"Name of the set (setName): Austrian Books Online in DC simple\n",
"\n",
"setSpec value for selective harvesting: ARIADNEDC\n",
"Name of the set (setName): Ariadne records in DC simple\n",
"\n",
"setSpec value for selective harvesting: ARIADNEMARC\n",
"Name of the set (setName): Ariadne records in MARC\n",
"\n",
"setSpec value for selective harvesting: MAPMARC\n",
"Name of the set (setName): Maps and Globes records in MARC\n",
"\n",
"setSpec value for selective harvesting: FULLDC\n",
"Name of the set (setName): Complete set of ONB records in DC simple\n",
"\n",
"setSpec value for selective harvesting: MAPDC\n",
"Name of the set (setName): Maps and Globes records in DC simple\n",
"\n",
"setSpec value for selective harvesting: ABOMARC\n",
"Name of the set (setName): Austrian Books Online in MARC\n",
"\n",
"setSpec value for selective harvesting: OAIBIBLIOA\n",
"Name of the set (setName): Austrian Bibliography A\n",
"\n",
"setSpec value for selective harvesting: MUSHANDC\n",
"Name of the set (setName): Musikhandschriften in DC\n",
"\n",
"setSpec value for selective harvesting: MUSHANMARC\n",
"Name of the set (setName): Music Manuscripts\n",
"\n",
"setSpec value for selective harvesting: CERLMARC\n",
"Name of the set (setName): Old prints and manuscripts for CERL portal\n",
"\n"
]
}
],
"source": [
"oai_sets = sickle.ListSets()\n",
"for oai_set in oai_sets:\n",
" print('setSpec value for selective harvesting: ' + oai_set.setSpec)\n",
" print('Name of the set (setName): ' + oai_set.setName + '\\n')\n"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"mods\n",
"oai_dc\n",
"oai_qdc\n",
"marc21\n"
]
}
],
"source": [
"oai_formats = sickle.ListMetadataFormats()\n",
"for oai_format in oai_formats:\n",
" print(oai_format.metadataPrefix)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1868\n"
]
}
],
"source": [
"from lxml import etree\n",
"\n",
"namespaces = {\n",
" 'oai': 'http://www.openarchives.org/OAI/2.0/',\n",
" 'marc21': 'http://www.loc.gov/MARC21/slim'\n",
"} \n",
"\n",
"records = sickle.ListRecords(metadataPrefix='marc21', set='ABOMARC')\n",
"record_xml = records.next().xml\n",
"\n",
"tree = etree.ElementTree(record_xml)\n",
"\n",
"result = tree.xpath('/oai:record/oai:metadata/marc21:record/marc21:datafield[@tag=\\'264\\']/marc21:subfield[@code=\\'c\\']/text()', namespaces=namespaces)\n",
"print(result[0])"
]
},
{
"cell_type": "code",
"execution_count": null,
......@@ -54,23 +191,23 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"display_name": "Python 3",
"language": "python",
"name": "python2"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
"pygments_lexer": "ipython3",
"version": "3.6.7"
}
},
"nbformat": 4,
"nbformat_minor": 0
"nbformat_minor": 1
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment