def skos_hierarchical_mappings(rdf, narrower=True):
    """Infer skos:broadMatch/skos:narrowMatch (S43) and add the super-properties
    skos:broader/skos:narrower (S41).

    :param bool narrower: If set to False, skos:narrowMatch will not be added,
        but rather removed.
    """
    for s, o in rdf.subject_objects(SKOS.broadMatch):
        rdf.add((s, SKOS.broader, o))
        if narrower:
            rdf.add((o, SKOS.narrowMatch, s))
            rdf.add((o, SKOS.narrower, s))

    for s, o in rdf.subject_objects(SKOS.narrowMatch):
        rdf.add((o, SKOS.broadMatch, s))
        rdf.add((o, SKOS.broader, s))
        if narrower:
            rdf.add((s, SKOS.narrower, o))
        else:
            rdf.remove((s, SKOS.narrowMatch, o))