digitalbazaar / jsonld.js

A JSON-LD Processor and API implementation in JavaScript
https://json-ld.org/
Other
1.66k stars 195 forks source link

@base #425

Open bertvannuffelen opened 3 years ago

bertvannuffelen commented 3 years ago

I do not find in the specification if there is any restriction on @base values, but

{"@version": 1.1,
  "@context": {
  "Persoon": "http://www.w3.org/ns/person#Person",

  "type2" : {
    "@id": "https://example.com/ns/voc#type",
    "@type": "@id",
    "@context": { "@base": "http://www.w3.org/ns/person#"
              }
  }

},
 "@id": "https://example.com/id/pete",
 "@type": "Persoon",

 "type2": "Pers"
}

returns the value "http://www.w3.org/ns/Pers" for type2.

@base resolution thus remove the last thing to the last / while for many ontologies/vocabularies the practice is to use fragment identifiers.

It is this a specification issue? Or is this a implementation issue?

gkellogg commented 3 years ago

Yes, this is correct, and my distiller gets the same result.

"type2" is treated as "@id", and the normal rules apply when resolving "Pers" against "http://www.w3.org/ns/person#"; the "person#" has no special meaning in resolving IRIs.