Open jormalaaksonen opened 3 years ago
A bit more functional patch:
*** ./venv/lib/python3.8/site-packages/rdflib_jsonld/parser.py.orig 2020-12-27 09:23:07.000000000 +0200
--- ./venv/lib/python3.8/site-packages/rdflib_jsonld/parser.py 2020-12-27 11:02:27.972823101 +0200
***************
*** 122,127 ****
--- 122,129 ----
elif isinstance(data, dict):
l_ctx = data.get(CONTEXT)
if l_ctx:
+ if not isinstance(l_ctx, dict):
+ l_ctx = { '@vocab': l_ctx }
context.load(l_ctx, context.base)
topcontext = True
resources = data
Hello!
I encountered a problem with a piece of code that tried to parse context that is a plain URI string instead of a dict of terms and URIs. The code is below and, as can be seen, the first parse() with a dict argument works whereas the second one with the plain string argument fails. The attached patch corrects the issue, but it may be just a workaround instead of a real remedy.
Yours, Jorma