Skip to content

Add example on order impact on @protected #2

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

Closed
rubensworks opened this issue Mar 29, 2019 · 8 comments · Fixed by #27
Closed

Add example on order impact on @protected #2

rubensworks opened this issue Mar 29, 2019 · 8 comments · Fixed by #27

Comments

@rubensworks
Copy link
Member

Following the discussion in w3c/json-ld-syntax#153, it would be good to add an example to the BP document of non-trivial @protected usage that does not throw an error.

The following (error-throwing) example is present in the syntax spec:

{
  "@context": [
    {
      "@version": 1.1,
      "Person": "http://schema.org/Person",
      "knows": "http://schema.org/knows",
      "name": {
        "@id": "http://schema.org/name",
        "@protected": true
      }
    },
    {
      "name": "this_attempt_to_override_name_will_fail"
    }
  ]
}

The following would be relevant to add as an example that does not throw an error, even though there is a term override happening:

{
  "@context": [
    {
      "name": "this_attempt_to_override_name_will_fail"
    },
    {
      "@version": 1.1,
      "Person": "http://schema.org/Person",
      "knows": "http://schema.org/knows",
      "name": {
        "@id": "http://schema.org/name",
        "@protected": true
      }
    }
  ]
}
@BigBlueHat
Copy link
Member

Isn't this just the normal inheritance/overriding pattern then? Also, if the first "name" actually does get overridden (in your second example) it's value should change. 😃

@rubensworks
Copy link
Member Author

Isn't this just the normal inheritance/overriding pattern then?

Yes, you're right.

The only reason for adding this example would be to clarify that @protected can –next to creating a brand new protected term– also be used while redefining an (unprotected) term.

This was an open question for me after reading the section on @protected in the spec, so it's possible that other people may have the same question.

@pchampin
Copy link
Contributor

so it's possible that other people may have the same question.

granted. But on the other hand, I'm concerned that too many examples would be counter productive, making the spec harder to read...

@gkellogg
Copy link
Member

Usually, test cases serve to flesh out corner cases; although not visible in the spec, they do serve a good purpose for describing such behavior.

@iherman
Copy link
Member

iherman commented Dec 11, 2019

There may be one reason why this should be put into the BP document: the text does emphasize in §3.4 JSON array should assume that values in an array should be assumed as unordered. However, the value of @context is different: order of contexts does count, and this is a good (albeit possibly a bit complex) example.

@ajs6f
Copy link
Member

ajs6f commented Dec 16, 2019

It shouldn't be too hard to develop an isolated example showing two simple contexts interact that way. I think it's a very good idea to show it, and not just tell people about it in the spec.

@ajs6f
Copy link
Member

ajs6f commented Feb 7, 2020

Is the desire here to feature an example with two contexts (as per @rubensworks' example above) that do and don't successfully override a definition, based on the ordering question? Is @rubensworks' example (perhaps with a different vocabulary) meet for that purpose immediately?

@iherman
Copy link
Member

iherman commented Feb 7, 2020

This issue was discussed in a meeting.

  • No actions or resolutions
View the transcript issue on protected
Benjamin Young: #2
Ruben Taelman: this issue was created to clarify that for protection of terms that order is important
… in the first snippet, the overriding of the term would result in a failure, but if you reverse the contexts, the failure doesn’t happen
… so clarify order is important
Benjamin Young: where you introduce the protection has an effect
… protected in the middle of the list is different from at the end
… anyone want to help on this?
… dlehn did you work on this?
… Or was it more dlongley?
David I. Lehn: I’d have to take a look. Partly involved but not core.
Ruben Taelman: I can also help
Benjamin Young: that woudl be super. I can assign to you for now
… thank you very much
… streaming got some love, so lets look at #13

rubensworks added a commit to rubensworks/json-ld-bp that referenced this issue Feb 14, 2020
@ajs6f ajs6f closed this as completed in #27 Feb 20, 2020
@rubensworks rubensworks removed their assignment Mar 17, 2020
@pchampin pchampin moved this to Non TR Work in JSON-LD Management May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

7 participants