rdflib-jsonld
rdflib-jsonld copied to clipboard
base is None when the context is a relative IRI
when the load method of a context object is called (parser.py:83), variable base is None although in the parser.py:80 the base is already set in the constructor.
this caused reading a jsonld document of a hydra api demo in (http://www.markus-lanthaler.com/hydra/api-demo/) ended up in a failure as relative IRI stated in the @context /hydra/api-demo/context/EntryPoint.jsonld is interpreted as local file source.
adding 2 lines below in the beginning of load method (context.py:37) fixes the problem.
if base is None and self.base is not None:
base = self.base
Could you provide the code call which causes the problem? The following seems to work without this change:
from rdflib import *
import sys
Graph().parse(
"http://www.markus-lanthaler.com/hydra/api-demo/", format='json-ld').serialize(
sys.stdout, format='turtle')
(Or perhaps the example data has changed?)