code: def classes(self, set_uri_or_id=None, nestedhierarchy=False):
          
          if set_uri_or_id and set_uri_or_id.startswith(('http://','https://')):
              set_uri = set_uri_or_id
          else:
              set_uri = self.get_set_uri(set_uri_or_id)
  
          assert set_uri is not None
  
          classes= {}
          uri2idmap = {}
          for row in self.graph.query("SELECT ?classuri ?classid ?classlabel ?parentclass ?seqnr  WHERE { ?classuri rdf:type skos:Concept ; skos:notation ?classid. <" + str(set_uri) + "> skos:member ?classuri . OPTIONAL { ?classuri skos:prefLabel ?classlabel } OPTIONAL { ?classuri skos:narrower ?parentclass } OPTIONAL { ?classuri fsd:sequenceNumber ?seqnr } }"):
              classinfo = {'uri': str(row.classuri), 'id': str(row.classid),'label': str(row.classlabel) if row.classlabel else "" }
              if nestedhierarchy:
                  uri2idmap[str(row.classuri)] = str(row.classid)
              if row.parentclass:
                  classinfo['parentclass'] =  str(row.parentclass) #uri
              if row.seqnr:
                  classinfo['seqnr'] =  int(row.seqnr)
              classes[str(row.classid)] = classinfo
  
          if nestedhierarchy:
              #build hierarchy
              removekeys = []
              for classid, classinfo in classes.items():
                  if 'parentclass' in classinfo:
                      removekeys.append(classid)
                      parentclassid = uri2idmap[classinfo['parentclass']]
                      if 'subclasses' not in classes[parentclassid]:
                          classes[parentclassid]['subclasses'] = {}
                      classes[parentclassid]['subclasses'][classid] = classinfo
              for key in removekeys:
                  del classes[key]
          return classes
docs: Returns a dictionary of classes for the specified (sub)set (if None, default, the main set is selected)