Examples of use

From ODRL Initiative
Jump to: navigation, search

This page describes some examples of use.

Examples from the specification

The original examples found in the specification were:

http://lodscope.parthenon.org.uk/?uri=http%3A%2F%2Fptah.bencrannich.net%2F2013%2FUNSTABLE%2Fodrl-examples%2Ffigure-3.1
http://lodscope.parthenon.org.uk/?uri=http%3A%2F%2Fptah.bencrannich.net%2F2013%2FUNSTABLE%2Fodrl-examples%2Ffigure-3.2

Example in Figure 3.1

In the first trivial example, there are only two instances (an Asset and a Policy), linked by a simple dct:license property.

 <odrlm:Asset rdf:about="http://example.com/asset:9898">
   <dct:license rdf:resource="http://example.com/policy:0099"/>
 </odrlm:Asset>
 <odrlm:Policy rdf:about="http://example.com/policy:0099">
   <odrlm:permission rdf:resource="odrlm#reproduce"/>
   <odrlm:prohibition rdf:resource="odrlm#modify"/>
   <rdf:type rdf:resource="http://w3.org/ns/odrl/vocab#Set"/>
 </odrlm:Policy>

Note that the permissions (reproduce and modify) are individuals already present in the vocab ontology.

Example in Figure 3.1 (alternative)

The previous example made direct use of the instances odrlm:reproduce and odrlm:modify. This suffices for trivial cases, where the permission does not need to be further attributed. However, the usual need will require adding constraints, conditions, etc. to the permission. In this case, the odrlm:Permission should be instantiated. An alternative implementatin of the example in Figure 3.1 would be as follows:

   <owl:NamedIndividual rdf:about="http://example.com/asset:9898">
       <rdf:type rdf:resource="&model;Asset"/>
   </owl:NamedIndividual>
   <owl:NamedIndividual rdf:about="http://example.com/policy:0099">
       <rdf:type rdf:resource="&vocab;Set"/>
       <model:permission rdf:resource="http://example.com/blankpermission0"/>
       <model:prohibition rdf:resource="http://example.com/blankprohibition0"/>
   </owl:NamedIndividual>
   <owl:NamedIndividual rdf:about="http://example.com/blankpermission0">
       <rdf:type rdf:resource="&model;Permission"/>
       <vocab:target rdf:resource="http://example.com/asset:9898"/>
       <model:action rdf:resource="&vocab;reproduce"/>
   </owl:NamedIndividual>
   <owl:NamedIndividual rdf:about="http://example.com/blankprohibition0">
       <rdf:type rdf:resource="&model;Prohibition"/>
       <vocab:target rdf:resource="http://example.com/asset:9898"/>
       <model:action rdf:resource="&vocab;modify"/>
   </owl:NamedIndividual>

Please note that instead of using the dct:license element to link asset and policy, the ODRL vocabulary has been used instead: the relation target.

See the full example here as RDF/XML or as TTL.

Example in Figure 3.2

(provided by Víctor for testing)

This case requires attributing several properties to the two permissions, what makes needed creating blank nodes for them. Also, the constraint and the duty need to be instantiated. Of course, there must be individuals for the Asset, the Policy, the Party and the payment Asset. Thus, we need 8 individuals, which can be declared as follows:

   <owl:NamedIndividual rdf:about="http://example.com/music:4545">
       <rdf:type rdf:resource="&model;Asset"/>
       <terms:license rdf:resource="http://example.com/policy:0231"/>
   </owl:NamedIndividual>
   <owl:NamedIndividual rdf:about="http://example.com/sony:10">
       <rdf:type rdf:resource="&model;Party"/>
   </owl:NamedIndividual>
   <owl:NamedIndividual rdf:about="http://example.com/policy:0231">
       <rdf:type rdf:resource="&vocab;Offer"/>
       <model:permission rdf:resource="http://example.com/blankpermission0"/>
       <model:permission rdf:resource="http://example.com/blankpermission1"/>
       <vocab:assigner rdf:resource="http://example.com/sony:10"/>
   </owl:NamedIndividual>
   <owl:NamedIndividual rdf:about="http://example.com/ubl:AUD0.50">
       <rdf:type rdf:resource="&model;Asset"/>
   </owl:NamedIndividual>
   <owl:NamedIndividual rdf:about="http://example.com/blankconstraint0">
       <rdf:type rdf:resource="&model;Constraint"/>
       <vocab:count>lteq</vocab:count>
       <vocab:rightOperand>1</vocab:rightOperand>
   </owl:NamedIndividual>
   <owl:NamedIndividual rdf:about="http://example.com/blankduty0">
       <rdf:type rdf:resource="&model;Duty"/>
       <model:action rdf:resource="&vocab;pay"/>
   </owl:NamedIndividual>
   <owl:NamedIndividual rdf:about="http://example.com/blankpermission0">
       <rdf:type rdf:resource="&model;Permission"/>
       <model:duty rdf:resource="http://example.com/blankduty0"/>
       <model:action rdf:resource="&vocab;play"/>
   </owl:NamedIndividual>
   <owl:NamedIndividual rdf:about="http://example.com/blankpermission1">
       <rdf:type rdf:resource="&model;Permission"/>
       <model:constraint rdf:resource="http://example.com/blankconstraint0"/>
       <model:duty rdf:resource="http://example.com/blankduty0"/>
       <model:action rdf:resource="&vocab;copy"/>
   </owl:NamedIndividual>

See the full example as TTL or as RDF/XML

Examples porting existing licenses into ODRLv2.0