def predicate(self, predicate, object, depth=1):
    writer = self.writer
    store = self.store
    writer.push(predicate)
    if isinstance(object, Literal):
        if object.language:
            writer.attribute(XMLLANG, object.language)
        if ((object.datatype == RDF.XMLLiteral) and isinstance(object.value, xml.dom.minidom.Document)):
            writer.attribute(RDFVOC.parseType, 'Literal')
            writer.text('')
            writer.stream.write(object)
        else:
            if object.datatype:
                writer.attribute(RDFVOC.datatype, object.datatype)
            writer.text(object)
    elif ((object in self.__serialized) or (not ((object, None, None) in store))):
        if isinstance(object, BNode):
            if more_than(store.triples((None, None, object)), 0):
                writer.attribute(RDFVOC.nodeID, fix(object))
        else:
            writer.attribute(RDFVOC.resource, self.relativize(object))
    elif first(store.objects(object, RDF.first)):
        self.__serialized[object] = 1
        import warnings
        warnings.warn((('Assertions on %s other than RDF.first ' % repr(object)) + 'and RDF.rest are ignored ... including RDF.List'), UserWarning, stacklevel=2)
        writer.attribute(RDFVOC.parseType, 'Collection')
        col = Collection(store, object)
        for item in col:
            if isinstance(item, URIRef):
                self.forceRDFAbout.add(item)
            self.subject(item)
            if (not isinstance(item, URIRef)):
                self.__serialized[item] = 1
    elif (first(store.triples_choices((object, RDF.type, [OWL_NS.Class, RDFS.Class]))) and isinstance(object, URIRef)):
        writer.attribute(RDFVOC.resource, self.relativize(object))
    elif (depth <= self.max_depth):
        self.subject(object, (depth + 1))
    elif isinstance(object, BNode):
        if ((object not in self.__serialized) and ((object, None, None) in store) and (len(list(store.subjects(object=object))) == 1)):
            self.subject(object, (depth + 1))
        else:
            writer.attribute(RDFVOC.nodeID, fix(object))
    else:
        writer.attribute(RDFVOC.resource, self.relativize(object))
    writer.pop(predicate)
def predicate(self, predicate, object, depth=1):
    writer = self.writer
    store = self.store
    writer.push(predicate)
    if isinstance(object, Literal):
        if object.language:
            writer.attribute(XMLLANG, object.language)
        if ((object.datatype == RDF.XMLLiteral) and isinstance(object.value, xml.dom.minidom.Document)):
            writer.attribute(RDFVOC.parseType, 'Literal')
            writer.text()
            writer.stream.write(object)
        else:
            if object.datatype:
                writer.attribute(RDFVOC.datatype, object.datatype)
            writer.text(object)
    elif ((object in self.__serialized) or (not ((object, None, None) in store))):
        if isinstance(object, BNode):
            if more_than(store.triples((None, None, object)), 0):
                writer.attribute(RDFVOC.nodeID, fix(object))
        else:
            writer.attribute(RDFVOC.resource, self.relativize(object))
    elif first(store.objects(object, RDF.first)):
        self.__serialized[object] = 1
        import warnings
        warnings.warn((('Assertions on %s other than RDF.first ' % repr(object)) + 'and RDF.rest are ignored ... including RDF.List'), UserWarning, stacklevel=2)
        writer.attribute(RDFVOC.parseType, 'Collection')
        col = Collection(store, object)
        for item in col:
            if isinstance(item, URIRef):
                self.forceRDFAbout.add(item)
            self.subject(item)
            if (not isinstance(item, URIRef)):
                self.__serialized[item] = 1
    elif (first(store.triples_choices((object, RDF.type, [OWL_NS.Class, RDFS.Class]))) and isinstance(object, URIRef)):
        writer.attribute(RDFVOC.resource, self.relativize(object))
    elif (depth <= self.max_depth):
        self.subject(object, (depth + 1))
    elif isinstance(object, BNode):
        if ((object not in self.__serialized) and ((object, None, None) in store) and (len(list(store.subjects(object=object))) == 1)):
            self.subject(object, (depth + 1))
        else:
            writer.attribute(RDFVOC.nodeID, fix(object))
    else:
        writer.attribute(RDFVOC.resource, self.relativize(object))
    writer.pop(predicate)