-
Notifications
You must be signed in to change notification settings - Fork 2
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
Error when trying to dereference relative URIs in jsonld #21
Comments
Any news? |
I get the error if my local server doesn't set When I add that header, URIs are properly resolved. |
Hm, then something strange is going on. $ npm run urdf query query.rq
> [email protected] urdf
> node src/cli.js "query" "query.rq"
(node:5754) UnhandledPromiseRejectionWarning: jsonld.InvalidUrl: Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context.
at /tmp/uRDF.js/node_modules/jsonld/lib/context.js:1000:15
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:5754) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:5754) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
$ $ curl -v "http://localhost/data.jsonld" > /dev/null
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying ::1:80...
* Connected to localhost (::1) port 80 (#0)
> GET /data.jsonld HTTP/1.1
> Host: localhost
> User-Agent: curl/7.74.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Date: Wed, 24 Feb 2021 22:36:53 GMT
< Server: Apache/2.4.46 (Debian)
< Last-Modified: Wed, 24 Feb 2021 22:35:07 GMT
< ETag: "38-5bc1ca59efe88"
< Accept-Ranges: bytes
< Content-Length: 56
< Access-Control-Allow-Origin: *
< Content-Type: application/ld+json
<
{ [56 bytes data]
100 56 100 56 0 0 28000 0 --:--:-- --:--:-- --:--:-- 28000
* Connection #0 to host localhost left intact $ curl -v "http://localhost/context.jsonld" > /dev/null
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying ::1:80...
* Connected to localhost (::1) port 80 (#0)
> GET /context.jsonld HTTP/1.1
> Host: localhost
> User-Agent: curl/7.74.0
> Accept: */*
>
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Date: Wed, 24 Feb 2021 22:37:08 GMT
< Server: Apache/2.4.46 (Debian)
< Last-Modified: Wed, 24 Feb 2021 22:35:17 GMT
< ETag: "48-5bc1ca632b3e4"
< Accept-Ranges: bytes
< Content-Length: 72
< Access-Control-Allow-Origin: *
< Content-Type: application/ld+json
<
{ [72 bytes data]
100 72 100 72 0 0 36000 0 --:--:-- --:--:-- --:--:-- 72000
* Connection #0 to host localhost left intact
$ When I change data.jsonld to (a context with an absolute URI)
it seems to work
We would like to use a source which puts relative URIs to context files. |
Alright. Can you make these files publicly available so that I can reproduce the error on the same resources as you? |
http://harth.org/andreas/2021/urdf/ Any query with FROM http://harth.org/andreas/2021/urdf/index.jsonld |
Quick question: we have to prepare a demo for next Wednesday... should we set up an elaborate workaround? |
I overlooked your last comment, sorry. 94d482b fixes the issue. |
Thank you, I can confirm this bug is fixed for the I tried to do this executing the following file via node ( const urdf = require('./src/urdf-module.js');
// urdf.query with SELECT FROM - this is working
// const querySelectFrom = 'SELECT * FROM <http://harth.org/andreas/2021/urdf/index.jsonld> WHERE { ?s ?p ?o . }';
// urdf.query(querySelectFrom).then(console.log);
urdf.loadFrom('http://harth.org/andreas/2021/urdf/index.jsonld')
.then(() => {
console.log(urdf.size()); // 18
urdf.query('SELECT * WHERE { ?s ?p ?o . }').then(console.log) // []
}); |
Expected Behavior
The jsonld is loaded into the urdf store and then queried
Current Behavior
Upon loading urdf reports the following error and stops:
Steps to Reproduce
1. Create data and context files
Create a file (called
data.jsonld
in this example) with the following content:and a file (called
context.jsonld
in this example) with the content:2. Host the files locally
Host the 2 files from 1. locally. For example with apache
3. Create a query file
create a file (called
query.sparqle
in this example) with the following content:Execute the query with urdf
From within the urdf directory, run the following command to execute the query:
npm run urdf query query.sparql
Context (Environment)
We are trying to use urdf to query the jsonld returned by the sc-ble-adapter.
A simliar issue has been resolved in the urdf browser (kianschmalenbach/rdf-browser#11)
The text was updated successfully, but these errors were encountered: