I'm playing around with querying dbPedia.
I'm filling in a DESCRIBE query from the web SPARQL interface and I set the format to JSON-LD (with context).
This is the resulting URL. In the browser it shows me a plain json-ld result.
If I make the same request from my application with fetch and parse the json result with jsonld I get the following error:
jsonld.SyntaxError: Invalid JSON-LD syntax; term in form of IRI must expand to definition.
at Object.../core/node_modules/jsonld/lib/context.js.api.createTermDefinition (context.js:632)
at ../core/node_modules/jsonld/lib/context.js.api.process (context.js:371)
at async ../core/node_modules/jsonld/lib/expand.js.api.expand (expand.js:211)
at async Function.jsonld.expand (jsonld.js:325)
at async Function.jsonld.toRDF (jsonld.js:671)
When I inspect I see that termIRI !== id where termIRI is netIncomehttp://dbpedia.org/datatype/polishZÅoty" and id is http://dbpedia.org/ontology/netIncome
The strange context value with a text followed by a URI is because dbPedia uses a context entry for each property in the result, and when the property is used with multiple datatypes, it creates multiple contexts for each.
In this case jsonld breaks at the following key-value pair in @context:
I'm playing around with querying dbPedia. I'm filling in a DESCRIBE query from the web SPARQL interface and I set the format to JSON-LD (with context).
This is the resulting URL. In the browser it shows me a plain json-ld result.
If I make the same request from my application with
fetch
and parse the json result withjsonld
I get the following error:When I inspect I see that
termIRI !== id
where termIRI isnetIncomehttp://dbpedia.org/datatype/polishZÅoty"
and id ishttp://dbpedia.org/ontology/netIncome
The strange context value with a text followed by a URI is because dbPedia uses a context entry for each property in the result, and when the property is used with multiple datatypes, it creates multiple contexts for each.
In this case
jsonld
breaks at the following key-value pair in @context:I notice it uses both an @id and a @type, is this part of the standard? and is it supported? Or is it the special characters that break things?