skohub-io / skohub-editor

Apache License 2.0
5 stars 4 forks source link

Support lookup from vocabs published via GitHub pages #60

Open acka47 opened 3 years ago

acka47 commented 3 years ago
  1. I created https://w3id.org/acka47/subjects/ with redirect using https://github.com/skohub-io/skohub-docker-vocabs
  2. I wrote a JSON schema that includes a lookup to the vocab, see https://github.com/acka47/skohub-example-json-schema
  3. I tried out several viariants of adding the lookup URL, see https://github.com/acka47/skohub-example-json-schema/commits/main

As already discussed, the SkoHub Vocabs published via GitHub Pages does not support content negotiation. I am afraid, there is currently no way to enable the lookup and the SkoHub Editor code has to be adjusted for this.

@sroertgen already adjusted the SkoHub Editor code for WLO to directly look for the json vocab and the FlexSearch index, see https://github.com/openeduhub/oeh-add-content/blob/4a80a03b4ba75b5c1d1e8cd89b8f20ae4b3903e8/frontend/src/components/JSONPointerForm/SkohubLookup.js#L84-L109

Thus, a solution for this problem would be to add this as fallback in the editor when content negotiation fails.

acka47 commented 3 years ago

@sroertgen already adjusted the SkoHub Editor code for WLO to directly look for the json vocab and the FlexSearch index,

Here is a link to the respective commit: https://github.com/openeduhub/oeh-add-content/commit/8fb38475ec0a89e49fc05b280229958552ef2aa2#diff-986dba4e0568e578b474d17b17e9ea00cacbbaf28dbea33d782f45c9393a8f6b

acka47 commented 3 years ago

Actually, the lookup (without typeahead search) works when you provide a valid JSON Schema. (I had a typo in the versions I tested and the editor would somehow load the last valid schema...) So, this is not too important now. With @literarymachine I agreed to add some configuration option like this at a later point:

{
   "_widget":{
      "type":"SkohubLookup",
      "options":{
         "url":"https://acka47.github.io/skohub-example-subjects/w3id.org/acka47/subjects/index.json",
         "index":"https://acka47.github.io/skohub-example-subjects/w3id.org/acka47/subjects/index.index"
      }
   }
}