This file is indexed.

/usr/share/doc/python-rdflib-doc/html/gettingstarted.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
215
216
217
218
219
220
221
222
<!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>Getting started with RDFLib &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="Loading and saving RDF" href="intro_to_parsing.html" />
    <link rel="prev" title="rdflib 4.1.2" href="index.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="intro_to_parsing.html" title="Loading and saving RDF"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="index.html" title="rdflib 4.1.2"
             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="getting-started-with-rdflib">
<span id="gettingstarted"></span><h1>Getting started with RDFLib<a class="headerlink" href="#getting-started-with-rdflib" title="Permalink to this headline"></a></h1>
<div class="section" id="installation">
<h2>Installation<a class="headerlink" href="#installation" title="Permalink to this headline"></a></h2>
<p>RDFLib is open source and is maintained in a
<a class="reference external" href="http://github.com/RDFLib/rdflib/">GitHub</a> repository. RDFLib releases, current and previous
are listed on <a class="reference external" href="http://pypi.python.org/pypi/rdflib/">PyPi</a></p>
<p>The best way to install RDFLib is to use <tt class="docutils literal"><span class="pre">easy_install</span></tt> or <tt class="docutils literal"><span class="pre">pip</span></tt>:</p>
<div class="highlight-bash"><div class="highlight"><pre><span class="nv">$ </span>easy_install rdflib
</pre></div>
</div>
<p>Support is available through the rdflib-dev group:</p>
<blockquote>
<div><a class="reference external" href="http://groups.google.com/group/rdflib-dev">http://groups.google.com/group/rdflib-dev</a></div></blockquote>
<p>and on the IRC channel <a class="reference external" href="irc://irc.freenode.net/swig">#rdflib</a> on the freenode.net server</p>
<p>The primary interface that RDFLib exposes for working with RDF is a
<a class="reference internal" href="apidocs/rdflib.html#rdflib.graph.Graph" title="rdflib.graph.Graph"><tt class="xref py py-class docutils literal"><span class="pre">Graph</span></tt></a>. The package uses various Python idioms
that offer an appropriate way to introduce RDF to a Python programmer
who hasn&#8217;t worked with RDF before.</p>
<p>RDFLib graphs are not sorted containers; they have ordinary <tt class="docutils literal"><span class="pre">set</span></tt>
operations (e.g. <tt class="xref py py-meth docutils literal"><span class="pre">add()</span></tt> to add a triple) plus
methods that search triples and return them in arbitrary order.</p>
<p>RDFLib graphs also redefine certain built-in Python methods in order
to behave in a predictable way; they <a class="reference external" href="http://docs.python.org/release/2.5.2/ref/sequence-types.html">emulate container types</a> and
are best thought of as a set of 3-item triples:</p>
<div class="highlight-text"><div class="highlight"><pre>[
    (subject,  predicate,  object),
    (subject1, predicate1, object1),
    ...
    (subjectN, predicateN, objectN)
 ]
</pre></div>
</div>
<p>A tiny usage example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">rdflib</span>

<span class="n">g</span> <span class="o">=</span> <span class="n">rdflib</span><span class="o">.</span><span class="n">Graph</span><span class="p">()</span>
<span class="n">result</span> <span class="o">=</span> <span class="n">g</span><span class="o">.</span><span class="n">parse</span><span class="p">(</span><span class="s">&quot;http://www.w3.org/People/Berners-Lee/card&quot;</span><span class="p">)</span>

<span class="k">print</span><span class="p">(</span><span class="s">&quot;graph has </span><span class="si">%s</span><span class="s"> statements.&quot;</span> <span class="o">%</span> <span class="nb">len</span><span class="p">(</span><span class="n">g</span><span class="p">))</span>
<span class="c"># prints graph has 79 statements.</span>

<span class="k">for</span> <span class="n">subj</span><span class="p">,</span> <span class="n">pred</span><span class="p">,</span> <span class="n">obj</span> <span class="ow">in</span> <span class="n">g</span><span class="p">:</span>
   <span class="k">if</span> <span class="p">(</span><span class="n">subj</span><span class="p">,</span> <span class="n">pred</span><span class="p">,</span> <span class="n">obj</span><span class="p">)</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">g</span><span class="p">:</span>
       <span class="k">raise</span> <span class="ne">Exception</span><span class="p">(</span><span class="s">&quot;It better be!&quot;</span><span class="p">)</span>

<span class="n">s</span> <span class="o">=</span> <span class="n">g</span><span class="o">.</span><span class="n">serialize</span><span class="p">(</span><span class="n">format</span><span class="o">=</span><span class="s">&#39;n3&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>A more extensive example:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">rdflib</span> <span class="kn">import</span> <span class="n">Graph</span><span class="p">,</span> <span class="n">Literal</span><span class="p">,</span> <span class="n">BNode</span><span class="p">,</span> <span class="n">Namespace</span><span class="p">,</span> <span class="n">RDF</span><span class="p">,</span> <span class="n">URIRef</span>
<span class="kn">from</span> <span class="nn">rdflib.namespace</span> <span class="kn">import</span> <span class="n">DC</span><span class="p">,</span> <span class="n">FOAF</span>

<span class="n">g</span> <span class="o">=</span> <span class="n">Graph</span><span class="p">()</span>

<span class="c"># Create an identifier to use as the subject for Donna.</span>
<span class="n">donna</span> <span class="o">=</span> <span class="n">BNode</span><span class="p">()</span>

<span class="c"># Add triples using store&#39;s add method.</span>
<span class="n">g</span><span class="o">.</span><span class="n">add</span><span class="p">(</span> <span class="p">(</span><span class="n">donna</span><span class="p">,</span> <span class="n">RDF</span><span class="o">.</span><span class="n">type</span><span class="p">,</span> <span class="n">FOAF</span><span class="o">.</span><span class="n">Person</span><span class="p">)</span> <span class="p">)</span>
<span class="n">g</span><span class="o">.</span><span class="n">add</span><span class="p">(</span> <span class="p">(</span><span class="n">donna</span><span class="p">,</span> <span class="n">FOAF</span><span class="o">.</span><span class="n">nick</span><span class="p">,</span> <span class="n">Literal</span><span class="p">(</span><span class="s">&quot;donna&quot;</span><span class="p">,</span> <span class="n">lang</span><span class="o">=</span><span class="s">&quot;foo&quot;</span><span class="p">))</span> <span class="p">)</span>
<span class="n">g</span><span class="o">.</span><span class="n">add</span><span class="p">(</span> <span class="p">(</span><span class="n">donna</span><span class="p">,</span> <span class="n">FOAF</span><span class="o">.</span><span class="n">name</span><span class="p">,</span> <span class="n">Literal</span><span class="p">(</span><span class="s">&quot;Donna Fales&quot;</span><span class="p">))</span> <span class="p">)</span>
<span class="n">g</span><span class="o">.</span><span class="n">add</span><span class="p">(</span> <span class="p">(</span><span class="n">donna</span><span class="p">,</span> <span class="n">FOAF</span><span class="o">.</span><span class="n">mbox</span><span class="p">,</span> <span class="n">URIRef</span><span class="p">(</span><span class="s">&quot;mailto:donna@example.org&quot;</span><span class="p">))</span> <span class="p">)</span>

<span class="c"># Iterate over triples in store and print them out.</span>
<span class="k">print</span><span class="p">(</span><span class="s">&quot;--- printing raw triples ---&quot;</span><span class="p">)</span>
<span class="k">for</span> <span class="n">s</span><span class="p">,</span> <span class="n">p</span><span class="p">,</span> <span class="n">o</span> <span class="ow">in</span> <span class="n">g</span><span class="p">:</span>
    <span class="k">print</span><span class="p">((</span><span class="n">s</span><span class="p">,</span> <span class="n">p</span><span class="p">,</span> <span class="n">o</span><span class="p">))</span>

<span class="c"># For each foaf:Person in the store print out its mbox property.</span>
<span class="k">print</span><span class="p">(</span><span class="s">&quot;--- printing mboxes ---&quot;</span><span class="p">)</span>
<span class="k">for</span> <span class="n">person</span> <span class="ow">in</span> <span class="n">g</span><span class="o">.</span><span class="n">subjects</span><span class="p">(</span><span class="n">RDF</span><span class="o">.</span><span class="n">type</span><span class="p">,</span> <span class="n">FOAF</span><span class="o">.</span><span class="n">Person</span><span class="p">):</span>
    <span class="k">for</span> <span class="n">mbox</span> <span class="ow">in</span> <span class="n">g</span><span class="o">.</span><span class="n">objects</span><span class="p">(</span><span class="n">person</span><span class="p">,</span> <span class="n">FOAF</span><span class="o">.</span><span class="n">mbox</span><span class="p">):</span>
        <span class="k">print</span><span class="p">(</span><span class="n">mbox</span><span class="p">)</span>

<span class="c"># Bind a few prefix, namespace pairs for more readable output</span>
<span class="n">g</span><span class="o">.</span><span class="n">bind</span><span class="p">(</span><span class="s">&quot;dc&quot;</span><span class="p">,</span> <span class="n">DC</span><span class="p">)</span>
<span class="n">g</span><span class="o">.</span><span class="n">bind</span><span class="p">(</span><span class="s">&quot;foaf&quot;</span><span class="p">,</span> <span class="n">FOAF</span><span class="p">)</span>

<span class="k">print</span><span class="p">(</span> <span class="n">g</span><span class="o">.</span><span class="n">serialize</span><span class="p">(</span><span class="n">format</span><span class="o">=</span><span class="s">&#39;n3&#39;</span><span class="p">)</span> <span class="p">)</span>
</pre></div>
</div>
<p>Many more <a class="reference internal" href="apidocs/examples.html"><em>examples</em></a> can be found in the <tt class="file docutils literal"><span class="pre">examples</span></tt> folder in the source distribution.</p>
</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="#">Getting started with RDFLib</a><ul>
<li><a class="reference internal" href="#installation">Installation</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="index.html"
                        title="previous chapter">rdflib 4.1.2</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="intro_to_parsing.html"
                        title="next chapter">Loading and saving RDF</a></p>
  <h3>This Page</h3>
  <ul class="this-page-menu">
    <li><a href="_sources/gettingstarted.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="intro_to_parsing.html" title="Loading and saving RDF"
             >next</a> |</li>
        <li class="right" >
          <a href="index.html" title="rdflib 4.1.2"
             >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>