Skip to toolbar

Community & Business Groups

ODRL Version 2.0 XML Encoding

Final Specification: 24 April 2012

This Version: http://www.w3.org/community/odrl/xml/2.0/

Latest Version: http://www.w3.org/community/odrl/xml/2/

Editors:
Renato Iannella, Semantic Identity, riATsemanticidentity.com

Status of this document

This specification was published by the W3C ODRL Community Group. It is not a W3C Standard nor is it on the W3C Standards Track. Please note that under the W3C Community Contributor License Agreement (CLA) there is a limited opt-out and other conditions apply. Learn more about W3C Community and Business Groups.

The W3C ODRL Community Group publishes a Final Specification to indicate that the document is believed to be mature and stable for implementation by the wider community. This Final Specification is now endorsed by the W3C ODRL Community Group as appropriate for widespread deployment and that promotes the Community Groups’s mission.

Discussion and feedback of this document takes place on the W3C ODRL Community Group mailing list (see Contributor Archive). Feedback from the public is encouraged and can be send to public-odrl@w3.org (see Public Archive).


Copyright © 2012 the Contributors to the Final Specification, published by the W3C ODRL Community Group under the W3C Community Final Specification Agreement (FSA). A human-readable summary is available.

Table of contents


1. Overview

The ODRL Version 2.0 language is defined by the ODRL Model [ODRL-MODEL] and ODRL Common Vocabulary [ODRL-VOCAB] in an abstract manner to capture the semantics of the expression, without any specific syntax and/or encoding method.

This document describes how to encode both the Model and Common Vocabulary, including any community developed Profiles, using the XML syntax [XML] with XML Schema [XML-SCHEMA] and XML Schema Datatypes [XML-SCHEMA-DT]

This document utlilises the key words “MUST”, “MAY”, “REQUIRED”, and “OPTIONAL” in accordance to [RFC2119]. Lowercase wording is used in this document.

2. Namespace and Identifiers

The XML Namespace [XML-NAME] for the ODRL Version 2.0 Core Model semantics id defined as:

   http://w3.org/ns/odrl/2/

This Namespace URI must be used to uniquely identify ODRL Version 2.0 core model elements.

Examples in this document will use “o” as the prefix for this Namespace. However, any prefix may be utilised as long as it is associated with the correct URI Namespace.

To enable compact URIs, this encoding also supports the use of Qualified Names (QNames) [XML-NAME] for the specification of the value identifiers. In addition, Qualified Codes [Q-CODE] may also be used for vocabulary values. QCodes are similar to QNames but also allow numeric values as the first characters of the value.

3. XML Encoding

Each of the core entities (UML Classes) from the ODRL Model will be represented by an XML element of the same name. Additionally, each entity attribute will be represented as an XML attribute of the parent element. The fixed values defined in the Model are represented as enumerated types. Cardinalities are also represented with XML Schema occurrence rules.

The Policy element contains the following attributes:

  • uid – a URI/Qname/Qcode (required)
  • type – a URI/Qname/Qcode (required)
  • conflict – fixed enumeration (defined in XML Schema)
  • undefined – fixed enumeration (defined in XML Schema)
  • inheritAllowed – a boolean
  • inheritFrom – a URI/Qname/Qcode
  • inheritRelation – a URI/Qname/Qcode

The Policy element contains the following elements:

  • permission – (required)
  • prohibition

The Asset and Relation association class are merged into a single Asset element to represent both the Asset and how it is related to the Permission/Prohibition/Duty. The Asset element contains the following attributes:

  • uid – a URI/Qname/Qcode
  • relation – a URI/Qname/Qcode
  • id – an local identifier for this element
  • idref – a reference to an Asset element

The cardinality of the Asset element attributes MUST be either:

  1. uid (required), relation (required), id (optional)
  2. idref (required)

The Party and Role association class are merged into a single Party element to represent both the Party and the role to the Permission/Prohibition/Duty. The Party element contains the following attributes:

  • uid – a URI/Qname/Qcode
  • function – a URI/Qname/Qcode
  • scope – a URI/Qname/Qcode
  • id – an local identifier for this element
  • idref – a reference to a Party element

The cardinality of the Party element attributes MUST be either:

  1. uid (required), function (required), scope (optional), id (optional)
  2. idref (required)

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

The Duty element contains the following elements:

  • action – (required)
  • constraint
  • asset
  • party

The Duty element contains the following attributes:

  • uid – a URI/Qname/Qcode
  • id – an local identifier for this element
  • idref – a reference to an Duty element

The cardinality of the Duty element attributes MUST be either:

  1. uid (optional)
  2. id (required)
  3. idref (required)

The Action element contains the following attribute:

  • name – a URI/Qname/Qcode
  • id – an local identifier for this element
  • idref – a reference to an Action element

The cardinality of the Action element attributes MUST be either:

  1. name (required), id (optional)
  2. idref (required)

The Constraint element contains the following attributes:

  • name – a URI/Qname/Qcode
  • operator – a URI/Qname/Qcode
  • rightOperand – string, space separated list for set values
  • status – string
  • id – an local identifier for this element
  • idref – a reference to an Constraint element

The cardinality of the Constraint element attributes MUST be either:

  1. name (required), operator (required), rightOperand (required), status (optional), id (optional)
  2. idref (required)

In some cases where Duties refer to (external) Assets, it will be necessary to package the ODRL XML expression with the representation of that (external) Asset. This XML Encoding specification does not mandate any specific packaging mechanism as communities will utilise their preferred options for data interoperability.

The examples in Section 5 give concrete instances of these XML encoding rules for the Model and Common Vocabulary. Appendix A shows the formal XML Schema that encapsulates these rules.

4. XML Linking

4.1 XML Elements

To support repeating the same element content across Permissions and Prohibitions, the Asset, Party, Constraint, Action, and Duty elements support the id and idref attributes. Any of these element that has been identified using the id attribute can then be referred to by an element with the same name using the idref attribute. In this case, the referring element must have no other content. As shown in the below example, the Prohibition refers to elements defined in the Permission, except for the Constraint element. In this case, the assignee can play the music asset in Italy but not in France.

<o:permission>
    <o:asset id="as1" uid="http://example.com/music:1234908" relation="http://w3.org/ns/odrl/vocab#target"/>
    <o:action id="ac1" name="http://w3.org/ns/odrl/vocab#play"/>
    <o:constraint name="http://w3.org/ns/odrl/vocab#spatial" operator="http://w3.org/ns/odrl/vocab#eq" rightOperand="http://www.itu.int/tML/tML-ISO-3166:it"/>
    <o:party id="p1" uid="http://example.com/sony:10" function="http://w3.org/ns/odrl/vocab#assigner"/>
    <o:party id= "p2" uid="http://example.com/billie:888" function="http://w3.org/ns/odrl/vocab#assignee"/>
</o:permission>
<o:prohibition>
    <o:asset idref="as1"/>
    <o:action idref="ac1"/>
    <o:constraint  name="http://w3.org/ns/odrl/vocab#spatial" operator="http://w3.org/ns/odrl/vocab#eq" rightOperand="http://www.itu.int/tML/tML-ISO-3166:fr"/>
    <o:party idref="p1"/>
    <o:party idref="p2"/>
</o:prohibition>

Note that there is an important distinction when using this feature with the Duty element which also has the uid attribute. The uid attribute is used to refer to the same Duty from multiple Permissions. In this case the Duty has to be performed only once to gain access to all the Permissions. When using the id and idref attributes then the semantics change as in this case the Duty must be performed for each time it is referenced (potentially, many times). Note that the use of the uid and id attribute for the same Duty element is not permitted.

4.2 Inline Assets

In some scenarios, the Asset of an ODRL Policy maybe also be XML or HTML markup. In these specific cases, it makes sense to enable the ODRL Policy to be articulated as part of the Asset and to support abbreviated expressions. All default values should be assumed. The typical scenario would require either a Permission or a Prohibition element to be linked to the XML/HTML markup. The preferred method of linking is to utilise the XML ID attribute. The source Asset markup may be identified with an ID attribute and the ODRL Asset element can then refer to this ID as the UID (as a URI hash fragment). An example is shown below.

<rnews:Article xml:id="item8HEX">
    <rnews:title>Allies are Split<rnews:title>
    <rnews:description>Rebel fighters take control...<rnews:description>
    ...
    <o:permission>
        <o:asset uid="#item8HEX"/>
        <o:action name="http://w3.org/ns/odrl/vocab#distribute"/>
        <o:constraint name="http://w3.org/ns/odrl/vocab#dateTime" operator="http://w3.org/ns/odrl/vocab#gteq" rightOperand="2011-11-11"/>
    </o:prohibition>  
</rnews:Article>

5. Scenario Examples

These examples represent the XML Encodings for all the Scenarios described in the [ODRL-Model] document.

4.1 Set

<o:policy xmlns:o="http://w3.org/ns/odrl/2/" type="http://w3.org/ns/odrl/vocab#set" uid="http://example.com/policy:0099">
    <o:permission>
        <o:asset uid="http://example.com/asset:9898" relation="http://w3.org/ns/odrl/vocab#target"/>
        <o:action name="http://w3.org/ns/odrl/vocab#publish"/>
    </o:permission>
    <o:prohibition>
        <o:asset uid="http://example.com/asset:9898" relation="http://w3.org/ns/odrl/vocab#target"/>
        <o:action name="http://w3.org/ns/odrl/vocab#modify"/>
    </o:prohibition>  
</o:policy>

4.2 Offer

<o:policy xmlns:o="http://w3.org/ns/odrl/2/" type="http://w3.org/ns/odrl/vocab#offer" uid="http://example.com/policy:0231">
    <o:permission>
        <o:asset uid="http://example.com/music:4545" relation="http://w3.org/ns/odrl/vocab#target"/>
        <o:action name="http://w3.org/ns/odrl/vocab#play"/>
        <o:party uid="http://example.com/sony:10" function="http://w3.org/ns/odrl/vocab#assigner"/>
        <o:duty uid="d1">
            <o:action name="http://w3.org/ns/odrl/vocab#pay"/>
            <o:asset uid="http://example.com/ubl:AUD0.50" relation="http://w3.org/ns/odrl/vocab#target"/>
        </o:duty>
    </o:permission>
    <o:permission>
        <o:asset uid="http://example.com/music:4545" relation="http://w3.org/ns/odrl/vocab#target"/>
        <o:action name="http://w3.org/ns/odrl/vocab#copy"/>
        <o:constraint name="http://w3.org/ns/odrl/vocab#numberOfUses" operator="http://w3.org/ns/odrl/vocab#lteq" rightOperand="1"/>
        <o:party uid="http://example.com/sony:10" function="http://w3.org/ns/odrl/vocab#assigner"/>
        <o:duty uid="#d1"/>
    </o:permission>  
</o:policy>
 
<!-- External Asset -->
<ubl:PriceAmount xml:id="http://example.com/ubl:AUD0.50"
    xmlns:ubl="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
    currencyID="AUD">0.50</ubl:PriceAmount>
<!-- External Asset -->

4.3 Agreement

<o:policy xmlns:o="http://w3.org/ns/odrl/2/" type="http://w3.org/ns/odrl/vocab#agreement" uid="http://example.com/policy:9001">
    <o:permission>
        <o:asset uid="http://example.com/music:4545" relation="http://w3.org/ns/odrl/vocab#target"/>
        <o:action name="http://w3.org/ns/odrl/vocab#play"/>
        <o:party uid="http://example.com/sony:10" function="http://w3.org/ns/odrl/vocab#assigner"/>
        <o:party uid="http://example.com/billie:888" function="http://w3.org/ns/odrl/vocab#assignee"/>
        <o:duty uid="d1">
            <o:action name="http://w3.org/ns/odrl/vocab#pay"/>
            <o:asset uid="http://example.com/ubl:AUD0.50" relation="http://w3.org/ns/odrl/vocab#target"/>
        </o:duty>
    </o:permission>
    <o:permission>
        <o:asset uid="http://example.com/music:4545" relation="http://w3.org/ns/odrl/vocab#target"/>
        <o:action name="http://w3.org/ns/odrl/vocab#copy"/>
        <o:constraint name="http://w3.org/ns/odrl/vocab#numberOfUses" operator="http://w3.org/ns/odrl/vocab#lteq" rightOperand="1"/>
        <o:party uid="http://example.com/sony:10" function="http://w3.org/ns/odrl/vocab#assigner"/>
        <o:party uid="http://example.com/billie:888" function="http://w3.org/ns/odrl/vocab#assignee"/>
        <o:duty uid="#d1"/>
    </o:permission>  
</o:policy>
 
<!-- External Asset -->
<ubl:PriceAmount xml:id="http://example.com/ubl:AUD0.50"
    xmlns:ubl="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
    currencyID="AUD">0.50</ubl:PriceAmount>
<!-- External Asset -->

4.4 Request

<o:policy xmlns:o="http://w3.org/ns/odrl/2/" type="http://w3.org/ns/odrl/vocab#request" uid="http://example.com/policy:04311">
    <o:permission>
        <o:asset uid="http://example.com/news:0099" relation="http://w3.org/ns/odrl/vocab#target"/>
        <o:action name="http://w3.org/ns/odrl/vocab#display"/>
        <o:party uid="http://example.com/guest:0589" function="http://w3.org/ns/odrl/vocab#assignee"/>
    </o:permission>
</o:policy>

4.5 Ticket

<o:policy xmlns:o="http://w3.org/ns/odrl/2/" type="http://w3.org/ns/odrl/vocab#ticket" uid="http://example.com/policy:04311">
    <o:permission>
        <o:asset uid="http://example.com/game:4589" relation="http://w3.org/ns/odrl/vocab#target"/>
        <o:action name="http://w3.org/ns/odrl/vocab#play"/>
        <o:constraint name="http://w3.org/ns/odrl/vocab#currentDate" operator="http://w3.org/ns/odrl/vocab#lteq" rightOperand="2010-12-31"/>
    </o:permission>
</o:policy>

4.6 Offer and Next Policy

<o:policy xmlns:o="http://w3.org/ns/odrl/2/" type="http://w3.org/ns/odrl/vocab#offer" uid="http://example.com/policy:5531">
    <o:permission>
        <o:asset uid="http://example.com/wallpaper:2321" relation="http://w3.org/ns/odrl/vocab#target"/>
        <o:action name="http://w3.org/ns/odrl/vocab#distribute"/>
        <o:constraint name="http://w3.org/ns/odrl/vocab#spatial" operator="http://w3.org/ns/odrl/vocab#eq" rightOperand="http://www.itu.int/tML/tML-ISO-3166:it"/>
        <o:party uid="http://example.com/sony:99" function="http://w3.org/ns/odrl/vocab#assigner"/>
        <o:duty uid="d1">
            <o:action name="http://w3.org/ns/odrl/vocab#pay"/>
            <o:asset uid="http://example.com/ubl:EU1000.00" relation="http://w3.org/ns/odrl/vocab#target"/>
        </o:duty>
        <o:duty uid="d2">
            <o:action name="http://w3.org/ns/odrl/vocab#nextPolicy"/>
            <o:asset uid="http://example.com/policy:7777" relation="http://w3.org/ns/odrl/vocab#target"/>
        </o:duty>
    </o:permission>
</o:policy>
 
<o:policy xmlns:o="http://w3.org/ns/odrl/2/" type="http://w3.org/ns/odrl/vocab#set" uid="http://example.com/policy:7777">
    <o:permission>
        <o:asset uid="http://example.com/wallpaper:2321" relation="http://w3.org/ns/odrl/vocab#target"/>
        <o:action name="http://w3.org/ns/odrl/vocab#display"/>
    </o:permission>
</o:policy>
 
<!-- External Asset -->
<ubl:PriceAmount xml:id="http://example.com/ubl:EU1000.00"
    xmlns:ubl="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
    currencyID="EUR">1000.00</ubl:PriceAmount>
<!-- External Asset -->

4.7 Privacy

<o:policy xmlns:o="http://w3.org/ns/odrl/2/" type="http://w3.org/ns/odrl/vocab#privacy" uid="http://example.com/policy:1111">
    <o:permission>
        <o:asset uid="http://example.com/billie:888:personal-data" relation="http://w3.org/ns/odrl/vocab#target"/>
        <o:action name="http://w3.org/ns/odrl/vocab#distribute"/>
        <o:constraint name="http://w3.org/ns/odrl/vocab#purpose" operator="http://w3.org/ns/odrl/vocab#eq" rightOperand="http://www.w3.org/2002/01/P3Pv1:contact"/>
        <o:party uid="http://example.com/billie:888" function="http://w3.org/ns/odrl/vocab#assigner"/>
        <o:party uid="http://example.com/gov:health:au" function="http://w3.org/ns/odrl/vocab#assignee"/>
        <o:duty>
            <o:action name="http://w3.org/ns/odrl/vocab#delete"/>
            <o:asset uid="http://example.com/billie:888:personal-data" relation="http://w3.org/ns/odrl/vocab#target"/>
            <o:constraint name="http://w3.org/ns/odrl/vocab#dateTime" operator="http://w3.org/ns/odrl/vocab#eq" rightOperand="P30D"/>
        </o:duty>
    </o:permission>
</o:policy>

4.8 Permission and Prohibition

<o:policy xmlns:o="http://w3.org/ns/odrl/2/" type="http://w3.org/ns/odrl/vocab#agreement" uid="http://example.com/policy:3433" conflict="perm">
    <o:permission>
        <o:asset uid="http://example.com/music:1234908" relation="http://w3.org/ns/odrl/vocab#target"/>
        <o:action name="http://w3.org/ns/odrl/vocab#play"/>
        <o:party uid="http://example.com/sony:10" function="http://w3.org/ns/odrl/vocab#assigner"/>
        <o:party uid="http://example.com/billie:888" function="http://w3.org/ns/odrl/vocab#assignee"/>
    </o:permission>
    <o:prohibition>
        <o:asset uid="http://example.com/music:1234908" relation="http://w3.org/ns/odrl/vocab#target"/>
        <o:action name="http://oma.org/drm:ringtone"/>
        <o:party uid="http://example.com/sony:10" function="http://w3.org/ns/odrl/vocab#assigner"/>
        <o:party uid="http://example.com/billie:888" function="http://w3.org/ns/odrl/vocab#assignee"/>
    </o:prohibition>
</o:policy>

4.9 Inheritance

<o:policy xmlns:o="http://w3.org/ns/odrl/2/" type="http://w3.org/ns/odrl/vocab#agreement" uid="http://example.com/policy:5531" inheritAllowed="true">
    <o:permission>
        <o:asset uid="http://example.com/report:2321" relation="http://w3.org/ns/odrl/vocab#target"/>
        <o:action name="http://w3.org/ns/odrl/vocab#print"/>
        <o:party uid="http://example.com/pub:88" function="http://w3.org/ns/odrl/vocab#assigner"/>
        <o:party uid="http://example.com/billie:888" function="http://w3.org/ns/odrl/vocab#assignee"/>
    </o:permission>
</o:policy>
 
<o:policy xmlns:o="http://w3.org/ns/odrl/2/" type="http://w3.org/ns/odrl/vocab#agreement" uid="http://example.com/policy:9999" inheritFrom="http://example.com/policy:5531">
    <o:permission>
        <o:asset uid="http://example.com/report:2333" relation="http://w3.org/ns/odrl/vocab#target"/>
        <o:action name="http://w3.org/ns/odrl/vocab#display"/>
        <o:party uid="http://example.com/pub:88" function="http://w3.org/ns/odrl/vocab#assigner"/>
        <o:party uid="http://example.com/class:IT01" function="http://w3.org/ns/odrl/vocab#assignee" scope="http://w3.org/ns/odrl/vocab#group"/>
    </o:permission>
</o:policy>

4.10 Social Network

<o:policy xmlns:o="http://w3.org/ns/odrl/2/" type="http://w3.org/ns/odrl/vocab#agreement" uid="http://example.com/policy:5109">
    <o:permission>
        <o:asset uid="http://example.com/myPlace:billie:photos:football2010" relation="http://w3.org/ns/odrl/vocab#target"/>
        <o:action name="http://w3.org/ns/odrl/vocab#display"/>
        <o:party uid="http://example.com/myPlace:billie" function="http://w3.org/ns/odrl/vocab#assigner"/>
        <o:party uid="http://example.com/myPlace:network:football" function="http://w3.org/ns/odrl/vocab#assignee" scope="http://w3.org/ns/odrl/vocab#group"/>
    </o:permission>
</o:policy>

4.11 Multiple Assets

<o:policy xmlns:o="http://w3.org/ns/odrl/2/" xmlns:x="http:example.com" type="http://w3.org/ns/odrl/vocab#set" uid="http://example.com/policy:881212">
    <o:permission>
        <o:asset uid="http://example.com/archive2010" relation="http://w3.org/ns/odrl/vocab#target"/>
        <o:asset uid="http://example.com/x/dataase" relation="x:collection"/>
        <o:action name="http://w3.org/ns/odrl/vocab#index"/>
    </o:permission>
</o:policy>

6. Other Examples

6.1 W3C Privacy Rulesets

The W3C Privacy Rulesets Editor’s Draft has been developed by the W3C Device APIs and Policy Working Group as a scheme for defining privacy rulesets: bundles of user privacy preferences that can be conveyed together with user data in the context of a web site or application interaction. The document defines three Privacy Elements with a number of attributes, summarised here:

  • Sharing, with attributes to scope the extend of sharing to; internal, affiliates, unrelated-companies, public
  • Secondary Use, with defined purposes; contextual, customization, marketing-or-profiling
  • Retention, with defined periods; no, short (retained for the baseline period of 35 days), long

The following example shows how to represent the Privacy Ruleset “Internal customization/personalization” from the document.

<o:policy xmlns:o="http://w3.org/ns/odrl/2/" type="http://w3.org/ns/odrl/vocab#privacy" uid="http://example.com/policy:2442">
    <o:permission>
        <o:asset uid="http://example.comjane-doe:personal-data" relation="http://w3.org/ns/odrl/vocab#target"/>
        <o:action name="http://w3.org/ns/odrl/vocab#sharing"/>
        <o:constraint name="http://w3.org/ns/odrl/vocab#purpose" operator="http://w3.org/ns/odrl/vocab#eq" rightOperand="http://www.w3.org/2009/dap:internal"/>
        <o:duty uid="d1">
            <o:action name="http://w3.org/ns/odrl/vocab#delete"/>
            <o:constraint name="http://w3.org/ns/odrl/vocab#dateTime" operator="http://w3.org/ns/odrl/vocab#eq" rightOperand="P35D"/>
        </o:duty>
    </o:permission>
    <o:permission>
        <o:asset uid="http://example.com/jane-doe:personal-data" relation="http://w3.org/ns/odrl/vocab#target"/>
        <o:action name="http://w3.org/ns/odrl/vocab#secondaryUse"/>
        <o:constraint name="http://w3.org/ns/odrl/vocab#purpose" operator="http://w3.org/ns/odrl/vocab#eq" rightOperand="http://www.w3.org/2009/dap:customization"/>
        <o:duty uid="#d1"/>
    </o:permission>
</o:policy>

6.2 Open Data Commons

The Open Data Commons provides a number of licenses for the sharing of open databases. One example is the Open Database License (ODbL) v1.0 which enables you to “share, create, and adapt” the database as long as you “attribute, share-a-like, and keep open” the outcomes.

The following example shows how to represent that license in ODRL. Note that the “keep open” option is represented as a distribute Prohibition with “drm-restriction” constraint. Also, since Open Data Commons are “instant” licenses, no assignee is indicated, but assumed to be the recipient of the database asset.

<o:policy xmlns:o="http://w3.org/ns/odrl/2/" type="http://w3.org/ns/odrl/vocab#agreement" uid="http://example.com/policy:0101Z">
    <o:permission>
        <o:asset uid="http://example.com/gov.au:database:environment" relation="http://w3.org/ns/odrl/vocab#target"/>
        <o:action name="http://w3.org/ns/odrl/vocab#share"/>
        <o:party uid="http://example.com/gov.au:env-dept" function="http://w3.org/ns/odrl/vocab#assigner"/>
        <o:duty uid="d1">
            <o:action name="http://w3.org/ns/odrl/vocab#attribute"/>
        </o:duty>
        <o:duty uid="d2">
            <o:action name="http://w3.org/ns/odrl/vocab#attachPolicy"/>
        </o:duty>
        <o:duty uid="d3">
            <o:action name="http://w3.org/ns/odrl/vocab#shareAlike"/>
        </o:duty>
    </o:permission>
    <o:permission>
        <o:asset uid="http://example.com/database:environment" relation="http://w3.org/ns/odrl/vocab#target"/>
        <o:action name="http://w3.org/ns/odrl/vocab#derive"/>
        <o:party uid="http://example.com/gov.au:env-dept" function="http://w3.org/ns/odrl/vocab#assigner"/>
        <o:duty uid="#d1"/>
        <o:duty uid="#d2"/>
        <o:duty uid="#d3"/>
    </o:permission>
    <o:permission>
        <o:asset uid="http://example.com/database:environment" relation="http://w3.org/ns/odrl/vocab#target"/>
        <o:action name="http://w3.org/ns/odrl/vocab#transform"/>
        <o:party uid="http://example.com/gov.au:env-dept" function="http://w3.org/ns/odrl/vocab#assigner"/>
        <o:duty uid="#d1"/>
        <o:duty uid="#d2"/>
        <o:duty uid="#d3"/>
    </o:permission>
    <o:prohibition>
        <o:asset uid="http://example.com/database:environment" relation="http://w3.org/ns/odrl/vocab#target"/>
        <o:action name="http://w3.org/ns/odrl/vocab#distribute"/>
        <o:constraint name="http://w3.org/ns/odrl/vocab#system" operator="http://w3.org/ns/odrl/vocab#eq" rightOperand="http://www.opendatacommons.org:drm-restriction"/>
        <o:party uid="http://example.com/gov.au:env-dept" function="http://w3.org/ns/odrl/vocab#assigner"/>
    </o:prohibition>
</o:policy>

6.3 ODRL over XMPP

The Extensible Messaging and Presence Protocol [XMPP-CORE] provides a real-time transport mechanism for structured XML information which may be useful for transporting ODRL information over XMPP. ODRL XML expressions may be sent via the XML message stanza defined in XMPP Core using either of the following:

The message stanza should not have a ‘type’ attribute, but may have any defined type that is appropriate to the communications context. The policy element should be the only child element of the message stanza. The ‘id’ attribute of the message stanza may be set to the value of the ODRL Policy uid.

The following example shows “Scenario 4.4 Request” sent as a direct message from the requester to the asset owner.

<message from="william@shakespeare.biz" to="hamlet@denmark.lit" id="uuid:3932ASDC4192SUAS3281">
     <o:policy xmlns:o="http://w3.org/ns/odrl/2/" type="http://w3.org/ns/odrl/vocab#request" uid="http://example.com/policy:04311">
        <o:permission>
           <o:asset uid="http://example.com/news:0099" relation="http://w3.org/ns/odrl/vocab#target"/>
           <o:action name="http://w3.org/ns/odrl/vocab#display"/>
           <o:party uid="http://example.com/guest:0589" function="http://w3.org/ns/odrl/vocab#assignee"/>
        </o:permission>
    </o:policy>
</message>

The XMPP publish-subscribe protocol provides a way to send information to a number of subscribers.

The following example shows “Scenario 4.5 Ticket” published to a pubsub node sent to all subscribers.

<iq type="set" from="hamlet@denmark.lit" to="pubsub.jabber.org" id="someID">
 <pubsub xmlns="http://jabber.org/protocol/pubsub">
  <publish node="ODRL-TICKETS">
   <item id="uuid:2341SEFS9827WGAS1234">
     <o:policy xmlns:o="http://w3.org/ns/odrl/2" type="http://w3.org/ns/odrl/vocab#ticket" uid="http://example.com/policy:04311">
      <o:permission>
            <o:asset uid="http://example.com/game:4589" relation="http://w3.org/ns/odrl/vocab#target"/>
            <o:action name="http://w3.org/ns/odrl/vocab#play"/>
            <o:constraint name="http://w3.org/ns/odrl/vocab#dateTime" operator="http://w3.org/ns/odrl/vocab#lteq" rightOperand="2010-12-31"/>
        </o:permission>
     </o:policy>
   </item>
  </publish>
 </pubsub>
</iq>

XMPP is used by a number of distributed Social Networks, such as OneSocialWeb. In such cases, the use of an “access-control” language can be addressed with ODRL policy expressions for the fine-grained permissions to profile, activity, and social relationship data.

The example below shows a user’s Birthday attribute (from vCard) allowed to be viewed for friends only (taken from the vCard over XMPP draft document). (See Section 4 on referring to inline Assets.)

<birthday xml:id="bd">
    <datetime>1850-04-06T21:23:00-07:00</datetime>
    <place>Stratford-upon-Avon</place>
    ...
</birthday>
<o:permission>
    <o:asset uid="#bd"/>
    <o:action name="http://w3.org/ns/odrl/vocab#display"/>
    <o:party uid="hamlet@denmark.lit" function="http://w3.org/ns/odrl/vocab#assignee" scope="http://w3.org/ns/odrl/vocab#allConnections" />
</o:permission>

The example below shows a Status Update for everyone to view (taken from the Activity Stream over XMPP draft document).

    
<entry>
    <activity:object xml:id="ao100">
      <activity:object-type>http://onesocialweb.org/spec/1.0/object/status</activity:object-type>
      <content type="text/plain">to be or not to be ?</content>
    </activity:object>
    <o:permission>
       <o:asset uid="#ao100"/>
       <o:action name="http://w3.org/ns/odrl/vocab#display"/>
       <o:party uid="hamlet@denmark.lit" function="http://w3.org/ns/odrl/vocab#assignee" scope="http://w3.org/ns/odrl/vocab#all" />
    </o:permission>
</entry>

Appendix-A. XML Schema (Normative)

The XML Schema for ODRL Version 2.0 is shown below.

To support extensibility and reuse all the elements and their respective datatypes are global. Additionally, the elements have been defined to include xs:any element and xs:anyAttribute attribute from any (non-odrl) namespace. Note that to support the id/idref attributes some of the attributes that would normally be mandatory are now optional. They must be mandatory when not referring to an element using an idref attribute.

<xs:schema xmlns:o="http://w3.org/ns/odrl/2/" xmlns:xs="http://www.w3.org/2001/XMLSchema"
    targetNamespace="http://w3.org/ns/odrl/2/" elementFormDefault="qualified" attributeFormDefault="unqualified">
 
    <xs:element name="policy" type="o:policyCT"/>
    <xs:complexType name="policyCT">
                <xs:sequence minOccurs="0" maxOccurs="unbounded">
                    <xs:element ref="o:permission" minOccurs="0" maxOccurs="unbounded"/>
                    <xs:element ref="o:prohibition" minOccurs="0" maxOccurs="unbounded"/>
                    <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
                </xs:sequence>
                <xs:attribute name="uid" type="o:URIQnameQcode" use="required"/>
                <xs:attribute name="type" type="o:URIQnameQcode" use="required"/>
                <xs:attribute name="conflict" type="o:conflictENUM"/>
                <xs:attribute name="undefined" type="o:undefinedENUM"/>
                <xs:attribute name="inheritAllowed" type="xs:boolean"/>
                <xs:attribute name="inheritFrom" type="o:URIQnameQcode"/>
                <xs:attribute name="inheritRelation" type="o:URIQnameQcode"/>
                <xs:anyAttribute namespace="##other" processContents="lax"/>     
    </xs:complexType>
     
    <xs:element name="permission" type="o:permCT"/>
    <xs:complexType name="permCT">
           <xs:sequence>
                    <xs:element ref="o:asset" maxOccurs="unbounded"/>
                    <xs:element ref="o:action" />
                    <xs:element ref="o:constraint"  minOccurs="0" maxOccurs="unbounded"/>
                    <xs:element ref="o:party"  minOccurs="0" maxOccurs="unbounded"/>
                    <xs:element ref="o:duty"  minOccurs="0" maxOccurs="unbounded"/>
                    <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
           </xs:sequence>
           <xs:attributeGroup ref="o:idAttributes"/>        
    </xs:complexType>
     
    <xs:element name="prohibition" type="o:prohibCT"/> 
    <xs:complexType name="prohibCT">
        <xs:sequence>
            <xs:element ref="o:asset"  maxOccurs="unbounded"/>
            <xs:element ref="o:action" />
            <xs:element ref="o:constraint" minOccurs="0" maxOccurs="unbounded"/>
            <xs:element ref="o:party"  minOccurs="0" maxOccurs="unbounded"/>
            <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attributeGroup ref="o:idAttributes"/>
    </xs:complexType>
     
    <xs:element name="duty" type="o:dutyCT"/>
    <xs:complexType name="dutyCT">
        <xs:sequence>
            <xs:element ref="o:action" minOccurs="0"/> <!--Required Element-->
            <xs:element ref="o:asset"  minOccurs="0" maxOccurs="unbounded"/>
            <xs:element ref="o:constraint"  minOccurs="0" maxOccurs="unbounded"/>
            <xs:element ref="o:party"  minOccurs="0" maxOccurs="unbounded"/>
            <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
        </xs:sequence>
        <xs:attribute name="uid" type="o:URIQnameQcode"/>
        <xs:attributeGroup ref="o:idAttributes"/>
    </xs:complexType>
     
    <xs:element name="asset" type="o:assetCT"/> 
    <xs:complexType name="assetCT">
        <xs:attribute name="uid" type="o:URIQnameQcode" /> <!--Required Attribute-->
        <xs:attribute name="relation" type="o:URIQnameQcode" /> <!--Required Attribute-->
        <xs:attributeGroup ref="o:idAttributes"/>
    </xs:complexType>
     
    <xs:element name="party" type="o:partyCT"/>
    <xs:complexType name="partyCT">
        <xs:attribute name="uid" type="o:URIQnameQcode"/> <!--Required Attribute-->
        <xs:attribute name="function" type="o:URIQnameQcode" /> <!--Required Attribute-->
        <xs:attribute name="scope" type="o:URIQnameQcode"/>
        <xs:attributeGroup ref="o:idAttributes"/>
    </xs:complexType>
  
    <xs:element name="action" type="o:actionCT"/>
    <xs:complexType name="actionCT">
        <xs:attribute name="name" type="o:URIQnameQcode" /> <!--Required Attribute-->
        <xs:attributeGroup ref="o:idAttributes"/>
    </xs:complexType>
     
    <xs:element name="constraint" type="o:constraintCT"/>
    <xs:complexType name="constraintCT">
        <xs:attribute name="name" type="o:URIQnameQcode" /> <!--Required Attribute-->
        <xs:attribute name="operator" type="o:URIQnameQcode" /> <!--Required Attribute-->
        <xs:attribute name="rightOperand" type="o:listOfValues" /> <!--Required Attribute-->
        <xs:attribute name="status" type="xs:string" />
        <xs:attributeGroup ref="o:idAttributes"/>
    </xs:complexType>
     
    <xs:simpleType name="listOfValues">
        <xs:list itemType="xs:string"/>
    </xs:simpleType>
      
    <xs:simpleType name="conflictENUM">
        <xs:restriction base="xs:string">
            <xs:enumeration value="perm"/>
            <xs:enumeration value="prohibit"/>
            <xs:enumeration value="invalid"/>
        </xs:restriction>
    </xs:simpleType>
     
    <xs:simpleType name="undefinedENUM">
        <xs:restriction base="xs:string">
            <xs:enumeration value="support"/>
            <xs:enumeration value="ignore"/>
            <xs:enumeration value="invalid"/>
        </xs:restriction>
    </xs:simpleType>
     
    <xs:simpleType name="URIQnameQcode">
        <xs:union memberTypes="xs:anyURI xs:QName o:QCode"/>
    </xs:simpleType>
     
    <xs:simpleType name="QCode">
        <xs:restriction base="xs:string">
            <xs:pattern value="[^\s:]+:[^\s]+"/>
        </xs:restriction>
         
    </xs:simpleType>
    <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>
</xs:schema>

Acknowledgements

The editors gratefully acknowledge feedback and contributions to this document from:

  • All members of the W3C ODRL Community Group
  • Especially Stuart Myles, Michael Steidl, Francis Cave, Jim Earley, Helge Hundacker, Daniel Paehler, Andreas Kasten, Rainer Weissenfels

References

[ODRL-MODEL] R. Iannella & S. Guth & D. Paehler & A. Kasten (eds). Open Digital Rights Language (ODRL) Version 2.0 – Core Model. Final Specification, W3C ODRL Community Group, 19 April 2012. http://www.w3.org/community/odrl/two/model/
[ODRL-VOCAB] S. Guth & R. Iannella (eds). Open Digital Rights Language (ODRL) Version 2.0 – Common Vocabulary. Final Specification, W3C ODRL Community Group, 19 April 2012. http://www.w3.org/community/odrl/two/vocab/
[Q-CODE] NewsML Specification Version 2.4. International Press Telecommunications Council (IPTC) 2009 http://www.iptc.org/std/NewsML-G2/2.4/specification/NewsML-G2_2.4-spec-PCL.pdf
[RFC2119] Key words for use in RFCs to Indicate Requirement Levels, S. Bradner. The Internet Society, March 1997. http://www.ietf.org/rfc/rfc2119.txt
[XML] T. Bray & J. Paoli & C. M. Sperberg-McQueen & E. Maler & F. Yergeau (eds). Extensible Markup Language (XML) 1.0 (Fifth Edition). W3C Recommendation 26 November 2008. http://www.w3.org/TR/xml/
[XML-SCHEMA] H. S. Thompson & D. Beech & M. Maloney & N. Mendelsohn (eds). XML Schema Part 1: Structures Second Edition. W3C Recommendation 28 October 2004. http://www.w3.org/TR/xmlschema-1/
[XML-SCHEMA-DT] P. V. Biron & K. Permanente & A. Malhotra (eds). XML Schema Part 2: Datatypes Second Edition. W3C Recommendation 28 October 2004. http://www.w3.org/TR/xmlschema-2/
[XML-NAME] T. Bray & D. Hollander & A. Layman & R. Tobin & H. S. Thompson (eds). Namespaces in XML 1.0 (Third Edition). W3C Recommendation 8 December 2009. http://www.w3.org/TR/xml-names/
[XMPP-CORE] P. Saint-Andre (ed). Extensible Messaging and Presence Protocol (XMPP): Core. IETF RFC3920 October 2004. http://tools.ietf.org/html/rfc3920