code: def enrich_relations(rdf, enrich_mappings, use_narrower, use_transitive):
      
  
      # 1. first enrich mapping relationships (because they affect regular ones)
  
      if enrich_mappings:
          infer.skos_symmetric_mappings(rdf)
          infer.skos_hierarchical_mappings(rdf, use_narrower)
  
      # 2. then enrich regular relationships
  
      # related <-> related
      infer.skos_related(rdf)
  
      # broaderGeneric -> broader + inverse narrowerGeneric
      for s, o in rdf.subject_objects(SKOSEXT.broaderGeneric):
          rdf.add((s, SKOS.broader, o))
  
      # broaderPartitive -> broader + inverse narrowerPartitive
      for s, o in rdf.subject_objects(SKOSEXT.broaderPartitive):
          rdf.add((s, SKOS.broader, o))
  
      infer.skos_hierarchical(rdf, use_narrower)
  
      # transitive closure: broaderTransitive and narrowerTransitive
      if use_transitive:
          infer.skos_transitive(rdf, use_narrower)
      else:
          # transitive relationships are not wanted, so remove them
          for s, o in rdf.subject_objects(SKOS.broaderTransitive):
              rdf.remove((s, SKOS.broaderTransitive, o))
          for s, o in rdf.subject_objects(SKOS.narrowerTransitive):
              rdf.remove((s, SKOS.narrowerTransitive, o))
  
      infer.skos_topConcept(rdf)
docs: 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.