__init__.py 文件源码

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

项目:Meiji 作者: GiovanniBalestrieri 项目源码 文件源码
def rdf_from_sources(self, names, outputFormat = "pretty-xml", rdfOutput = False) :
        """
        Extract and RDF graph from a list of RDFa sources and serialize them in one graph. The sources are parsed, the RDF
        extracted, and serialization is done in the specified format.
        @param names: list of sources, each can be a URI, a file name, or a file-like object
        @keyword outputFormat: serialization format. Can be one of "turtle", "n3", "xml", "pretty-xml", "nt". "xml" and "pretty-xml", as well as "turtle" and "n3" are synonyms.
        @return: a serialized RDF Graph
        @rtype: string
        """
        try :
            from pyRdfaExtras import MyGraph
            graph = MyGraph()
        except :
            graph = Graph()

        for prefix in _bindings :
            graph.bind(prefix,Namespace(_bindings[prefix]))

        # the value of rdfOutput determines the reaction on exceptions...
        for name in names :
            self.graph_from_source(name, graph, rdfOutput)
        return graph.serialize(format=outputFormat)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号