• <tfoot id='oTrFj'></tfoot>

      <i id='oTrFj'><tr id='oTrFj'><dt id='oTrFj'><q id='oTrFj'><span id='oTrFj'><b id='oTrFj'><form id='oTrFj'><ins id='oTrFj'></ins><ul id='oTrFj'></ul><sub id='oTrFj'></sub></form><legend id='oTrFj'></legend><bdo id='oTrFj'><pre id='oTrFj'><center id='oTrFj'></center></pre></bdo></b><th id='oTrFj'></th></span></q></dt></tr></i><div id='oTrFj'><tfoot id='oTrFj'></tfoot><dl id='oTrFj'><fieldset id='oTrFj'></fieldset></dl></div>
    1. <legend id='oTrFj'><style id='oTrFj'><dir id='oTrFj'><q id='oTrFj'></q></dir></style></legend>

      <small id='oTrFj'></small><noframes id='oTrFj'>

      • <bdo id='oTrFj'></bdo><ul id='oTrFj'></ul>

        RDFLib:XML 序列化中的命名空间前缀

        时间:2023-09-10
        <legend id='IQO46'><style id='IQO46'><dir id='IQO46'><q id='IQO46'></q></dir></style></legend>
      1. <small id='IQO46'></small><noframes id='IQO46'>

        1. <tfoot id='IQO46'></tfoot>
            <bdo id='IQO46'></bdo><ul id='IQO46'></ul>

                    <tbody id='IQO46'></tbody>
                  <i id='IQO46'><tr id='IQO46'><dt id='IQO46'><q id='IQO46'><span id='IQO46'><b id='IQO46'><form id='IQO46'><ins id='IQO46'></ins><ul id='IQO46'></ul><sub id='IQO46'></sub></form><legend id='IQO46'></legend><bdo id='IQO46'><pre id='IQO46'><center id='IQO46'></center></pre></bdo></b><th id='IQO46'></th></span></q></dt></tr></i><div id='IQO46'><tfoot id='IQO46'></tfoot><dl id='IQO46'><fieldset id='IQO46'></fieldset></dl></div>
                  本文介绍了RDFLib:XML 序列化中的命名空间前缀的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  在使用 RDFLib 3.0 的 Python 脚本中,我在序列化三元组时得到以下 XML 输出:

                  In a Python script using RDFLib 3.0, I get the following XML-Output when serializing my triples:

                  <rdf:RDF
                    xmlns:_3="http://www.my-example.intra/ontologies/ci.owl#"
                  >
                  

                  如何为那些由 RDFLib(或者分别是 XML-Serializer)自动分配的匿名 _x-prefixes 定义特定的命名空间前缀?

                  How can I define specific namespace prefixes for those anonymous _x-prefixes automatically assigned by RDFLib (or it's XML-Serializer respectively)?

                  <rdf:RDF
                    xmlns:ex="http://www.my-example.intra/ontologies/ci.owl#"
                  >
                  

                  非常感谢您的回复!

                  推荐答案

                  我最终通过查看一些(分布相当混乱的)rdflib doc 文件找到了解决方案.对于存储三元组的 (Conjunctive)Graph,调用

                  I eventually found a solution to this by looking at some (quite messily distributed) rdflib doc files. For the (Conjunctive)Graph storing the triples, call

                  mygraph.bind(prefix, URIRef(url))
                  

                  mygraph.bind('ex', URIRef('http://www.my-example.intra/ontologies/ci.owl#'))
                  

                  将False"作为第三个参数传递会覆盖现有的命名空间前缀绑定.

                  Passing 'False' as 3rd argument overrides existing namespace prefix bindings.

                  这篇关于RDFLib:XML 序列化中的命名空间前缀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:NameError 在 python 中使用 execfile 下一篇:Python命名中尾随下划线有什么好处?

                  相关文章

                  最新文章

                  <i id='PIvU8'><tr id='PIvU8'><dt id='PIvU8'><q id='PIvU8'><span id='PIvU8'><b id='PIvU8'><form id='PIvU8'><ins id='PIvU8'></ins><ul id='PIvU8'></ul><sub id='PIvU8'></sub></form><legend id='PIvU8'></legend><bdo id='PIvU8'><pre id='PIvU8'><center id='PIvU8'></center></pre></bdo></b><th id='PIvU8'></th></span></q></dt></tr></i><div id='PIvU8'><tfoot id='PIvU8'></tfoot><dl id='PIvU8'><fieldset id='PIvU8'></fieldset></dl></div>

                    <bdo id='PIvU8'></bdo><ul id='PIvU8'></ul>

                  <small id='PIvU8'></small><noframes id='PIvU8'>

                    1. <tfoot id='PIvU8'></tfoot>

                      <legend id='PIvU8'><style id='PIvU8'><dir id='PIvU8'><q id='PIvU8'></q></dir></style></legend>