Пример #1
0
def organize_triples_list(triples_list, top):
    try:
        if isinstance(top, Triple):
            new_list = InstrumentedList([])
            new_list.append(top)
            for triple in triples_list:
                if triple != top:
                    if triple.relation == 'instance':
                        new_list.insert(1, triple)
                    else:
                        new_list.append(triple)

            return new_list
    except Exception as exc:
        PrintException()