Skip to content

Commit

Permalink
tiny doc cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
gromgull committed Apr 27, 2014
1 parent f6690c5 commit 9416ef2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
6 changes: 2 additions & 4 deletions rdflib/graph.py
Original file line number Diff line number Diff line change
@@ -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("""\
Expand Down
15 changes: 10 additions & 5 deletions rdflib/term.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand Down Expand Up @@ -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__ = ()
Expand All @@ -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)

Expand Down

0 comments on commit 9416ef2

Please sign in to comment.