diff --git a/SRU.ipynb b/SRU.ipynb index 2ca52e50ee6f91a273d338394ed29e8474d1d18f..8f82e7ee2e26e982d36622915d269c9c8a1ea57a 100644 --- a/SRU.ipynb +++ b/SRU.ipynb @@ -120,7 +120,22 @@ " linksJoined = \", \".join(result)\n", " barcodesJoined = \", \".join(barcodes)\n", " #returns a list with URLs and Barcodes\n", - " return [linksJoined, barcodesJoined]" + " return [linksJoined, barcodesJoined]\n", + "\n", + "def getCatalogLink(local_mms_id):\n", + " print(local_mms_id)\n", + " cont=requests.get('https://open-na.hosted.exlibrisgroup.com/alma/43ACC_ONB/bf/entity/instance/' + local_mms_id).content\n", + " e = etree.XML(cont)\n", + " namespaces = {\n", + " 'rdf': 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',\n", + " 'bf': 'http://id.loc.gov/ontologies/bibframe/',\n", + " 'rdfs': 'http://www.w3.org/2000/01/rdf-schema#',\n", + " 'bflc': 'http://id.loc.gov/ontologies/bflc/'\n", + " } \n", + " result = e.xpath('/rdf:RDF/bf:Work/bf:partOf/bf:Work/bf:identifiedBy/bf:Identifier/rdf:value/text()', namespaces=namespaces)\n", + " if not result:\n", + " result = e.xpath('/rdf:RDF/bf:Instance/bf:identifiedBy/bf:Local/rdf:value/text()', namespaces=namespaces)\n", + " return 'http://data.onb.ac.at/rec/' + result[0]" ] }, { @@ -279,9 +294,9 @@ ], "metadata": { "kernelspec": { - "display_name": "Python 3", + "display_name": "labs", "language": "python", - "name": "python3" + "name": "labs" }, "language_info": { "codemirror_mode": {