def _parse_relation(chunk, type="<STR_LIT:O>"):
r1 = chunk.get(XML_RELATION)<EOL>r2 = chunk.get(XML_ID, chunk.get(XML_OF))<EOL>r1 = [x != "<STR_LIT:->" and x or None for x in r1.split("<STR_LIT:|>")] or [None]<EOL>r2 = [x != "<STR_LIT:->" and x or None for x in r2.split("<STR_LIT:|>")] or [None]<EOL>r2 = [x is not None and x.split(_UID_SEPARATOR )[-<NUM_LIT:1>] or x for x in r2]<EOL>if len(r1) < len(r2): r1 = r1 + r1 * (len(r2)-len(r1)) <EOL>if len(r2) < len(r1): r2 = r2 + r2 * (len(r1)-len(r2)) <EOL>return "<STR_LIT:;>".join(["<STR_LIT:->".join([x for x in (type, r1, r2) if x]) for r1, r2 in zip(r1, r2)])<EOL>
Returns a string of the roles and relations parsed from the given <chunk> element.
        The chunk type (which is part of the relation string) can be given as parameter.