def METHOD_NAME(candidate_for_sub, candidate_for_obj):
    # 1 construct the query for sub - unknown - obj
    template_1 = '''         
    PREFIX rdf: <rdf>
    SELECT ?p WHERE {
        %s
        %s
        ?%s ?p ?%s
    }'''
    template_2 = '''
    PREFIX rdf: <rdf>
    SELECT ?p WHERE {
        %s 
        %s %s
    }'''
    if candidate_for_sub['type'] == 'class':
        query_1 = template_1 % (candidate_for_sub['component'], candidate_for_obj['component'], candidate_for_sub['variable'], candidate_for_obj['variable'])
        query_2 = template_1 % (candidate_for_sub['component'], candidate_for_obj['component'], candidate_for_obj['variable'], candidate_for_sub['variable'])
        query = '''\t %s \n ?%s %s ?%s .''' % (candidate_for_obj['component'],
                                               candidate_for_obj['variable'],
                                               SPARQLEngine.construct_random_predicate(),
                                               candidate_for_sub['variable'])
    elif candidate_for_sub['type'] == 'instance':
        query_1 = template_2 % (candidate_for_obj['component'], candidate_for_obj['variable'], candidate_for_sub['component'])
        query_2 = template_2 % (candidate_for_obj['component'], candidate_for_sub['component'], candidate_for_obj['variable'])
        query = '''\t %s \n ?%s %s %s . ''' % (candidate_for_obj['component'],
                                              candidate_for_obj['variable'],
                                              SPARQLEngine.construct_random_predicate(),
                                              candidate_for_sub['component'])
    return query