Whether cross-domain URIs are supported by rdflib.js
?
The following URIs are not parsed by fetcher.nowOrWhenFetched
:
- https://www.w3.org/2000/01/rdf-schema#
- https://www.dublincore.org/specifications/dublin-core/dcmi-terms/dublin_core_terms.ttl
- http://purl.obolibrary.org/obo/GENEPIO_0100155
- http://purl.obolibrary.org/obo/NCBITaxon_2697049
- ...
Error:
has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Code:
// source:https://github.com/solidos/solid-tutorial-rdflib.js#fetch-data-into-the-store-from-the-web
var uri = 'http://purl.obolibrary.org/obo/GENEPIO_0100155';
var store = $rdf.graph();
var timeout = 5000; // 5000 ms timeout
var fetcher = new $rdf.Fetcher(store, timeout);
fetcher.nowOrWhenFetched(uri, function(ok, body, response) {
if (!ok) {
console.log("Oops, something happened and couldn't fetch data " + body);
} else if (response.onErrorWasCalled || response.status !== 200) {
console.log(' Non-HTTP error reloading data! onErrorWasCalled=' + response.onErrorWasCalled + ' status: ' + response.status);
} else {
console.log("---data loaded---");
var dataList = store.statements;
for (var i=0; i<dataList.length;i++) {
data = dataList[i]
console.log(data)
}
console.log(store.namespaces);
}
});
Best regards