ODRL2.0 Simple API  1.0
A simple API to manage simple ODRL2.0 expressions
 All Classes Functions Variables Pages
ODRL 2.0 Simple API

Introduction

ODRL2.0 is a language to express policies: permissions, prohibitions, obligations.

This API is able to manipulate expressions conformant to a subset of the Core Model specification and Common Vocabulary.

ODRL2.0 can be serialized as XML, as JSON or as RDF based on the draft ODRL2.0 Ontology. The only serialization this Java API supports in this version is the RDF

Download

odrlapi.0.1.jar

Fast intro to ODRL2.0 and ODRL2.0 Simple API

ODRL2.0 Core Model is abstract, i.e., serialization independent. The examples in this document assume the RDF serialization. First, some common prefixes:

prefixnamespace
odrlhttp://www.w3.org/ns/odrl/2/
dcthttp://purl.org/dc/terms/

A first example

A policy may represent the following statement: "The asset 9898 can be read and written".

http://example.com/policy:0099
        a                 odrl:Policy , odrl:Set ;
        odrl:permission   [ a            odrl:Permission ;
                            odrl:action  odrl:write , odrl:read ;
                            odrl:target  "http://example.com/asset:9898"
                          ] ;

Note we have created a resource, policy:01, of class odrl:Set, with a single permission: the permitted actions (read, write), and the resource (asset9898). The absence of the assignee is usually interpreted as "anybody", the absence of the assigner might be interpreted as if it matches the policy publisher.

This may have been defined in Java with the

        Policy policy = new Policy("http://example.com/policy:0099");
        Permission permission = new Permission();
        permission.setTarget("http://example.com/asset:9898");
        permission.setActions(Arrays.asList(new Action("http://www.w3.org/ns/odrl/2/read"), new Action("http://www.w3.org/ns/odrl/2/write")));
        policy.addRule(permission);
        System.out.println(ODRLRDF.getRDF(policy, Lang.TTL));

Note that the last line converts objects in the ODRL2.0 Simple API Model to the RDF (Turtle by default) serialization.

Profile for Linked Data

The Linked Data profile uses a subset of the ODRL2.0 Core Model and Common Vocubulary, plus the needed vocabulary derived from the former: the Linked Data Rights vocabulary

Author and terms of use

This API has been programmed by Víctor Rodríguez Doncel at the Ontology Engineering Group, in Universidad Politécnica de Madrid (Spain)

You may use this software as you like, but we do not accept any responsibility in its use.