Skip to content

Commit

Permalink
Fixed the return type of parse function of ConjunctiveGraph (Issue RD…
Browse files Browse the repository at this point in the history
  • Loading branch information
arnavpisces committed May 29, 2020
1 parent 037ea51 commit 0e7460c
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions rdflib/graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -1538,15 +1538,25 @@ def parse(
data=data,
format=format,
)


g_id = publicID and publicID or source.getPublicId()
if not isinstance(g_id, Node):
g_id = URIRef(g_id)

context = Graph(store=self.store, identifier=g_id)
context.remove((None, None, None)) # hmm ?
context.parse(source, publicID=publicID, format=format, **args)
return context

if format is None:
format = source.content_type
if format is None:
# raise Exception("Could not determine format for %r. You can" + \
# "expicitly specify one with the format argument." % source)
format = "application/rdf+xml"
parser = plugin.get(format, Parser)()
try:
parser.parse(source, self, **args)
finally:
if source.auto_close:
source.close()
return self

def __reduce__(self):
return ConjunctiveGraph, (self.store, self.identifier)
Expand Down

0 comments on commit 0e7460c

Please sign in to comment.