diff --git a/rdflib/graph.py b/rdflib/graph.py index 19ce254ac..905f6d0ea 100644 --- a/rdflib/graph.py +++ b/rdflib/graph.py @@ -1,9 +1,7 @@ from rdflib.term import Literal # required for doctests -l = Literal('') -del l +assert Literal # avoid warning from rdflib.namespace import Namespace # required for doctests -n = Namespace('xxx') -del n +assert Namespace # avoid warning from rdflib.py3compat import format_doctest_out __doc__ = format_doctest_out("""\ diff --git a/rdflib/term.py b/rdflib/term.py index 25c22c5cb..546482a6e 100644 --- a/rdflib/term.py +++ b/rdflib/term.py @@ -148,7 +148,7 @@ def __gt__(self, other): This tries to implement this: http://www.w3.org/TR/sparql11-query/#modOrderBy - Variables are no included in the SPARQL list, but + Variables are not included in the SPARQL list, but they are greater than BNodes and smaller than everything else """ @@ -190,10 +190,6 @@ def __hash__(self): class URIRef(Identifier): """ RDF URI Reference: http://www.w3.org/TR/rdf-concepts/#section-Graph-URIref - - The URIRef constructor will do a limited check for valid URIs, - essentially just making sure that the string includes no illegal - characters (``<, >, ", {, }, |, \\, `, ^``) """ __slots__ = () @@ -220,6 +216,15 @@ def toPython(self): return unicode(self) def n3(self, namespace_manager = None): + """ + This will do a limited check for valid URIs, + essentially just making sure that the string includes no illegal + characters (``<, >, ", {, }, |, \\, `, ^``) + + :param namespace_manager: if not None, will be used to make up + a prefixed name + """ + if not _is_valid_uri(self): raise Exception('"%s" does not look like a valid URI, I cannot serialize this as N3/Turtle. Perhaps you wanted to urlencode it?'%self)