Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fetching JSON-LD does not appear to work #343

Closed
dantman opened this issue Aug 27, 2019 · 2 comments
Closed

Fetching JSON-LD does not appear to work #343

dantman opened this issue Aug 27, 2019 · 2 comments

Comments

@dantman
Copy link

dantman commented Aug 27, 2019

Fetching a JSON-LD document does not appear to put anything into the store.

I tested this out with 1.0.4 by trying to fetch various urls with nowOrWhenFetched and dumping the store with toString when fetched.

I verified my test for fetching data worked by fetching Turtle (application/x-turtle) data. This worked, dumping a pile of data from Book.ttl into the store.

var $rdf = require('rdflib');
var store = $rdf.graph();
var fetcher = new $rdf.Fetcher(store, 5000);
fetcher.nowOrWhenFetched('http://schema.org/Book.ttl', () => { console.log(store.toString()); });

Fetching RDF data failed, however that's fine because schema.org is incorrectly returned a application/xml content-type.

var $rdf = require('rdflib');
var store = $rdf.graph();
var fetcher = new $rdf.Fetcher(store, 5000);
fetcher.nowOrWhenFetched('http://schema.org/Book.rdf', () => { console.log(store.toString()); });

But trying to fetch the JSON-LD version of the document also failed. This failure was not expected because the server correctly sends back a application/ld+json; charset=utf-8 content-type.

var $rdf = require('rdflib');
var store = $rdf.graph();
var fetcher = new $rdf.Fetcher(store, 5000);
fetcher.nowOrWhenFetched('http://schema.org/Book.jsonld', () => { console.log(store.toString()); });
@angelo-v
Copy link
Contributor

Fixed in #468

@bourgeoa
Copy link
Contributor

@angelo-v #468 only soved the predicate part.
see PR #469 that should solve the predicate and object when using @type as a node type or a value type per JSON-LD specification https://json-ld.org/spec/latest/json-ld/#typed-values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants