poe icon indicating copy to clipboard operation
poe copied to clipboard

odrl:unit is define in the https://www.w3.org/ns/odrl.jsonld as a literal value

Open phochste opened this issue 5 months ago • 3 comments

Is there any reason why odrl:unit is mapped to a literal value?

E.g.

{
    "@context": "http://www.w3.org/ns/odrl.jsonld",
    "@type": "Offer",
    "uid": "http://example.com/policy:6161",
    "profile": "http://example.com/odrl:profile:10",
    "permission": [{
       "target": "http://example.com/document:1234",
       "assigner": "http://example.com/org:616",
       "action": [{
          "rdf:value": { "@id": "odrl:print" },
          "refinement": [{
             "leftOperand": "resolution",
             "operator": "lteq",
             "rightOperand": { "@value": "1200", "@type": "xsd:integer" },
             "unit": "http://dbpedia.org/resource/Dots_per_inch"
          }]
      }]
   }]
}

is in RDF triple format following the JSON-LD context:

<http://example.com/policy:6161> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/ns/odrl/2/Offer> .
<http://example.com/policy:6161> <http://www.w3.org/ns/odrl/2/permission> _:b0 .
<http://example.com/policy:6161> <http://www.w3.org/ns/odrl/2/profile> <http://example.com/odrl:profile:10> .
_:b0 <http://www.w3.org/ns/odrl/2/action> _:b1 .
_:b0 <http://www.w3.org/ns/odrl/2/assigner> <http://example.com/org:616> .
_:b0 <http://www.w3.org/ns/odrl/2/target> <http://example.com/document:1234> .
_:b1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#value> <http://www.w3.org/ns/odrl/2/print> .
_:b1 <http://www.w3.org/ns/odrl/2/refinement> _:b2 .
_:b2 <http://www.w3.org/ns/odrl/2/leftOperand> <http://www.w3.org/ns/odrl/2/resolution> .
_:b2 <http://www.w3.org/ns/odrl/2/operator> <http://www.w3.org/ns/odrl/2/lteq> .
_:b2 <http://www.w3.org/ns/odrl/2/rightOperand> "1200"^^<http://www.w3.org/2001/XMLSchema#integer> .
_:b2 <http://www.w3.org/ns/odrl/2/unit> "http://dbpedia.org/resource/Dots_per_inch" .

Notice the literal translation of the odrl:unit object value.

The examples in the spec suggests that odrl:unit is a URI while it is not at such defined in the JSON-LD context document.

phochste avatar Jul 31 '25 10:07 phochste

Sounds like an error in the JSON-lD context

Should it be: "unit": {"@type": "xsd:anyType", "@id": "odrl:unit"},

riannella avatar Aug 01 '25 01:08 riannella

With:

"unit":             {"@type": "xsd:anyType", "@id": "odrl:unit"},

the translation becomes:

_:b2 <http://www.w3.org/ns/odrl/2/unit> "http://dbpedia.org/resource/Dots_per_inch"^^<http://www.w3.org/2001/XMLSchema#anyType> .

Shouldn't it be:

"unit": { "@id": "odrl:unit" , "@type": "@id"},

to get as result:

_:b2 <http://www.w3.org/ns/odrl/2/unit> <http://dbpedia.org/resource/Dots_per_inch> .

Or , if this is not the intention of the spec ( both literal or URI values are valid), the examples in the spec could indicate that some value should indeed be interpreted as an URI :

{
    "@context": "http://www.w3.org/ns/odrl.jsonld",
    "@type": "Offer",
    "uid": "http://example.com/policy:6161",
    "profile": "http://example.com/odrl:profile:10",
    "permission": [{
       "target": "http://example.com/document:1234",
       "assigner": "http://example.com/org:616",
       "action": [{
          "rdf:value": { "@id": "odrl:print" },
          "refinement": [{
             "leftOperand": "resolution",
             "operator": "lteq",
             "rightOperand": { "@value": "1200", "@type": "xsd:integer" },
            "unit": { "@id": "http://dbpedia.org/resource/Dots_per_inch" }
          }]
      }]
   }]
}

phochste avatar Aug 01 '25 05:08 phochste

Unit is an IRI so your proposal is good (my JSON is bad!)

riannella avatar Aug 01 '25 05:08 riannella