Execute a search plan for the declared graph pattern and sends all obtained triples to the corresponding
    collector functions (config

def collect_fragment(event, agora_host):
    """
    Execute a search plan for the declared graph pattern and sends all obtained triples to the corresponding
    collector functions (config
    """
    agora = Agora(agora_host)
    graph_pattern = ""
    for tp in __triple_patterns:
        graph_pattern += '{} . '.format(tp)
    fragment, _, graph = agora.get_fragment_generator('{%s}' % graph_pattern, stop_event=event, workers=4)
    __extract_pattern_nodes(graph)
    log.info('querying { %s}' % graph_pattern)
    for (t, s, p, o) in fragment:
        collectors = __triple_patterns[str(__plan_patterns[t])]
        for c, args in collectors:
            log.debug('Sending triple {} {} {} to {}'.format(s.n3(graph.namespace_manager), graph.qname(p),
                                                             o.n3(graph.namespace_manager), c))
            c((s, p, o))
            if event.isSet():
                raise Exception('Abort collecting fragment')
            yield (c.func_name, (t, s, p, o))