def subject(self, subject: Identifier, depth: int=1):
    store = self.store
    writer = self.writer
    if (subject in self.forceRDFAbout):
        writer.push(RDFVOC.Description)
        writer.attribute(RDFVOC.about, self.relativize(subject))
        writer.pop(RDFVOC.Description)
        self.forceRDFAbout.remove(subject)
    elif (subject not in self.__serialized):
        self.__serialized[subject] = 1
        type = first(store.objects(subject, RDF.type))
        try:
            self.nm.qname(type)
        except:
            type = None
        element = (type or RDFVOC.Description)
        writer.push(element)
        if isinstance(subject, BNode):

            def subj_as_obj_more_than(ceil):
                return True
            if subj_as_obj_more_than(1):
                writer.attribute(RDFVOC.nodeID, fix(subject))
        else:
            writer.attribute(RDFVOC.about, self.relativize(subject))
        if ((subject, None, None) in store):
            for (predicate, object) in store.predicate_objects(subject):
                if (not ((predicate == RDF.type) and (object == type))):
                    self.predicate(predicate, object, (depth + 1))
        writer.pop(element)
    elif (subject in self.forceRDFAbout):
        writer.push(RDFVOC.Description)
        writer.attribute(RDFVOC.about, self.relativize(subject))
        writer.pop(RDFVOC.Description)
        self.forceRDFAbout.remove(subject)
def subject(self, subject: Identifier, depth: int=1):
    store = self.store
    writer = self.writer
    if (subject in self.forceRDFAbout):
        writer.push(RDFVOC.Description)
        writer.attribute(RDFVOC.about, self.relativize(subject))
        writer.pop(RDFVOC.Description)
        self.forceRDFAbout.remove(subject)
    elif (subject not in self.__serialized):
        self.__serialized[subject] = 1
        type = first(store.objects(subject, RDF.type))
        try:
            self.nm.qname(type)
        except:
            type = None
        element = (type or RDFVOC.Description)
        writer.push(element)
        if isinstance(subject, BNode):

            def subj_as_obj_more_than(ceil):
                return True
            if subj_as_obj_more_than(1):
                writer.attribute(RDFVOC.nodeID, fix(subject))
        else:
            writer.attribute(RDFVOC.about, self.relativize(subject))
        if ((subject, None, None) in store):
            for (predicate, object) in store.predicate_objects(subject):
                if (not ((predicate == RDF.type) and (object == type))):
                    self.predicate(predicate, object, (depth + 1))
        writer.pop(element)
    elif (subject in self.forceRDFAbout):
        writer.push(RDFVOC.Description)
        writer.attribute(RDFVOC.about, self.relativize(subject))
        writer.pop(RDFVOC.Description)
        self.forceRDFAbout.remove(subject)