Skip to content

Commit

Permalink
A policy explained line by line.
Browse files Browse the repository at this point in the history
Several policies in RDF and JSON-LD
  • Loading branch information
Víctor Rodríguez Doncel committed Feb 4, 2018
1 parent b42cabd commit 8c1d5af
Showing 1 changed file with 110 additions and 16 deletions.
126 changes: 110 additions & 16 deletions bp/index.html
Expand Up @@ -18,7 +18,7 @@
</head>
<body>
<section id="abstract">
<p>This document presents several examples of use of ODRL, describes some good practices and contains a collection of sample policies.</p>
<p>This document presents several examples of use of ODRL, describes good practices and provides sample ODRL policies.</p>

</section>
<section id='sotd'>
Expand All @@ -31,7 +31,8 @@ <h2>Introduction</h2>
<section id="conventions">
<h3>Document Conventions</h3>
<p>
Within this document, the following namespace prefix bindings are used:
<p>In order to read this document a basic knowledge of either RDF or JSON is supposed.</p>
<p>Within this document, the following namespace prefix bindings are used:</p>
</p>
<table class="def">
<tbody>
Expand Down Expand Up @@ -146,7 +147,7 @@ <h3>Example 2: Representation of access policies to digital resources</h3>
<ul>
<li><em>Neutrality</em>. ODRL is completely neutral about the technology used (if any) to grant access to a certain resource.</li>
<li><em>Extendability</em>. New allowed actions and new constraints can be created. They can be arranged in a hierarchical form.</li>
</li>
</ul>
<h3>Example 3: Representation of rights in rules</h3>
Even if ODRL is not capable of accessing the subtleties of legislation, the actions that are forbidden in a certain sorts of noms can be represented in ODRL and act as a summary. See <a href="http://w3c.github.io/poe/ucr/#POE.UC.04">UC4</a>. Advantages of an ODRL representation:
<ul>
Expand All @@ -156,22 +157,115 @@ <h3>Example 3: Representation of rights in rules</h3>
</section>

<section id="styles">
<h2>Style guide</h2>
We can resume here the examples in the <a href="https://www.w3.org/2016/poe/wiki/Best_Practices">wiki</a>.
<h2>Sample policies</h2>
<!-- We can resume here the examples in the <a href="https://www.w3.org/2016/poe/wiki/Best_Practices">wiki</a>. -->

<h3>1. A first policy in ODRL (JSON-LD)</h3>
The following ODRL policiy might be read as "Movie 9898 can be used".
<div class="example"><div class="example-title marker"><span>Example 1</span></div>
<pre id="eg2" class="hljs json" aria-busy="false" aria-live="polite">
00 {
01 "@context": "http://www.w3.org/ns/odrl.jsonld",
02 "@type": "Set",
03 "uid": "http://example.com/policy:1010",
04 "permission": [{
05 "target": "http://example.com/asset:9898.movie",
06 "action": "use"
07 }]
08 }
</pre></div>
Explanation line by line:
<ul>
<li>An ODRL policy is represented as a JSON Object (lines 00 and 08). In particular, ODRL policies can be represented in <a href="https://json-ld.org/">JSON-LD</a> -a lightweight Linked Data format.</li>
<li>The context of the JSON-LD policy is, as in every ODRL policy, "http://www.w3.org/ns/odrl.jsonld" (see line 01).</li>
<li>Type "odrl:Set" means this is positive assertion. Somebody <i>affirms</i> that Movie 9898 can be used (line 02).</li>
<li>The policy is identified as <i>http://example.com/policy:1010</i>. ODRL policies are best identified with <a href="https://tools.ietf.org/html/rfc3986">URI</a>s (see line 03).</li>
<li>ODRL policies have one or more rules: permissions, obligations, prohibitions (line 04). You may want to see the main <a href="https://www.w3.org/TR/odrl-model/#infoModel">ODRL diagram</a>. </li>
<li>The target of the policy is the resource referenced by <i>http://example.com/asset:9898.movie</i>, probably a movie (line 04). Assets are best identified with URIs.</li>
<li>The permitted action on the asset is <i>use</i> (line 06). You may want to read its <a href="https://www.w3.org/TR/odrl-vocab/#term-use">definition</a>, or browse other possible actions predefined by the ODRL specs.</li>
</ul>


<div class="example"><div class="example-title marker"><span>Example 1</span></div><pre id="eg2" class="hljs json" aria-busy="false" aria-live="polite">{
<span class="hljs-attr">"@context"</span>: <span class="hljs-string">"http://www.w3.org/ns/odrl.jsonld"</span>,
<span class="hljs-attr">"@type"</span>: <span class="hljs-string">"Offer"</span>,
<span class="hljs-attr">"uid"</span>: <span class="hljs-string">"http://example.com/policy:1011"</span>,
<span class="hljs-attr">"profile"</span>: <span class="hljs-string">"http://example.com/odrl:profile:01"</span>,
<span class="hljs-attr">"permission"</span>: [{
<span class="hljs-attr">"target"</span>: <span class="hljs-string">"http://example.com/asset:9898.movie"</span>,
<span class="hljs-attr">"assigner"</span>: <span class="hljs-string">"http://example.com/party:org:abc"</span>,
<span class="hljs-attr">"action"</span>: <span class="hljs-string">"play"</span>
}]
}</pre></div>
<h3>2. A first policy in ODRL (RDF Turtle)</h3>
JSON-LD is only one of the possible serializations of ODRL a policy. The following example shows the same policy as in Example 1 but in RDF Turtle. Example 1 and Example 2 have the same meaning.
<div class="example"><div class="example-title marker"><span>Example 2</span></div>
<pre id="eg2" class="hljs json" aria-busy="false" aria-live="polite">
@prefix odrl: &lt;http://www.w3.org/ns/odrl/2/&gt;

&lt;http://example.org/policy/1&gt; a odrl:Policy, odrl:Set ;
odrl:permission [
odrl:target &lt;http://example.com/asset/1&gt; ;
odrl:assignee &lt;http://example.com/party/Alice&gt; ;
odrl:action odrl:use
] ;
</pre></div>

<h3>3. A first example in ODRL (alternative representations in RDF Turtle)</h3>
As per RDFS <a href="https://www.w3.org/TR/rdf-mt/#RDFSRules">entailment rule rdfs2</a>, the class of the policy resource <code>odrl:Policy</code> can be inferred, hence its specification is not necessary. As per the ODRL Information Model (<a href="https://www.w3.org/TR/odrl-model/#policy-set">2.1.1 Set Class</a>), Set is the default type of policy, hence its specification is not necessary. The policy shown in Example 3 is also equivalent to the policies in Example 1 and Example 2 (odrl prefix declaration has also been removed for clarity).

<div class="example"><div class="example-title marker"><span>Example 3a</span></div>
<pre id="eg2" class="hljs json" aria-busy="false" aria-live="polite">
&lt;http://example.com/policy:1010&gt; odrl:permission [
odrl:target &lt;http://example.com/asset:9898.movie&gt; ;
odrl:action odrl:use
] ;
</pre></div>
Alternative forms for the same policy are also possible. For example, one might want to attribute a certain policy to a certain asset.
As specified in the <a href="https://www.w3.org/TR/odrl-model/#policy-has">ODRL Information Model</a>, the following code would be equivalent.
<div class="example"><div class="example-title marker"><span>Example 3b</span></div>
<pre id="eg2" class="hljs json" aria-busy="false" aria-live="polite">
@prefix dct: &lt;http://purl.org/dc/terms/&gt;
&lt;http://example.com/asset:9898.movie&gt; odrl:hasPolicy &lt;http://example.com/policy:1010&gt; .
&lt;http://example.com/policy:1010&gt; odrl:permission [
odrl:target &lt;http://example.com/asset:9898.movie&gt; ;
odrl:action odrl:use
] ;
</pre></div>

https://www.w3.org/TR/odrl-model/#composition-compact
<div class="example"><div class="example-title marker"><span>Example 4b</span></div>
<pre id="eg2" class="hljs json" aria-busy="false" aria-live="polite">
@prefix dct: &lt;http://purl.org/dc/terms/&gt;
&lt;http://example.com/asset:9898.movie&gt; odrl:hasPolicy &lt;http://example.com/policy:1010&gt; .
&lt;http://example.com/policy:1010&gt; odrl:permission [
odrl:target &lt;http://example.com/asset:9898.movie&gt; ;
odrl:action odrl:use
] ;
</pre></div>









<h3>4. A first example in XML</h3>
tbd
<h3>5. How to grant Alice the permission to use an asset</h3>
The following ODRL policiy might be read as "Alice can use Asset 1".

<div class="example"><div class="example-title marker"><span>Example 5 (Turtle)</span></div>
<pre id="eg2" class="hljs json" aria-busy="false" aria-live="polite">
&lt;http://example.org/policy/5&gt; odrl:permission [
odrl:target &lt;http://example.com/asset/1&gt; ;
odrl:assignee &lt;http://example.com/party/Alice&gt; ;
odrl:action odrl:use
] </pre></div>

<div class="example"><div class="example-title marker"><span>Example 5 (JSON-LD)</span></div>
<pre id="eg2" class="hljs json" aria-busy="false" aria-live="polite">
{
"@context": "http://www.w3.org/ns/odrl.jsonld",
"@type": "Set",
"uid": "http://example.org/policy/5",
"permission": [{
"target": "http://example.com/asset/1",
"assignee": "http://example.com/party/Alice",
"action": "use"
}]
}
</section>

<section id="implementation">
Expand Down

0 comments on commit 8c1d5af

Please sign in to comment.