direction = "forw"
if obj:
direction = "backw"
subj = subj.split("/")[-1]
triplets = self.document.get(subj, {}).get(direction, [])
triplets = [[subj, triplet[0], obj] for triplet in triplets for obj in triplet[1:]]
if rel:
if rel == self.description_rel:
triplets = [triplet for triplet in triplets if triplet[1] == "descr_en"]
After Change
triplets = [[subj, triplet[0], obj] for triplet in triplets for obj in triplet[1:]]
if obj:
obj, triplets = self.find_triplets(obj, "backw")
triplets = [[subj, triplet[0], obj] for triplet in triplets for subj in triplet[1:]]
if rel:
if rel == self.description_rel:
triplets = [triplet for triplet in triplets if triplet[1] == "descr_en"]
else: