<jupyter_start><jupyter_text>Search for the city 'Dessau' using the wikidata URI<jupyter_code>wiki_client = WikiClient()
dessau = wiki_client.get('Q487070', load=True)
dessau.description
def print_properties(entity, max_depth=1, _depth=1):
    if _depth < 1:
        raise ValueError('Minimum depth is always 1!')
    if max_depth < _depth:
        return
        
    for key in entity.keys():
        if key in entity:
            entity_property = entity[key]
            if str == type(entity_property):
                for tab_index in range(1, _depth):
                    print('  ', end='')
                print('{0}:{1}'.format(key.label, entity_property))
            elif WikiEntity is type(entity_property):
                for tab_index in range(1, _depth):
                    print('  ', end='')
                print('{0}:'.format(entity_property.label))
                print_properties(entity_property, max_depth, _depth+1)  

#print_properties(dessau, 2)
dessau.attributes<jupyter_output><empty_output><jupyter_text>Search for anything having a wikidata tag using OSM<jupyter_code>osm_client = OsmClient()
query_clause = 'node[\'wikidata\'](51.822788386139,12.232568264008,51.828663466249,12.24388718605);out;'
query_result = osm_client.query(query_clause)
def print_osm(nodes):
    for osm_node in nodes:
        print('lat:{0}, lon:{1}'.format(osm_node.lat, osm_node.lon))
        for osm_tag in osm_node.tags:
            print('{0}:{1}'.format(osm_tag, osm_node.tags[osm_tag]))
    
print_osm(query_result.nodes)
def query_wiki(osm_nodes):
    entities = []
    for osm_node in osm_nodes:
        for osm_tag in osm_node.tags:
            if 'wikidata' == osm_tag:
                wiki_uid = osm_node.tags[osm_tag]
                entity = wiki_client.get(wiki_uid, load=True)
                entities.append(entity)
    
    return entities
query_wiki(query_result.nodes)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11526479750778816, 'fraction_numerical': 0.03946002076843198, 'mean_word_length': 2.9008097165991904, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '122635', 'license': 'Apache-2.0', 'n_tokens_mistral': 702, 'n_tokens_neox': 638, 'n_words': 123, 'path': 'notebooks/Semantic Knowledge Queries.ipynb', 'repo_name': 'gisfromscratch/anaconda-data-analystics', 'size': '1926'}