poe icon indicating copy to clipboard operation
poe copied to clipboard

Absent UID attribute for permission/prohibition in XML

Open mielvds opened this issue 6 months ago • 5 comments

Hello,

I was wondering why the <o:permission> and <o:prohibition> do not allow a uid attribute? This prevents you from round-tripping between RDF (where they may have a URI) and XML, because it will either dismiss or recreate a URI or blank node. Or is there some other way to do this? id and idref are allowed, but do not allow URIs. The spec mentions that the Rule class MAY have uid: https://www.w3.org/TR/odrl-model/#rule We tend to maintain pre-made definitions of rules in our knowledge graph and refer to them from elsewhere like XML.

Cheers,

Miel

mielvds avatar Jul 01 '25 12:07 mielvds

Hi Meil, because a Permission "is a" Rule, then it can have the uid property.

As you can see in Example 2 here: https://www.w3.org/TR/odrl-vocab/#xml you then need to locally manage the id/idrefs in XML

riannella avatar Jul 02 '25 03:07 riannella

Hi @riannella , not sure I understand your answer. The XML section only mentions the following elements about the Permission and Prohibition class; there's nothing about attributes.

The Permission element contains the following elements:

    asset (REQUIRED)
    action (REQUIRED)
    constraint
    party
    duty

The Prohibition element contains the following elements:

    asset (REQUIRED)
    action (REQUIRED)
    constraint
    party
    remedy

The XSD also does not allow any attributes except id and idref, despite them not being mentioned in the spec. The absence of uid is inconsistent with both the Rule concept and RDF/JSON-LD, where you are allowed to add uid.

From the spec:

  • A Rule MAY have none or one uid property values (of type IRI [rfc3987]) to identify the Rule so it MAY be referenced by other Rules.

I didn't find any examples in the documents, but this would be allowed in JSON-LD:

{
   "@context": "http://www.w3.org/ns/odrl.jsonld",
   "@type": "Offer",
   "uid": "http://example.com/policy:9090",
   "profile": "http://example.com/odrl:profile:07",
   "permission": [{
       "uid": "http://example.com/rule:0001";
       "target": "http://example.com/game:9090",
       "assigner": "http://example.com/org:xyz",
       "action": "play",
       "constraint": [{
           "leftOperand": "dateTime",
           "operator": "lteq",
           "rightOperand": { "@value": "2017-12-31", "@type": "xsd:date" }
       }]
   }]
}

mielvds avatar Jul 02 '25 08:07 mielvds

The model says it allowed, but the XML Schema has omitted it.

I think we need to add: <xs:attribute name="uid" type="xs:anyURI "/>

to

<xs:attributeGroup name="idAttributes">
   <xs:attribute name="id" type="xs:ID"/>
   <xs:attribute name="idref" type="xs:IDREF"/>
   <xs:anyAttribute namespace="##other" processContents="lax"/>
</xs:attributeGroup>

Would that do it?

riannella avatar Jul 03 '25 04:07 riannella

yes that would do it!

mielvds avatar Jul 03 '25 06:07 mielvds

Moving to Errata to fix XML Schema

riannella avatar Jul 04 '25 01:07 riannella