Esempio n. 1
0
def get_codens():
    global _CODENS_CACHE
    if _CODENS_CACHE is not None:
        return _CODENS_CACHE
    from invenio.bibknowledge import get_kbr_items
    _CODENS_CACHE = {}
    for item in get_kbr_items(CFG_CODEN_KB):
        _CODENS_CACHE[item['key']] = item['value']
    return _CODENS_CACHE
Esempio n. 2
0
def get_codens():
    global _CODENS_CACHE
    if _CODENS_CACHE is not None:
        return _CODENS_CACHE
    from invenio.bibknowledge import get_kbr_items
    _CODENS_CACHE = {}
    for item in get_kbr_items(CFG_CODEN_KB):
        _CODENS_CACHE[item['key']] = item['value']
    return _CODENS_CACHE
Esempio n. 3
0
def load_kb_from_db(kb_name, builder):
    def lazy_parser(kb):
        for mapping in kb:
            yield mapping['key'], mapping['value']

    return builder(lazy_parser(get_kbr_items(kb_name)))
Esempio n. 4
0
def load_kb_from_db(kb_name, builder):
    def lazy_parser(kb):
        for mapping in kb:
            yield mapping['key'], mapping['value']

    return builder(lazy_parser(get_kbr_items(kb_name)))