"My Github page" =======
A Java API to manipulate ODRL2.0 RDF expressions
ODRL2.0 is a language to express policies: permissions, prohibitions, obligations. It is specified by the ODRL W3C Community and Business Group
This API is able to manipulate (read/write) 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
ODRL2.0 Core Model is abstract, i.e., serialization independent. The examples in this document assume the RDF serialization. The most common prefixes are:prefix | namespace |
odrl | http://www.w3.org/ns/odrl/2/ |
dct | http://purl.org/dc/terms/ |
A policy may represent the following statement: "The asset 9898 can be read and written".
The following example is taken from the official ODRL example 1
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" ] ;
In order to produce that code, the ODRLAPI can be used, by typing the excerpt shown below
This may have been defined in Java with thePolicy 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));
The first line creates an object of type Policy An empty string creates anonymous objects.
Note we have created a resource, policy:01, of class odrl:Set, with a single permission: the permitted Actions (read, write), and the resource, an Asset (asset9898).
The last line converts objects in the ODRL2.0 Simple API Model to the RDF (Turtle by default) serialization. Indeed, RDF/XML, N-Triples etc. are also supported.
The source code includes 7 full examples of working source code for you to start digging. Look into the examples folder.