rdflib-jsonld icon indicating copy to clipboard operation
rdflib-jsonld copied to clipboard

base is None when the context is a relative IRI

Open pebbie opened this issue 11 years ago • 1 comments

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

pebbie avatar Sep 14 '14 20:09 pebbie

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?)

niklasl avatar Oct 19 '14 09:10 niklasl