Skip to content

scoped context does not work for aliases of @type #651

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

Open
pchampin opened this issue Apr 10, 2025 · 1 comment
Open

scoped context does not work for aliases of @type #651

pchampin opened this issue Apr 10, 2025 · 1 comment

Comments

@pchampin
Copy link
Contributor

Sometimes, it makes sense to have a JSON property be an alias of @type/rdf:type, and interpret the value in a particular vocabulary. E.g.

{
  "@context": {
    "@base": "https://example.org/ont/",
    "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
    "owl-type": {
      "@id": "@type",
      "@type": "@vocab",
      "@context": {
        "@vocab": "http://www.w3.org/2002/07/owl#"
      }
    }
  },
  "@id": "myProp",
  "owl-type": "ObjectProperty"
}

to generate the following triple

<https://example.org/ont/myProp> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#ObjectProperty>.

Unfortunately, it does not work, and generates instead (the object is different):

<https://example.org/ont/myProp> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <https://example.org/ont/ObjectProperty>.

I get the result above in the [playground], and with all the implementations I have tested (Rust, Ruby, Jena, PyLD), so although I didn't check the algorithm yet, I assume this is a compliant behevior, but I find it both annoying and counter-intuitive. The reason I find it counter-intuitive is that "regular" properties (as opposed to an alias of @type) work as expected. For example, if you replace "@id": "@type" with "@id": "rdf:type" in line 6 of the example above, you get the expected result (again, in all tested implementations).

Should this be considered as a spec bug?

@pchampin
Copy link
Contributor Author

pchampin commented May 8, 2025

This was discussed during the json-ld meeting on 07 May 2025.

View the transcript

w3c/json-ld-api#651

<gb> Issue 651 scoped context does not work for aliases of `@type` (by pchampin) [class-3]

gkellogg: pchampin you raised this one?

pchampin: yeah...I found this counter intuitive, but having the intuitive change would require serious changes

gkellogg: k. I moved it to future work
… looks like we're out of time this week
… we'll work to get the WG and CG calls in sync again
… and see if we can get the folks from https://agent-network-protocol.com/ to join us for a call
… thanks all, good bye


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Future Work
Development

No branches or pull requests

2 participants