skohub-io / skohub-vocabs

A lightweight tool to publish SKOS Vocabularies
https://skohub.io/
Apache License 2.0
36 stars 25 forks source link

Add hub and inbox links #22

Closed literarymachine closed 5 years ago

literarymachine commented 5 years ago

See e.g. https://test.skohub.io/literarymachine/skos/w3id.org/class/hochschulfaecher/F17.html and https://test.skohub.io/literarymachine/skos/w3id.org/class/hochschulfaecher/F17.json

Fixes #10

fsteeg commented 5 years ago

I get an error on npm run build and npm run develop in 10-addHubAndInboxLinks:

ERROR 

UNHANDLED REJECTION Cannot read property 'replace' of undefined

  TypeError: Cannot read property 'replace' of undefined

  - url-template.js:156 Object.expand
    [skohub-ssg]/[url-template]/lib/url-template.js:156:25

  - gatsby-node.js:58 compacted.@graph.forEach
    /home/fsteeg/git/skohub-ssg/gatsby-node.js:58:29

  - Array.forEach

  - gatsby-node.js:41 writer.end
    /home/fsteeg/git/skohub-ssg/gatsby-node.js:41:25

Local build on master works fine.

literarymachine commented 5 years ago

The devil is in the detail, you need to update your .env with the INBOX and HUB URL templates as described in the .env.example.

fsteeg commented 5 years ago

you need to update your .env with the INBOX and HUB URL templates

OK, this works now. I updated the README in https://github.com/hbz/skohub-ssg/pull/22/commits/63a36bec5b7a995367366a499aaf25b28216dbcb.

I have then tried to set it up with a local hub (and updated README in https://github.com/hbz/skohub-ssg/pull/22/commits/532ed5badb0eaceacbeb116974bf1de9fe18d560):

INBOX=http://localhost:3000/inbox?target={id}
HUB=http://localhost:3000/hub

But I get 'Invalid link headers for target URL' for the Inbox link.

And 'Invalid topic or hub URL' for the Subscribe button.

literarymachine commented 5 years ago

But I get 'Invalid link headers for target URL' for the Inbox link. And 'Invalid topic or hub URL' for the Subscribe button.

The Concepts from the Hochschulfaecher Systematik are currently linking to the hub and inboxes of test.skohub.io:

curl -iL https://w3id.org/class/hochschulfaecher/F17
...
Link: <https://test.skohub.io/inbox?target=http://w3id.org/class/hochschulfaecher/F17#>; rel="http://www.w3.org/ns/ldp#inbox", <https://test.skohub.io/hub>; rel="hub", <http://w3id.org/class/hochschulfaecher/F17#>; rel="self"
...

So basically your local hub tries to validate the requests and rightly identifies that it is not being pointed at. This is expected behavior. I know this can be quite mind bending to grasp, it at least is for me. Perhaps @acka47 can elaborate over a coffee locally in Cologne.

dr0i commented 5 years ago

As we agreed that it's sufficient to have one approved review, I am an unassigning me. So, this is ready to be merged then.

dr0i commented 5 years ago

Ah, @literarymachine merged it already :)