RDFLib / rdflib-jsonld

JSON-LD parser and serializer plugins for RDFLib
Other
282 stars 71 forks source link

Namespaces with # #65

Open ksahlmann opened 5 years ago

ksahlmann commented 5 years ago

Hello, I found a bug considering namespaces with # character. See also the post https://groups.google.com/d/msgid/rdflib-dev/fe39d9fc-d407-45b3-b341-5d12d08de90a%40googlegroups.com. Briefly described: when the instance names are separated by # from the namespace and you parse the graph and do SPARQL-queries on it, the result has a wrong namespace with / as separator. Note: there is no prefix or context defined, and JSON-LD has an expanded format.

Debugging the code, I found two places, where the magic and the error happens: comment out in context.py file the following two lines (46, 47):

if hash_index > -1:

            #base = base[0:hash_index]

and in the util.py file let the function norm_url(base, url) do nothing and just return the url as the result. These bugfix worked for expanded JSON-LD with namespaces with # and / as separators to the instance names. Please consider this bugfix on the next release. Thanks!