def test_get_vocabulary_items():
    # Load themes voc
    from ckanext.dcatapit.commands.vocabulary import EUROPEAN_THEME_NAME, do_load

    do_load(load_graph(path=get_test_file(SKOS_THEME_FILE)), EUROPEAN_THEME_NAME)

    # test it
    vocabularies_items = helpers.get_vocabulary_items(EUROPEAN_THEME_NAME)
    ok_(vocabularies_items)
Пример #2
0
def test_get_vocabulary_items():
    # Load themes voc
    from ckanext.dcatapit.commands.dcatapit import EUROPEAN_THEME_NAME, do_load

    path = os.path.join(os.path.dirname(__file__), '..', '..', '..',
                        'vocabularies', 'data-theme-skos.rdf')
    do_load(EUROPEAN_THEME_NAME, filename=path)

    # test it
    vocabularies_items = helpers.get_vocabulary_items(EUROPEAN_THEME_NAME)
    ok_(vocabularies_items)
def _get_freqs():
    '''
    :return: the vocabulary frequancies as a dict "lowercase italian label": "tag key"
    '''
    global _CACHED_FREQS
    if _CACHED_FREQS is None:
        log.info('Initializing Frequencies mapping')
        voc_items = get_vocabulary_items(
            vocabulary_name=FREQUENCIES_THEME_NAME, lang='it')

        _CACHED_FREQS = {t['text'].lower(): t['value'] for t in voc_items}
        log.warning(f"Cached frequencies: {_CACHED_FREQS}")

    return _CACHED_FREQS
Пример #4
0
def test_get_vocabulary_items():
    vocabularies_items = helpers.get_vocabulary_items('eu_themes')
    ok_(vocabularies_items)