[poe] JSON-LD serialization of rightOperand values

simonstey has just created a new issue for https://github.com/w3c/poe:

== JSON-LD serialization of rightOperand values ==
**Preliminaries:**
Values of property `odrl:rightOperand` can be literals or IRIs:
> one rightOperand property value of type:
> +  **literal, or IRI** [rfc3987], or RightOperand; or
> + for set-based operators; list of literals, or list of IRIs [rfc3987], or list of RightOperands;

http://www.w3.org/ns/odrl.jsonld :
> `"rightOperand":         "odrl:rightOperand",`

-------------

**Problem:**
By default, all JSON-LD values are interpreted as strings (cf. https://github.com/schemaorg/schemaorg/issues/51) ->

```json
{
    "@context": "http://www.w3.org/ns/odrl.jsonld",
    "@type": "Offer",
    "uid": "http://example.com/policy:88",
    "profile": "http://example.com/odrl:profile:09",
    "permission": [{
        "assigner": "http://example.com/assigner:sony",
        "target": "http://example.com/music/1999.mp3",
        "action": "play",
        "duty": [{
           "action": [{
              "rdf:value": { "@id": "odrl:compensate" },
              "refinement": [{
                 "leftOperand": "payAmount",
                 "operator": "eq",
                 "rightOperand": "5.00",
                 "unit": "http://dbpedia.org/resource/Euro"
              }]
            }],
            "constraint": [{
                "leftOperand": "event",
                "operator": "lt",
                "rightOperand": "policyUsage"
            }]
        }]
    }]
}  
```
--> 
```turtle
<http://example.com/policy:88> a odrl:Offer ;
    odrl:permission [ odrl:action odrl:play ;
            odrl:assigner <http://example.com/assigner:sony> ;
            odrl:duty [ odrl:action [ rdf:value odrl:compensate ;
                            odrl:refinement [ odrl:leftOperand odrl:payAmount ;
                                    odrl:operator odrl:eq ;
                                    odrl:rightOperand "5.00" ;
                                    odrl:unit "http://dbpedia.org/resource/Euro" ] ] ;
                    odrl:constraint [ odrl:leftOperand odrl:event ;
                            odrl:operator odrl:lt ;
                            odrl:rightOperand "policyUsage" ] ] ;
            odrl:target <http://example.com/music/1999.mp3> ] ;
    odrl:profile <http://example.com/odrl:profile:09> .
```

-------------

**Solution:**

>From https://github.com/schemaorg/schemaorg/issues/51#issuecomment-284874600:
> I think in this situation, it seems safest to always stay explicit and always use
> + `{ "@id": "https://foo.example/" }`
> + `{ "@value": "bar" }`
>
> and don't rely on schema.org JSON-LD context having or not having "@type": "@id"


```json
{
 "@context": "http://www.w3.org/ns/odrl.jsonld",
 "@type": "Offer",
 "uid": "http://example.com/policy:88",
 "profile": "http://example.com/odrl:profile:09",
 "permission": [{
  "assigner": "http://example.com/assigner:sony",
  "target": "http://example.com/music/1999.mp3",
  "action": "play",
  "duty": [{
   "action": [{
    "rdf:value": {
     "@id": "odrl:compensate"
    },
    "refinement": [{
     "leftOperand": "payAmount",
     "operator": "eq",
     "rightOperand": {
      "@value": "5.00",
      "@type": "xsd:decimal"
     },
     "unit": "http://dbpedia.org/resource/Euro"
    }]
   }],
   "constraint": [{
    "leftOperand": "event",
    "operator": "lt",
    "rightOperand": {
     "@id": "odrl:policyUsage"
    }
   }]
  }]
 }]
}
```
--> 
```turtle
<http://example.com/policy:88> a odrl:Offer ;
    odrl:permission [ odrl:action odrl:play ;
            odrl:assigner <http://example.com/assigner:sony> ;
            odrl:duty [ odrl:action [ rdf:value odrl:compensate ;
                            odrl:refinement [ odrl:leftOperand odrl:payAmount ;
                                    odrl:operator odrl:eq ;
                                    odrl:rightOperand 5.00 ;
                                    odrl:unit "http://dbpedia.org/resource/Euro" ] ] ;
                    odrl:constraint [ odrl:leftOperand odrl:event ;
                            odrl:operator odrl:lt ;
                            odrl:rightOperand odrl:policyUsage ] ] ;
            odrl:target <http://example.com/music/1999.mp3> ] ;
    odrl:profile <http://example.com/odrl:profile:09> .
```

Please view or discuss this issue at https://github.com/w3c/poe/issues/279 using your GitHub account

Received on Friday, 13 October 2017 07:58:40 UTC