def process(self, lxmlNode):
        def prefixForNamespace(ns):
            if ns in prefixes:
                return prefixes[ns]
            return self._namespaceEnum.get(ns)

        def filterOac(nodes):
            result = []
            for node in nodes:
                namespace, name = splitType(getAttrib(node, 'rdf:resource'))
                if namespace == namespaces['oa']:
                    result.append(node)
            return result

        descriptions = xpath(lxmlNode, "//rdf:Description[rdf:type]")
        for description in descriptions:
            nodes = xpath(description, "rdf:type")
            oacNodes = filterOac(nodes)
            typeNode = nodes[0]
            if len(oacNodes) > 0:
                typeNode = oacNodes[0]

            parent = description.getparent()
            namespace, name = splitType(getAttrib(typeNode, 'rdf:resource'))
            prefix = prefixForNamespace(namespace)
            newNode = SubElement(
                parent, 
                "{%(ns)s}%(tag)s" % {'ns': namespace, 'tag': name}, 
                attrib=description.attrib,
                nsmap={prefix: namespace})
            for child in (child for child in description.getchildren() if child != typeNode):
                newNode.append(child)
            parent.remove(description)

        yield self.all.process(lxmlNode=lxmlNode)
    def add(self, identifier, partname, lxmlNode):
        for node in xpath(lxmlNode, '/rdf:RDF/oa:Annotation'):
            self.do.addField(name="rdf:type", value="%sAnnotation" % namespaces['oa'])

        for node in xpath(lxmlNode, '/rdf:RDF/oa:Annotation/rdf:type/@rdf:resource'):
            self.do.addField(name="rdf:type", value=node)
        
        for node in xpath(lxmlNode, '//oa:hasBody/*/rdf:type/@rdf:resource'):
            self.do.addField(name="rdf:type", value=node)
        return
        yield
 def add(self, identifier, partname, lxmlNode):
     try:
         newIdentifier = xpath(lxmlNode, self._xpath)[0]
     except:
         raise ValueError("Identifier not found")
     yield self.all.add(identifier=newIdentifier, partname=partname, lxmlNode=lxmlNode)
    def process(self, lxmlNode):
        for node in chain(xpath(lxmlNode, '//oa:Annotation'), xpath(lxmlNode, '//oa:Body'), xpath(lxmlNode, "//oa:SpecificResource")):
            if getAttrib(node, 'rdf:about') == None and getAttrib(node, 'rdf:resource') == None:
                setAttrib(node, 'rdf:about', self._urnGen())

        yield self.all.process(lxmlNode=lxmlNode)
 def resolve(self, uri):
     results = xpath(self._xml, "//*[@rdf:about='%s']" % uri)
     return copy(results[0]) if results else None