RDFLib / rdflib-jsonld

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

not loading jsonld file #53

Open noorbakerally opened 6 years ago

noorbakerally commented 6 years ago

I have a valid jsonld file at https://data.hikob.com/osc/parking but rdflib is not loading it. My codes are:

>>> from rdflib import Graph, plugin
INFO:rdflib:RDFLib Version: 4.2.1
>>> g = Graph().parse("https://data.hikob.com/osc/parking",format="json-ld")
>>> g.serialize()
'<?xml version="1.0" encoding="UTF-8"?>\n<rdf:RDF\n   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"\n>\n</rdf:RDF>\n'
bjonnh commented 6 years ago

Same here with: https://rdf.ncbi.nlm.nih.gov/pubchem/inchikey/QOXFATMGLMTFHP-HFSMHLIXSA-N.json

niklasl commented 6 years ago

This is a consequence of the problem described in #34 (thus dependent on RDFLib/rdflib#436). If you use code like this it should work:

from rdflib import *
g = ConjunctiveGraph()
g.parse("https://data.hikob.com/osc/parking", format="json-ld")
print(g.serialize())
niklasl commented 6 years ago

@bjonnh: your data seems to be in RDF/JSON, which is a different format than JSON-LD (and rdflib-jsonld only supports the latter).

danbri commented 6 years ago

I think I've hit the same issue, with https://raw.githubusercontent.com/iot-schema-collab/iotschema/master/thing.jsonld , which the JSON-LD playground seems happy with. Tried some of the techniques mentioned and linked here, no success yet.

danbri commented 6 years ago

I found a fix, https://github.com/RDFLib/rdflib-jsonld/issues/40#issuecomment-376513850

jerrygaoLondon commented 6 years ago

still does not work with latest version when parsing the format with @context and @graph as the example file mentioned above.