Skip to content

Using 'url' to get the base URI for a resource#380

Closed
antoniogarrote wants to merge 2 commits into
nodeSolidServer:masterfrom
antoniogarrote:fixing_jsonld_baseurl
Closed

Using 'url' to get the base URI for a resource#380
antoniogarrote wants to merge 2 commits into
nodeSolidServer:masterfrom
antoniogarrote:fixing_jsonld_baseurl

Conversation

@antoniogarrote

@antoniogarrote antoniogarrote commented May 23, 2016

Copy link
Copy Markdown

'baseUrl' was returning the empty string, leading to a url for the
resource always matching the domain.
This was causing an error in the JSON-LD serialization:

curl -iv -X GET -H "Accept: application/ld+json" -k https://localhost:8443/20160512191736/

[{"@id":"https://localhost:8443", ...}]
curl -iv -X GET -H "Accept: application/ld+json" -k https://localhost:8443/20160512191736/Library/

[{"@id":"https://localhost:8443", ... }]

The change fixes the error and now it returns the right value for the '@id' property.

@dmitrizagidulin

Copy link
Copy Markdown
Contributor

Thanks @antoniogarrote! We'll take a look shortly.

@nicola

nicola commented May 25, 2016

Copy link
Copy Markdown
Contributor

Hey @antoniogarrote nice to see you here :)

I don't understand your example. Can you show me a valid and an invalid outcome? Paths are meant to be relative to the base (https://127.0.0.1:8443 in your case), let me know

'baseUrl' was returning the empty string, leading to a url for the
resource matching the domain. This was causing an error in the JSON-LD
serialization.
@antoniogarrote antoniogarrote force-pushed the fixing_jsonld_baseurl branch from 3b261df to df70115 Compare May 26, 2016 04:47
@antoniogarrote

Copy link
Copy Markdown
Author

Hi @dmitrizagidulin, @nicola , thanks for your work on Solid.

I have added a test to try to clarify the issue.

Basically, I was always getting always only protocol+domain as the URI of the resource I was trying to fetch. So if the resource is 'https://domain/path/to/document#me', I was only getting 'https://domain#me' in the JSON-LD payload when I requested 'https://domain/path/to/document'.
It only happened if I requested the JSON-LD serialisation.

I tracked to the way the base uri was being generated in 'lib/utils.js' and the way it is passed to the JSON-LD library in the translation logic.

I don't know much about express, so I hope it is not because of some kind of misconfiguration on my side.

Thanks!

@nicola

nicola commented May 26, 2016

Copy link
Copy Markdown
Contributor

Hey @antoniogarrote thanks a lot, I understand what is the problem now.
This is very interesting, apparently it works well with turtle but not with JSON-LD,

(super thanks for your tests!)

@nicola

nicola commented May 29, 2016

Copy link
Copy Markdown
Contributor

I didn't have time to go through this this week, will fix this soon

@dmitrizagidulin

Copy link
Copy Markdown
Contributor

Possibly related to #476 ?

@dmitrizagidulin

Copy link
Copy Markdown
Contributor

Closing this PR - the fix is being handled instead in PR #496. Thanks again to @antoniogarrote for bringing this to our attention.

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

Successfully merging this pull request may close these issues.

3 participants