This file is indexed.

/usr/share/doc/python-rdflib-doc/html/upgrade3to4.html is in python-rdflib-doc 4.1.2-3.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    

    <title>Upgrading from RDFLib version 3.X to 4.X &mdash; rdflib 4.1.2 documentation</title>

<meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;"/>


    
    <link rel="stylesheet" href="_static/rtd.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '4.1.2',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <script type="text/javascript" src="_static/searchtools.js"></script>
    <link rel="top" title="rdflib 4.1.2 documentation" href="index.html" />
    <link rel="next" title="Upgrading from RDFLib version 2.X to 3.X" href="upgrade2to3.html" />
    <link rel="prev" title="Merging graphs" href="merging.html" /> 
  </head>
  <body>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="upgrade2to3.html" title="Upgrading from RDFLib version 2.X to 3.X"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="merging.html" title="Merging graphs"
             accesskey="P">previous</a> |</li>
        <li><a href="index.html">rdflib 4.1.2 documentation</a> &raquo;</li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body">
            
  <div class="section" id="upgrading-from-rdflib-version-3-x-to-4-x">
<h1>Upgrading from RDFLib version 3.X to 4.X<a class="headerlink" href="#upgrading-from-rdflib-version-3-x-to-4-x" title="Permalink to this headline"></a></h1>
<p>RDFLib version 4.0 introduced a small number of backwards compatible changes that you should know about when porting code from version 3 or earlier.</p>
<div class="section" id="sparql-and-sparqlstore-are-now-included-in-core">
<h2>SPARQL and SPARQLStore are now included in core<a class="headerlink" href="#sparql-and-sparqlstore-are-now-included-in-core" title="Permalink to this headline"></a></h2>
<p>For version 4.0 we&#8217;ve merged the SPARQL implementation from <tt class="docutils literal"><span class="pre">rdflib-sparql</span></tt>, the SPARQL(Update)Store from <tt class="docutils literal"><span class="pre">rdflib-sparqlstore</span></tt> and miscellaneous utilities from <tt class="docutils literal"><span class="pre">rdfextras</span></tt>. If you used any of these previously, everything you need should now be included.</p>
</div>
<div class="section" id="datatyped-literals">
<h2>Datatyped literals<a class="headerlink" href="#datatyped-literals" title="Permalink to this headline"></a></h2>
<p>We separate lexical and value space operations for datatyped literals.</p>
<p>This mainly affects the way datatyped literals are compared. Lexical space comparisons are done by default for <tt class="docutils literal"><span class="pre">==</span></tt> and <tt class="docutils literal"><span class="pre">!=</span></tt>, meaning the exact lexical representation and the exact data-types have to match for literals to be equal. Value space comparisons are also available through the <a class="reference internal" href="apidocs/rdflib.html#rdflib.term.Identifier.eq" title="rdflib.term.Identifier.eq"><tt class="xref py py-meth docutils literal"><span class="pre">rdflib.term.Identifier.eq()</span></tt></a> and <a class="reference internal" href="apidocs/rdflib.html#rdflib.term.Identifier.neq" title="rdflib.term.Identifier.neq"><tt class="xref py py-meth docutils literal"><span class="pre">rdflib.term.Identifier.neq()</span></tt></a> methods, <tt class="docutils literal"><span class="pre">&lt;</span> <span class="pre">&gt;</span> <span class="pre">&lt;=</span> <span class="pre">&gt;=</span></tt> are also done in value space.</p>
<p>Most things now work in a fairly sane and sensible way, if you do not have existing stores/intermediate stored sorted lists, or hash-dependent something-or-other, you should be good to go.</p>
<p>Things to watch out for:</p>
<div class="section" id="literals-no-longer-compare-equal-across-data-types-with">
<h3>Literals no longer compare equal across data-types with <tt class="docutils literal"><span class="pre">`==`</span></tt><a class="headerlink" href="#literals-no-longer-compare-equal-across-data-types-with" title="Permalink to this headline"></a></h3>
<p>i.e.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">Literal</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">datatype</span><span class="o">=</span><span class="n">XSD</span><span class="o">.</span><span class="n">int</span><span class="p">)</span> <span class="o">==</span> <span class="n">Literal</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">datatype</span><span class="o">=</span><span class="n">XSD</span><span class="o">.</span><span class="n">float</span><span class="p">)</span>
<span class="go">False</span>
</pre></div>
</div>
<p>But a new method <a class="reference internal" href="apidocs/rdflib.html#rdflib.term.Identifier.eq" title="rdflib.term.Identifier.eq"><tt class="xref py py-meth docutils literal"><span class="pre">rdflib.term.Identifier.eq()</span></tt></a> on all Nodes has been introduced, which does semantic equality checking, i.e.:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">Literal</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">datatype</span><span class="o">=</span><span class="n">XSD</span><span class="o">.</span><span class="n">int</span><span class="p">)</span><span class="o">.</span><span class="n">eq</span><span class="p">(</span><span class="n">Literal</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">datatype</span><span class="o">=</span><span class="n">XSD</span><span class="o">.</span><span class="n">float</span><span class="p">))</span>
<span class="go">True</span>
</pre></div>
</div>
<p>The <tt class="docutils literal"><span class="pre">eq</span></tt> method is still limited to what data-types map to the same <em>value space</em>, i.e. all numeric types map to numbers and will compare, <tt class="docutils literal"><span class="pre">xsd:string</span></tt> and <tt class="docutils literal"><span class="pre">plain</span> <span class="pre">literals</span></tt> both map to strings and compare fine, but:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">Literal</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="n">datatype</span><span class="o">=</span><span class="n">XSD</span><span class="o">.</span><span class="n">int</span><span class="p">)</span><span class="o">.</span><span class="n">eq</span><span class="p">(</span><span class="n">Literal</span><span class="p">(</span><span class="s">&#39;2&#39;</span><span class="p">))</span>
<span class="go">False</span>
</pre></div>
</div>
</div>
<div class="section" id="literals-will-be-normalised-according-to-datatype">
<h3>Literals will be normalised according to datatype<a class="headerlink" href="#literals-will-be-normalised-according-to-datatype" title="Permalink to this headline"></a></h3>
<p>If you care about the exact lexical representation of a literal, and not just the value. Either set <tt class="xref py py-data docutils literal"><span class="pre">rdflib.NORMALIZE_LITERALS</span></tt> to <tt class="docutils literal"><span class="pre">False</span></tt> before creating your literal, or pass <tt class="docutils literal"><span class="pre">normalize=False</span></tt> to the Literal constructor</p>
</div>
<div class="section" id="ordering-of-literals-and-nodes-has-changed">
<h3>Ordering of literals and nodes has changed<a class="headerlink" href="#ordering-of-literals-and-nodes-has-changed" title="Permalink to this headline"></a></h3>
<p>Comparing literals with <tt class="docutils literal"><span class="pre">&lt;,</span> <span class="pre">&gt;,</span> <span class="pre">&lt;=,</span> <span class="pre">&gt;=</span></tt> now work same as in SPARQL filter expressions.</p>
<p>Greater-than/less-than ordering comparisons are also done in value space, when compatible datatypes are used.
Incompatible datatypes are ordered by data-type, or by lang-tag.
For other nodes the ordering is <tt class="docutils literal"><span class="pre">None</span> <span class="pre">&lt;</span> <span class="pre">BNode</span> <span class="pre">&lt;</span> <span class="pre">URIRef</span> <span class="pre">&lt;</span> <span class="pre">Literal</span></tt></p>
<p>Any comparison with non-rdflib Node are <tt class="docutils literal"><span class="pre">NotImplemented</span></tt>
In PY2.X some stable order will be made up by python.
In PY3 this is an error.</p>
</div>
<div class="section" id="custom-mapping-of-datatypes-to-python-objects">
<h3>Custom mapping of datatypes to python objects<a class="headerlink" href="#custom-mapping-of-datatypes-to-python-objects" title="Permalink to this headline"></a></h3>
<p>You can add new mappings of datatype URIs to python objects using the <a class="reference internal" href="apidocs/rdflib.html#rdflib.term.bind" title="rdflib.term.bind"><tt class="xref py py-func docutils literal"><span class="pre">rdflib.term.bind()</span></tt></a> method.
This also allows you to specify a constructor for constructing objects from the lexical string representation, and a serialization method for generating a lexical string representation from an object.</p>
</div>
</div>
<div class="section" id="minor-changes">
<h2>Minor Changes<a class="headerlink" href="#minor-changes" title="Permalink to this headline"></a></h2>
<ul>
<li><p class="first"><a class="reference internal" href="apidocs/rdflib.html#rdflib.namespace.Namespace" title="rdflib.namespace.Namespace"><tt class="xref py py-class docutils literal"><span class="pre">rdflib.namespace.Namespace</span></tt></a> is no longer a sub-class of <a class="reference internal" href="apidocs/rdflib.html#rdflib.term.URIRef" title="rdflib.term.URIRef"><tt class="xref py py-class docutils literal"><span class="pre">rdflib.term.URIRef</span></tt></a>
this was changed as it makes no sense for a namespace to be a node in a graph, and was causing numerous bug. Unless you do something very special, you should not notice this change.</p>
</li>
<li><p class="first">The identifiers for Graphs are now converted to URIRefs if they are not a <a class="reference internal" href="apidocs/rdflib.html#rdflib.term.Node" title="rdflib.term.Node"><tt class="xref py py-class docutils literal"><span class="pre">rdflib.term.Node</span></tt></a>, i.e. no more graphs with string identifiers. Again, unless you do something quite unusual, you should not notice.</p>
</li>
<li><p class="first">String concatenation with URIRefs now returns URIRefs, not strings:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">&gt;&gt;&gt; </span><span class="n">URIRef</span><span class="p">(</span><span class="s">&quot;http://example.org/people/&quot;</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;Bill&quot;</span>
</pre></div>
</div>
<p>rdflib.term.URIRef(u&#8217;<a class="reference external" href="http://example.org/people/Bill">http://example.org/people/Bill</a>&#8216;)</p>
<p>This is be convenient, but may cause trouble if you expected a string.</p>
</li>
</ul>
</div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar">
        <div class="sphinxsidebarwrapper">
            <p class="logo"><a href="index.html">
              <img class="logo" src="_static/logo.svg" alt="Logo"/>
            </a></p>
  <h3><a href="index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Upgrading from RDFLib version 3.X to 4.X</a><ul>
<li><a class="reference internal" href="#sparql-and-sparqlstore-are-now-included-in-core">SPARQL and SPARQLStore are now included in core</a></li>
<li><a class="reference internal" href="#datatyped-literals">Datatyped literals</a><ul>
<li><a class="reference internal" href="#literals-no-longer-compare-equal-across-data-types-with">Literals no longer compare equal across data-types with <tt class="docutils literal"><span class="pre">`==`</span></tt></a></li>
<li><a class="reference internal" href="#literals-will-be-normalised-according-to-datatype">Literals will be normalised according to datatype</a></li>
<li><a class="reference internal" href="#ordering-of-literals-and-nodes-has-changed">Ordering of literals and nodes has changed</a></li>
<li><a class="reference internal" href="#custom-mapping-of-datatypes-to-python-objects">Custom mapping of datatypes to python objects</a></li>
</ul>
</li>
<li><a class="reference internal" href="#minor-changes">Minor Changes</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="merging.html"
                        title="previous chapter">Merging graphs</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="upgrade2to3.html"
                        title="next chapter">Upgrading from RDFLib version 2.X to 3.X</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="_sources/upgrade3to4.txt"
           rel="nofollow">Show Source</a></li>
  </ul>
<div id="searchbox" style="display: none">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> |</li>
        <li class="right" >
          <a href="upgrade2to3.html" title="Upgrading from RDFLib version 2.X to 3.X"
             >next</a> |</li>
        <li class="right" >
          <a href="merging.html" title="Merging graphs"
             >previous</a> |</li>
        <li><a href="index.html">rdflib 4.1.2 documentation</a> &raquo;</li> 
      </ul>
    </div>
<div class="footer">
    &copy; Copyright 2009 - 2013, RDFLib Team.
  Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.2.2.
  <br />Theme based on <a href="http://readthedocs.org/">Read The Docs</a>

</div>





  </body>
</html>