code: def rdfs_properties(rdf):
      
  
      # find out the subproperty mappings
      superprops = {}  # key: property val: set([superprop1, superprop2..])
      for s, o in rdf.subject_objects(RDFS.subPropertyOf):
          superprops.setdefault(s, set())
          for sp in rdf.transitive_objects(s, RDFS.subPropertyOf):
              if sp != s:
                  superprops[s].add(sp)
  
      # add the superproperty relationships
      for p, sps in superprops.items():
          logging.debug("setting superproperties: %s -> %s", p, str(sps))
          for s, o in rdf.subject_objects(p):
              for sp in sps:
                  rdf.add((s, sp, o))
docs: Perform RDFS subproperty inference.
  
      Add superproperties where subproperties have been used.