summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Watts <watts.mark2015@gmail.com>2020-05-31 22:09:08 -0500
committerMark Watts <watts.mark2015@gmail.com>2020-05-31 22:14:36 -0500
commitbf540416f3d6819626c262ced5ca87be96b80df4 (patch)
tree5ff187e67813a03bf4a35b8b4db02a931090ba4e
parent1a5df0084c6f361c9059ac19e64d632ae503b9b3 (diff)
downloadrdflib-bf540416f3d6819626c262ced5ca87be96b80df4.tar.gz
Adding some docs for bnode_context in N-Quads (#980)
- Also, writing out BNode reference to avoid Sphinx warning - Deleting NTParser __init__ since it doesn't do anything
-rw-r--r--rdflib/plugins/parsers/nquads.py12
-rw-r--r--rdflib/plugins/parsers/nt.py3
-rw-r--r--rdflib/plugins/parsers/ntriples.py7
3 files changed, 16 insertions, 6 deletions
diff --git a/rdflib/plugins/parsers/nquads.py b/rdflib/plugins/parsers/nquads.py
index 0053ccab..a3bfbc6e 100644
--- a/rdflib/plugins/parsers/nquads.py
+++ b/rdflib/plugins/parsers/nquads.py
@@ -41,7 +41,17 @@ __all__ = ["NQuadsParser"]
class NQuadsParser(NTriplesParser):
def parse(self, inputsource, sink, bnode_context=None, **kwargs):
- """Parse f as an N-Triples file."""
+ """
+ Parse inputsource as an N-Quads file.
+
+ :type inputsource: `rdflib.parser.InputSource`
+ :param inputsource: the source of N-Quads-formatted data
+ :type sink: `rdflib.graph.Graph`
+ :param sink: where to send parsed triples
+ :type bnode_context: `dict`, optional
+ :param bnode_context: a dict mapping blank node identifiers to `~rdflib.term.BNode` instances.
+ See `.NTriplesParser.parse`
+ """
assert sink.store.context_aware, (
"NQuadsParser must be given" " a context aware store."
)
diff --git a/rdflib/plugins/parsers/nt.py b/rdflib/plugins/parsers/nt.py
index b2ec445d..c37a1aa0 100644
--- a/rdflib/plugins/parsers/nt.py
+++ b/rdflib/plugins/parsers/nt.py
@@ -17,9 +17,6 @@ class NTParser(Parser):
See http://www.w3.org/TR/rdf-testcases/#ntriples"""
- def __init__(self):
- super(NTParser, self).__init__()
-
def parse(self, source, sink, **kwargs):
'''
Parse the NT format
diff --git a/rdflib/plugins/parsers/ntriples.py b/rdflib/plugins/parsers/ntriples.py
index 2e83204c..33a4a4e6 100644
--- a/rdflib/plugins/parsers/ntriples.py
+++ b/rdflib/plugins/parsers/ntriples.py
@@ -142,10 +142,13 @@ class NTriplesParser(object):
"""
Parse f as an N-Triples file.
+ :type f: :term:`file object`
:param f: the N-Triples source
+ :type bnode_context: `dict`, optional
:param bnode_context: a dict mapping blank node identifiers (e.g., ``a`` in ``_:a``)
- to `.BNode` instances. An empty dict can be passed in to
- define a distinct context for a given call to `parse`.
+ to `~rdflib.term.BNode` instances. An empty dict can be
+ passed in to define a distinct context for a given call to
+ `parse`.
"""
if not hasattr(f, "read"):
raise ParseError("Item to parse must be a file-like object.")