def setUp(self): """bibknowledge test setup Mostly just creates the dynamic kb used later. """ new_kb_id = add_dynamic_kb(self._name_a_db(), "100__a", searchwith="245__:*%*") self.dyn_kbname = get_kb_name(new_kb_id)
#!/usr/bin/env python # -*- coding: utf-8 -*- # InstitutionsCollection_dynamic_KB.py """Create a dynamic KB from the instutions collection, and annotate it.""" import sys from invenio import bibknowledge kbname = 'InstitutionsCollection' collection = 'Institutions' display_field = '110__u' search_field = '371__a:"*%*" | 110__u:"*%*"' kbdesc = "A dynamic KB which searches all 371a and 110u fields in the " +\ "institutions collection, and returns those records' corresponding " + \ "110u fields." if __name__ == "__main__": bibknowledge.add_dynamic_kb(kbname, display_field, collection, search_field) bibknowledge.update_kb_attributes(kbname, kbname, kbdesc)
#!/usr/bin/env python # -*- coding: utf-8 -*- # ExperimentsCollection_dynamic_KB.py """Create a dynamic KB from the experiments collection, and annotate it.""" import sys from invenio import bibknowledge kbname = 'ExperimentsCollection' collection = 'Experiments' display_field = '119__a' search_field = '119__a:"*%*" | 119__u:"*%*" | 419__a:"*%*" | 245__a:"*%*"' kbdesc = "A dynamic KB which searches all 119a fields in the " +\ "experiments collection, and returns those records' corresponding " + \ "119a fields." if __name__ == "__main__": bibknowledge.add_dynamic_kb(kbname, display_field, collection, search_field) bibknowledge.update_kb_attributes(kbname, kbname, kbdesc)