/usr/share/doc/python-rdflib-doc/html/persistence.html is in python-rdflib-doc 4.2.1-2.
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 | <!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>Persistence — rdflib 4.2.1 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.2.1',
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="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="top" title="rdflib 4.2.1 documentation" href="index.html" />
<link rel="next" title="Merging graphs" href="merging.html" />
<link rel="prev" title="Namespaces and Bindings" href="namespaces_and_bindings.html" />
</head>
<body role="document">
<div class="related" role="navigation" aria-label="related navigation">
<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="merging.html" title="Merging graphs"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="namespaces_and_bindings.html" title="Namespaces and Bindings"
accesskey="P">previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">rdflib 4.2.1 documentation</a> »</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="id1">
<h1>Persistence<a class="headerlink" href="#id1" title="Permalink to this headline">¶</a></h1>
<p>RDFLib provides an <a class="reference internal" href="apidocs/rdflib.html#rdflib.store.Store" title="rdflib.store.Store"><code class="xref py py-class docutils literal"><span class="pre">abstracted</span> <span class="pre">Store</span> <span class="pre">API</span></code></a>
for persistence of RDF and Notation 3. The
<a class="reference internal" href="apidocs/rdflib.html#rdflib.graph.Graph" title="rdflib.graph.Graph"><code class="xref py py-class docutils literal"><span class="pre">Graph</span></code></a> class works with instances of this API
(as the first argument to its constructor) for triple-based management
of an RDF store including: garbage collection, transaction management,
update, pattern matching, removal, length, and database management
(<a class="reference internal" href="apidocs/rdflib.html#rdflib.graph.Graph.open" title="rdflib.graph.Graph.open"><code class="xref py py-meth docutils literal"><span class="pre">open()</span></code></a> / <a class="reference internal" href="apidocs/rdflib.html#rdflib.graph.Graph.close" title="rdflib.graph.Graph.close"><code class="xref py py-meth docutils literal"><span class="pre">close()</span></code></a>
/ <a class="reference internal" href="apidocs/rdflib.html#rdflib.graph.Graph.destroy" title="rdflib.graph.Graph.destroy"><code class="xref py py-meth docutils literal"><span class="pre">destroy()</span></code></a>).</p>
<p>Additional persistence mechanisms can be supported by implementing
this API for a different store.</p>
<div class="section" id="stores-currently-shipped-with-core-rdflib">
<h2>Stores currently shipped with core RDFLib<a class="headerlink" href="#stores-currently-shipped-with-core-rdflib" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li><a class="reference internal" href="apidocs/rdflib.plugins.html#rdflib.plugins.memory.IOMemory" title="rdflib.plugins.memory.IOMemory"><code class="xref py py-class docutils literal"><span class="pre">Memory</span></code></a> (not persistent!)</li>
<li><a class="reference internal" href="apidocs/rdflib.plugins.html#rdflib.plugins.sleepycat.Sleepycat" title="rdflib.plugins.sleepycat.Sleepycat"><code class="xref py py-class docutils literal"><span class="pre">Sleepycat</span></code></a> (on disk persistence via Python’s <span class="xref std std-ref">bsddb</span> or <span class="xref std std-ref">bsddb3</span> packages)</li>
<li><a class="reference internal" href="apidocs/rdflib.plugins.stores.html#rdflib.plugins.stores.sparqlstore.SPARQLStore" title="rdflib.plugins.stores.sparqlstore.SPARQLStore"><code class="xref py py-class docutils literal"><span class="pre">SPARQLStore</span></code></a> - a read-only wrapper around a remote SPARQL Query endpoint.</li>
<li><a class="reference internal" href="apidocs/rdflib.plugins.stores.html#rdflib.plugins.stores.sparqlstore.SPARQLUpdateStore" title="rdflib.plugins.stores.sparqlstore.SPARQLUpdateStore"><code class="xref py py-class docutils literal"><span class="pre">SPARQLUpdateStore</span></code></a> - a read-write wrapper around a remote SPARQL query/update endpoint pair.</li>
</ul>
</div>
<div class="section" id="usage">
<h2>Usage<a class="headerlink" href="#usage" title="Permalink to this headline">¶</a></h2>
<p>Most cases passing the name of the store to the Graph constructor is enough:</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">rdflib</span> <span class="kn">import</span> <span class="n">Graph</span>
<span class="n">graph</span> <span class="o">=</span> <span class="n">Graph</span><span class="p">(</span><span class="n">store</span><span class="o">=</span><span class="s1">'Sleepycat'</span><span class="p">)</span>
</pre></div>
</div>
<p>Most store offering on-disk persistence will need to be opened before reading or writing :</p>
<div class="highlight-python"><div class="highlight"><pre><span></span><span class="n">graph</span> <span class="o">=</span> <span class="n">Graph</span><span class="p">(</span><span class="s1">'Sleepycat'</span><span class="p">)</span>
<span class="c1"># first time create the store:</span>
<span class="n">graph</span><span class="o">.</span><span class="n">open</span><span class="p">(</span><span class="s1">'/home/user/data/myRDFLibStore'</span><span class="p">,</span> <span class="n">create</span> <span class="o">=</span> <span class="bp">True</span><span class="p">)</span>
<span class="c1"># work with the graph:</span>
<span class="n">graph</span><span class="o">.</span><span class="n">add</span><span class="p">(</span> <span class="n">mytriples</span> <span class="p">)</span>
<span class="c1"># when done!</span>
<span class="n">graph</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
</pre></div>
</div>
<p>When done, <a class="reference internal" href="apidocs/rdflib.html#rdflib.graph.Graph.close" title="rdflib.graph.Graph.close"><code class="xref py py-meth docutils literal"><span class="pre">close()</span></code></a> must be called to free the resources associated with the store.</p>
</div>
<div class="section" id="additional-store-plugins">
<h2>Additional store plugins<a class="headerlink" href="#additional-store-plugins" title="Permalink to this headline">¶</a></h2>
<p>More store implementations are available in RDFLib extension projects:</p>
<blockquote>
<div><ul class="simple">
<li><a class="reference external" href="https://github.com/RDFLib/rdflib-sqlalchemy">rdflib-sqlalchemy</a>, which supports stored on a wide-variety of RDBMs backends,</li>
<li><a class="reference external" href="https://github.com/RDFLib/rdflib-leveldb">rdflib-leveldb</a> - a store on to of Google’s <a class="reference external" href="https://code.google.com/p/leveldb/">LevelDB</a> key-value store.</li>
<li><a class="reference external" href="https://github.com/RDFLib/rdflib-kyotocabinet">rdflib-kyotocabinet</a> - a store on to of the <a class="reference external" href="http://fallabs.com/kyotocabinet/">Kyoto Cabinet</a> key-value store.</li>
</ul>
</div></blockquote>
</div>
<div class="section" id="example">
<h2>Example<a class="headerlink" href="#example" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li><a class="reference internal" href="apidocs/examples.html#module-examples.sleepycat_example" title="examples.sleepycat_example"><code class="xref py py-mod docutils literal"><span class="pre">examples.sleepycat_example</span></code></a> contains an example for using a Sleepycat store.</li>
<li><a class="reference internal" href="apidocs/examples.html#module-examples.sparqlstore_example" title="examples.sparqlstore_example"><code class="xref py py-mod docutils literal"><span class="pre">examples.sparqlstore_example</span></code></a> contains an example for using a SPARQLStore.</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<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="#">Persistence</a><ul>
<li><a class="reference internal" href="#stores-currently-shipped-with-core-rdflib">Stores currently shipped with core RDFLib</a></li>
<li><a class="reference internal" href="#usage">Usage</a></li>
<li><a class="reference internal" href="#additional-store-plugins">Additional store plugins</a></li>
<li><a class="reference internal" href="#example">Example</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="namespaces_and_bindings.html"
title="previous chapter">Namespaces and Bindings</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="merging.html"
title="next chapter">Merging graphs</a></p>
<div role="note" aria-label="source link">
<h3>This Page</h3>
<ul class="this-page-menu">
<li><a href="_sources/persistence.txt"
rel="nofollow">Show Source</a></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<div><input type="text" name="q" /></div>
<div><input type="submit" value="Go" /></div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related" role="navigation" aria-label="related navigation">
<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="merging.html" title="Merging graphs"
>next</a> |</li>
<li class="right" >
<a href="namespaces_and_bindings.html" title="Namespaces and Bindings"
>previous</a> |</li>
<li class="nav-item nav-item-0"><a href="index.html">rdflib 4.2.1 documentation</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2016 - 2013, RDFLib Team.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.4.9.
<br />Theme based on <a href="http://readthedocs.org/">Read The Docs</a>
</div>
</body>
</html>
|