ingester.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:bibcat 作者: KnowledgeLinks 项目源码 文件源码
def populate_entity(self, bf_class, existing_uri=None):
        """Takes a BIBFRAME graph and MODS XML, extracts info for each
        entity's property and adds to graph.

        Args:
            bf_class(rdflib.URIRef): Namespace URI
        Returns:
           rdflib.URIRef: URI of new entity
        """
        if existing_uri:
            entity_uri = existing_uri
        else:
            # Check for custom IRIPattern
            entity_uri = self.__pattern_uri__(bf_class)
            # Finally generate an IRI from the default patterns
            if not entity_uri:
                entity_uri = self.__generate_uri__()
        self.graph.add((entity_uri, rdflib.RDF.type, bf_class))
        self.update_linked_classes(bf_class, entity_uri)
        self.update_direct_properties(bf_class, entity_uri)
        self.update_ordered_linked_classes(bf_class, entity_uri)
        self.add_admin_metadata(entity_uri)
        self.clean_rdf_types()
        return entity_uri
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号