<commit_before>#!/usr/bin/env python
import gi
from gi.repository import Tracker, GObject

def results_ready_cb (obj, result, user_data):
    cursor = obj.query_finish (result)

    # This can also be done asynchronously
    while (cursor.next (None)):
        print cursor.get_string (0)

    user_data.quit ()


if __name__ == "__main__":
    loop = GObject.MainLoop ()

    # The connection can be requested asynchronously
    conn = Tracker.SparqlConnection.get (None)
    conn.query_async ("SELECT ?u WHERE { ?u a nie:InformationElement. }",
                      None,
                      results_ready_cb,
                      loop)

    loop.run ()<commit_msg>examples: Update async query example<commit_after>#!/usr/bin/env python
import gi
from gi.repository import Tracker, GObject

def results_ready_cb (obj, result, user_data):
    cursor = obj.query_finish (result)

    # This can also be done asynchronously
    while (cursor.next (None)):
        print cursor.get_string (0)

    user_data.quit ()


if __name__ == "__main__":
    loop = GObject.MainLoop ()

    # The connection can be requested asynchronously
    conn = Tracker.SparqlConnection.get (None)
    conn.query_async ("SELECT nie:url(?u) WHERE { ?u a nfo:FileDataObject }",
                      None,
                      results_ready_cb,
                      loop)

    loop.run ()
{'fraction_non_alphanumeric': 0.09569028487947406, 'fraction_numerical': 0.0014609203798392988, 'mean_word_length': 2.45959595959596, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, '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}}
{'dir': 'git-commits-cleaned', 'id': '5385802', 'n_tokens_mistral': 417, 'n_tokens_neox': 392, 'n_words': 114}