Newer
Older
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"outputs": [],
"source": [
"from sickle import Sickle"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"get a ABO MMS-ID"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"sickle = Sickle('https://eu02.alma.exlibrisgroup.com/view/oai/43ACC_ONB/request')\n",
"records = sickle.ListRecords(metadataPrefix='oai_dc', set='ABODC')\n",
"meta = records.next().metadata\n",
"ids = meta.get('identifier')"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'9957805251203338'"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mms = [i for i in ids if i.startswith('alma:43ACC_ONB/bibs/')]\n",
"mms[0].strip('alma:43ACC_ONB/bibs/')"
]
},
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
{
"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,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",