def hierarchical_redundancy(rdf, fix=False):
for conc, parent1 in rdf.subject_objects(SKOS.broader):<EOL><INDENT>for parent2 in rdf.objects(conc, SKOS.broader):<EOL><INDENT>if parent1 == parent2:<EOL><INDENT>continue  <EOL><DEDENT>if parent2 in rdf.transitive_objects(parent1, SKOS.broader):<EOL><INDENT>if fix:<EOL><INDENT>logging.warning(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>",<EOL>conc, parent2)<EOL>rdf.remove((conc, SKOS.broader, parent2))<EOL>rdf.remove((conc, SKOS.broaderTransitive, parent2))<EOL>rdf.remove((parent2, SKOS.narrower, conc))<EOL>rdf.remove((parent2, SKOS.narrowerTransitive, conc))<EOL><DEDENT>else:<EOL><INDENT>logging.warning(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>",<EOL>conc, parent2)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>
Check for and optionally remove extraneous skos:broader relations.

    :param Graph rdf: An rdflib.graph.Graph object.
    :param bool fix: Fix the problem by removing skos:broader relations between
        concepts that are otherwise connected by skos:broaderTransitive.