w3c / odrl

ODRL Community Group Repository
https://www.w3.org/community/odrl/
Other
18 stars 9 forks source link

JSON-LD context incorrectly maps odrl:uid to @id #30

Open matthieubosquet opened 1 year ago

matthieubosquet commented 1 year ago

The JSON-LD context "https://www.w3.org/ns/odrl.jsonld" used in all examples (eg. 5) incorrectly maps what one would assume as being the odrl:uid property to JSON-LD's @id syntax keyword.

Screenshot 2022-11-10 at 19 03 43

Which results in the following:

It would be good if the context was ammended to reflect the ODRL vocabulary. I would be happy to submit a PR.

See also: https://github.com/w3c/odrl/issues/26

vroddon commented 1 year ago

Thanks for the observation Matthieu. Perhaps I have missed your point, because I do not see the context file should behave otherwise. In the one hand, not having coupled uid and @id may have as a consequence integrity problems -two identifiers. In the other hand, the context file implements the spec:

"A Policy MUST have one uid property value (of type IRI [rfc3987]) to identify the Policy."

What would be the point of having two different identifiers? Thanks again for your comment

matthieubosquet commented 1 year ago

The ODRL vocabulary defines the odrl:uid property as a way to link instances of Asset, Constraint, LogicalConstraint, Party, Policy and Rule to a unique identifier.

When using that property, I can write an RDF graph of the form:

prefix odrl: <http://www.w3.org/ns/odrl/2/>
prefix ex: <http://example.org/>

[] odrl:uid ex:p1 .

Or even make the odrl:uid property self-referencing:

prefix odrl: <http://www.w3.org/ns/odrl/2/>
prefix ex: <http://example.org/>

ex:p1 odrl:uid ex:p1 .

Stating that something has a unique identifier is different from collapsing uid as the node identifier.

Going back to the example in my description of the issue, let's consider the following RDF graphs:

  1. [] a odrl:Policy ; odrl:uid ex:p1 . is made up of two statement: [] is an odrl:Policy and [] has a unique identifier ex:p1.
  2. ex:p1 a odrl:Policy is made up of one statement: ex:p1 is an odrl:Policy.

The first and second RDF graphs are not equivalent, which matters when implementing an ODRL processor.

Why does it matter?

Let's consider for example a program performing shape validation of ODRL graphs. Such a program would implement checks for every requirement of the ODRL spec, among which:

A Policy MUST have one uid property value (of type IRI [rfc3987]) to identify the Policy. — https://www.w3.org/TR/odrl-model/#policy

That requirement of the ODRL spec corresponds to verifying that a Policy has exactly one statement of the form s odrl:uid o (and that the object of that statement is an IRI).

If collapsing uid as the node identifier, this verification (mandated by the spec) will always fail with error A Policy MUST have exactly one odrl:uid.