Skip to content

Commit 6a6f632

Browse files
author
nicholascar
committed
docco improvements
1 parent 56bee18 commit 6a6f632

File tree

3 files changed

+25
-17
lines changed

3 files changed

+25
-17
lines changed

docs/gettingstarted.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ operations (e.g. :meth:`~rdflib.Graph.add` to add a triple) plus
5050
methods that search triples and return them in arbitrary order.
5151

5252
RDFLib graphs also redefine certain built-in Python methods in order
53-
to behave in a predictable way: they `emulating container types
53+
to behave in a predictable way. They do this by `emulating container types
5454
<https://docs.python.org/3.7/reference/datamodel.html#emulating-container-types>`_ and
5555
are best thought of as a set of 3-item tuples ("triples", in RDF-speak):
5656

rdflib/namespace/__init__.py

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -305,29 +305,36 @@ def _ipython_key_completions_(self) -> List[str]:
305305

306306

307307
class NamespaceManager(object):
308-
"""
309-
310-
Class for managing prefix => namespace mappings
311-
312-
Sample usage from FuXi ...
313-
314-
.. code-block:: python
315-
316-
ruleStore = N3RuleStore(additionalBuiltins=additionalBuiltins)
317-
nsMgr = NamespaceManager(Graph(ruleStore))
318-
ruleGraph = Graph(ruleStore,namespace_manager=nsMgr)
319-
320-
321-
and ...
308+
"""Class for managing prefix => namespace mappings
309+
310+
This class requires an RDFlib Graph as an input parameter and may optionally have
311+
the parameter bind_namespaces set. This second parameter selects a strategy which
312+
is one of the following:
313+
314+
* core:
315+
* binds several core prefixes only
316+
* owl, rdf, rdfs, xsd, xml from the NAMESPACE_PREFIXES_CORE object
317+
* this is detfault
318+
* rdflib:
319+
* binds all the namespaces shipped with RDFLib as DefinedNamespace instances
320+
* all the core namespaces and all the following: brick, csvw, dc, dcat
321+
* dcmitype, cdterms, dcam, doap, foaf, geo, odrl, org, prof, prov, qb, sdo
322+
* sh, skos, sosa, ssn, time, vann, void
323+
* see the NAMESPACE_PREFIXES_RDFLIB object for the up-to-date list
324+
* cc:
325+
* using prefix bindings from prefix.cc which is a online prefixes database
326+
327+
See the
328+
Sample usage
322329
323330
.. code-block:: pycon
324331
325332
>>> import rdflib
326333
>>> from rdflib import Graph
327334
>>> from rdflib.namespace import Namespace, NamespaceManager
328-
>>> exNs = Namespace('http://example.com/')
335+
>>> EX = Namespace('http://example.com/')
329336
>>> namespace_manager = NamespaceManager(Graph())
330-
>>> namespace_manager.bind('ex', exNs, override=False)
337+
>>> namespace_manager.bind('ex', EX, override=False)
331338
>>> g = Graph()
332339
>>> g.namespace_manager = namespace_manager
333340
>>> all_ns = [n for n in g.namespace_manager.namespaces()]

test/test_namespacemanager.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ def test_rdflib_prefixes_bound():
2222
assert len(list(g.namespaces())) == \
2323
len(NAMESPACE_PREFIXES_CORE) + len(list(NAMESPACE_PREFIXES_RDFLIB))
2424

25+
2526
def test_cc_prefixes_bound():
2627
pass

0 commit comments

Comments
 (0)