def enrich_relations(rdf, enrich_mappings, use_narrower, use_transitive):
<EOL>if enrich_mappings:<EOL><INDENT>infer.skos_symmetric_mappings(rdf)<EOL>infer.skos_hierarchical_mappings(rdf, use_narrower)<EOL><DEDENT>infer.skos_related(rdf)<EOL>for s, o in rdf.subject_objects(SKOSEXT.broaderGeneric):<EOL><INDENT>rdf.add((s, SKOS.broader, o))<EOL><DEDENT>for s, o in rdf.subject_objects(SKOSEXT.broaderPartitive):<EOL><INDENT>rdf.add((s, SKOS.broader, o))<EOL><DEDENT>infer.skos_hierarchical(rdf, use_narrower)<EOL>if use_transitive:<EOL><INDENT>infer.skos_transitive(rdf, use_narrower)<EOL><DEDENT>else:<EOL><INDENT>for s, o in rdf.subject_objects(SKOS.broaderTransitive):<EOL><INDENT>rdf.remove((s, SKOS.broaderTransitive, o))<EOL><DEDENT>for s, o in rdf.subject_objects(SKOS.narrowerTransitive):<EOL><INDENT>rdf.remove((s, SKOS.narrowerTransitive, o))<EOL><DEDENT><DEDENT>infer.skos_topConcept(rdf)<EOL>
Enrich the SKOS relations according to SKOS semantics, including
    subproperties of broader and symmetric related properties. If use_narrower
    is True, include inverse narrower relations for all broader relations. If
    use_narrower is False, instead remove all narrower relations, replacing
    them with inverse broader relations. If use_transitive is True, calculate
    transitive hierarchical relationships.

    (broaderTransitive, and also narrowerTransitive if use_narrower is
    True) and include them in the model.