当前位置: 首页>>代码示例>>Python>>正文


Python ConjunctiveGraph.absolutize方法代码示例

本文整理汇总了Python中rdflib.ConjunctiveGraph.absolutize方法的典型用法代码示例。如果您正苦于以下问题:Python ConjunctiveGraph.absolutize方法的具体用法?Python ConjunctiveGraph.absolutize怎么用?Python ConjunctiveGraph.absolutize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在rdflib.ConjunctiveGraph的用法示例。


在下文中一共展示了ConjunctiveGraph.absolutize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: parse

# 需要导入模块: from rdflib import ConjunctiveGraph [as 别名]
# 或者: from rdflib.ConjunctiveGraph import absolutize [as 别名]
    def parse(self, source, graph, encoding="utf-8"):

        if encoding not in [None, "utf-8"]:
            raise Exception(
                ("TriG files are always utf-8 encoded, ",
                 "I was passed: %s") % encoding)

        # we're currently being handed a Graph, not a ConjunctiveGraph
        assert graph.store.context_aware, "TriG Parser needs a context-aware store!"

        conj_graph = ConjunctiveGraph(store=graph.store, identifier=graph.identifier)
        conj_graph.default_context = graph  # TODO: CG __init__ should have a
                                            # default_context arg
         # TODO: update N3Processor so that it can use conj_graph as the sink
        conj_graph.namespace_manager = graph.namespace_manager

        sink = RDFSink(conj_graph)

        baseURI = conj_graph.absolutize(
            source.getPublicId() or source.getSystemId() or "")
        p = TrigSinkParser(sink, baseURI=baseURI, turtle=True)

        p.loadStream(source.getByteStream())

        for prefix, namespace in p._bindings.items():
            conj_graph.bind(prefix, namespace)
开发者ID:kellyhennigan,项目名称:cueexp_scripts,代码行数:28,代码来源:trig.py


注:本文中的rdflib.ConjunctiveGraph.absolutize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。