summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortombaker <tom@tombaker.org>2021-01-23 16:06:52 +0100
committerGitHub <noreply@github.com>2021-01-23 16:06:52 +0100
commit7afe28d110b2598712efd5f6279d164b8b31d5e8 (patch)
treee671c9b9e9cf5f41dc8b298398d8629b7691f2b3
parent8e3c771a5c6a2787b5a34a9288c7d5d6967ecbbe (diff)
downloadrdflib-7afe28d110b2598712efd5f6279d164b8b31d5e8.tar.gz
Add sentence on names not valid as Python IDs.
-rw-r--r--docs/namespaces_and_bindings.rst2
1 files changed, 2 insertions, 0 deletions
diff --git a/docs/namespaces_and_bindings.rst b/docs/namespaces_and_bindings.rst
index 107079d9..e6885b59 100644
--- a/docs/namespaces_and_bindings.rst
+++ b/docs/namespaces_and_bindings.rst
@@ -17,6 +17,8 @@ The :mod:`rdflib.namespace` defines the :class:`rdflib.namespace.Namespace` clas
n['first%20name'] # as item - for things that are not valid python identifiers
# = rdflib.term.URIRef(u'http://example.org/first%20name')
+Note that if a name string is valid for use in an RDF namespace but not valid as a Python identifier, such as '1234', it must be addressed with the "item" syntax (using the "attribute" syntax will raise a Syntax Error).
+
The ``namespace`` module also defines many common namespaces such as RDF, RDFS, OWL, FOAF, SKOS, etc.
Namespaces can also be associated with prefixes, in a :class:`rdflib.namespace.NamespaceManager`, i.e. using ``foaf`` for ``http://xmlns.com/foaf/0.1/``. Each RDFLib graph has a :attr:`~rdflib.graph.Graph.namespace_manager` that keeps a list of namespace to prefix mappings. The namespace manager is populated when reading in RDF, and these prefixes are used when serialising RDF, or when parsing SPARQL queries. Additional prefixes can be bound with the :meth:`rdflib.graph.bind` method.