odrl-ruby 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,127 +1,128 @@
1
- # ODRL::Ruby
2
-
3
- This is a gem to build ODRL records, and serialize them. Does not cover the full ODRL model (yet!)
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- ```ruby
10
- gem 'odrl-ruby'
11
- ```
12
-
13
- And then execute:
14
-
15
- $ bundle install
16
-
17
- Or install it yourself as:
18
-
19
- $ gem install odrl-ruby
20
-
21
- ## Usage
22
-
23
- # Two functionalities: Build ODRL Policies; Build ODRL Profiles to extend the core ODRL vocabulary
24
-
25
- # Build Policy:
26
-
27
- ```
28
- require 'odrl/ruby'
29
-
30
- # an offer to toshiaki from mark to use the polyA resource during the biohackathon
31
-
32
- # core annotatons are: :title, :creator, :description, :subject :baseURI, :uid, :type
33
- policy = ODRL::Offer.new(
34
- title: "Offer to Toshiaki-san",
35
- creator: "https://orcid.org/0000-0001-6960-357X",
36
- description: "An offer for Toshiaki-san to use the polyA data during the hackathon",
37
- subject: "collaboration", # this is the CCE category - useful for EJP-RD ONLYU
38
- )
39
-
40
- asset = ODRL::Asset.new(uid: "http://mark.wilkinson.org/data/polyA", title: "Mark's PolyA Database")
41
-
42
- # you indicate the type of party by assigning the predicate (either assigner or assignee)
43
- # ODRLV is the RDF::Vocabulary for ODRL, exported to this namespace
44
- mark = ODRL::Party.new(uid: "https://orcid.org/0000-0001-6960-357X", predicate: ODRLV.assigner, title: "Mark D Wilkinson" )
45
- toshiaki = ODRL::Party.new(uid: "https://orcid.org/0000-0003-2391-0384", predicate: ODRLV.assignee, title: "Toshiaki Katayama")
46
-
47
- # Rules
48
- permission = ODRL::Permission.new(title: "Permission to use")
49
-
50
- use = ODRL::Use.new(value: "use") # subclass of ODRL::Action
51
-
52
- # Constraints: :uid, :rightOperand, :leftOperand, :operator, :rightOperandReference, :dataType, :unit, :status
53
- constraint = ODRL::Constraint.new(
54
- title: "Only during the hackathon",
55
- leftOperand: "event",
56
- operator: "eq",
57
- rightOperand: "https://2023.biohackathon.org"
58
- )
59
- permission.addConstraint(constraint: constraint)
60
- permission.addAsset(asset: asset)
61
- permission.addAssigner(party: toshiaki)
62
- permission.addAssignee(party: mark)
63
- permission.addAction(action: use)
64
-
65
- policy.addPermission(rule: permission)
66
-
67
- policy.load_graph # this brings the triples into memory, cascading down all objects conneted to "policuy"
68
- result = policy.serialize(format: 'turtle') # get the RDF string
69
- puts result
70
- ```
71
-
72
- # Build Profile:
73
-
74
- ```
75
- require 'odrl/profile/builder'
76
-
77
- p = ODRL::Profile::Builder.new(
78
- uri: 'https://example.org/myprofiles/germplasm_odrl_profile.ttl',
79
- title: "ODRL Profile for Germplasm resources",
80
- description: "There are some properties and comparisons that only make sense in the Germplasm expert domain",
81
- author: "Mark D Wilkinson",
82
- profile_class: "https://example.org/myprofiles/ontology#SeedOffer"
83
- )
84
-
85
- p.asset_relations << ODRL::Profile::AssetRelation.new(
86
- uri: "https://example.org/myprofiles/ontology#nagoya_permission",
87
- label: "Permission under Nagoya protocol",
88
- definition: "Permission is a special thing in the Nagoya protocol")
89
-
90
-
91
- p.party_functional_roles << ODRL::Profile::AssetRelation.new(
92
- uri: "https://example.org/myprofiles/ontology#nagoya_assigner",
93
- label: "Assigner with Nagoya authority to assign",
94
- definition: "Assigners have special responsibilities in the Nagoya protocol")
95
-
96
- p.actions << ODRL::Profile::Rule.new(
97
- uri: "https://example.org/myprofiles/ontology#nagoya_propogate",
98
- label: "Plant and Harvest",
99
- definition: "the action of planting and harvesting the seed",
100
- included_in: ODRLV.use,
101
- implies: ODRLV.distribute)
102
-
103
-
104
- p.leftOperands << ODRL::Profile::LeftOperand.new(
105
- uri: "https://example.org/myprofiles/ontology#at_risk_species",
106
- label: "At Risk Species",
107
- definition: "A species that has been flagged as at-risk of extinction")
108
-
109
- p.rightOperands << ODRL::Profile::RightOperand.new(
110
- uri: "https://example.org/myprofiles/ontology#on_watchlist",
111
- label: "On Watchlist",
112
- definition: "A species whose risk of extinction is on a watchlist")
113
-
114
- p.rightOperands << ODRL::Profile::Relation.new(
115
- uri: "https://example.org/myprofiles/ontology#within_risk_boundary",
116
- label: "Within Bounds",
117
- definition: "comparison of risk boundaries")
118
-
119
-
120
- p.build()
121
- puts p.serialize
122
- ```
123
-
124
-
125
- ## License
126
-
127
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
1
+ # ODRL::Ruby
2
+
3
+ This is a gem to build ODRL records, and serialize them. Does not cover the full ODRL model (yet!)
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ ```sh
10
+ gem 'odrl-ruby'
11
+ ```
12
+
13
+ And then execute:
14
+
15
+ ```sh
16
+ $ bundle install
17
+
18
+ # Or install it yourself as:
19
+ $ gem install odrl-ruby
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ # Two functionalities: Build ODRL Policies; Build ODRL Profiles to extend the core ODRL vocabulary
25
+
26
+ # Build Policy:
27
+
28
+ ```ruby
29
+ require 'odrl/ruby'
30
+
31
+ # an offer to toshiaki from mark to use the polyA resource during the biohackathon
32
+
33
+ # core annotatons are: :title, :creator, :description, :subject :baseURI, :uid, :type
34
+ policy = ODRL::Offer.new(
35
+ title: "Offer to Toshiaki-san",
36
+ creator: "https://orcid.org/0000-0001-6960-357X",
37
+ description: "An offer for Toshiaki-san to use the polyA data during the hackathon",
38
+ subject: "collaboration", # this is the CCE category - useful for EJP-RD ONLYU
39
+ )
40
+
41
+ asset = ODRL::Asset.new(uid: "http://mark.wilkinson.org/data/polyA", title: "Mark's PolyA Database")
42
+
43
+ # you indicate the type of party by assigning the predicate (either assigner or assignee)
44
+ # ODRLV is the RDF::Vocabulary for ODRL, exported to this namespace
45
+ mark = ODRL::Party.new(uid: "https://orcid.org/0000-0001-6960-357X", predicate: ODRLV.assigner, title: "Mark D Wilkinson" )
46
+ toshiaki = ODRL::Party.new(uid: "https://orcid.org/0000-0003-2391-0384", predicate: ODRLV.assignee, title: "Toshiaki Katayama")
47
+
48
+ # Rules
49
+ permission = ODRL::Permission.new(title: "Permission to use")
50
+
51
+ use = ODRL::Use.new(value: "use") # subclass of ODRL::Action
52
+
53
+ # Constraints: :uid, :rightOperand, :leftOperand, :operator, :rightOperandReference, :dataType, :unit, :status
54
+ constraint = ODRL::Constraint.new(
55
+ title: "Only during the hackathon",
56
+ leftOperand: "event",
57
+ operator: "eq",
58
+ rightOperand: "https://2023.biohackathon.org"
59
+ )
60
+ permission.addConstraint(constraint: constraint)
61
+ permission.addAsset(asset: asset)
62
+ permission.addAssigner(party: toshiaki)
63
+ permission.addAssignee(party: mark)
64
+ permission.addAction(action: use)
65
+
66
+ policy.addPermission(rule: permission)
67
+
68
+ policy.load_graph # this brings the triples into memory, cascading down all objects conneted to "policuy"
69
+ result = policy.serialize(format: 'turtle') # get the RDF string
70
+ puts result
71
+ ```
72
+
73
+ # Build Profile:
74
+
75
+ ```ruby
76
+ require 'odrl/profile/builder'
77
+
78
+ p = ODRL::Profile::Builder.new(
79
+ uri: "https://example.org/myprofiles/grp",
80
+ title: "ODRL Profile for Germplasm resources",
81
+ description: "There are some properties and comparisons that only make sense in the Germplasm expert domain",
82
+ authors: ["Mark D Wilkinson"],
83
+ version: 0.1,
84
+ license: "https://creativecommons.org/licenses/by/4.0/"
85
+ )
86
+
87
+ p.asset_relations << ODRL::Profile::AssetRelation.new(
88
+ uri: "https://example.org/myprofiles/grp#nagoya_permission",
89
+ label: "Permission under Nagoya protocol",
90
+ definition: "Permission is a special thing in the Nagoya protocol")
91
+
92
+
93
+ p.party_functional_roles << ODRL::Profile::PartyFunction.new(
94
+ uri: "https://example.org/myprofiles/grp#nagoya_assigner",
95
+ label: "Assigner with Nagoya authority to assign",
96
+ definition: "Assigners have special responsibilities in the Nagoya protocol")
97
+
98
+ p.actions << ODRL::Profile::Action.new(
99
+ uri: "https://example.org/myprofiles/grp#nagoya_propogate",
100
+ label: "Plant and Harvest",
101
+ definition: "the action of planting and harvesting the seed",
102
+ included_in: ODRLV.use,
103
+ implies: ODRLV.distribute)
104
+
105
+
106
+ p.leftOperands << ODRL::Profile::LeftOperand.new(
107
+ uri: "https://example.org/myprofiles/grp#at_risk_species",
108
+ label: "At Risk Species",
109
+ definition: "A species that has been flagged as at-risk of extinction")
110
+
111
+ p.rightOperands << ODRL::Profile::RightOperand.new(
112
+ uri: "https://example.org/myprofiles/grp#on_watchlist",
113
+ label: "On Watchlist",
114
+ definition: "A species whose risk of extinction is on a watchlist")
115
+
116
+ p.operators << ODRL::Profile::Operator.new(
117
+ uri: "https://example.org/myprofiles/grp#within_risk_boundary",
118
+ label: "Within Bounds",
119
+ definition: "comparison of risk boundaries")
120
+
121
+
122
+ p.build()
123
+ puts p.serialize
124
+ ```
125
+
126
+ ## License
127
+
128
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile CHANGED
@@ -1,8 +1,8 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- require "rubocop/rake_task"
5
-
6
- RuboCop::RakeTask.new
7
-
8
- task default: :rubocop
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rubocop/rake_task"
5
+
6
+ RuboCop::RakeTask.new
7
+
8
+ task default: :rubocop
data/bin/console CHANGED
@@ -1,15 +1,15 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require "bundler/setup"
5
- require "odrl/ruby"
6
-
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
- # Pry.start
13
-
14
- require "irb"
15
- IRB.start(__FILE__)
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "odrl/ruby"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup CHANGED
@@ -1,8 +1,8 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -1,63 +1,63 @@
1
- @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2
-
3
- <http://example.org#constraint_68811358965684>
4
- <http://purl.org/dc/terms/identifier> <http://example.org#constraint_68811358965684> ;
5
- <http://purl.org/dc/terms/title> "Only during the hackathon"@en ;
6
- a <http://www.w3.org/ns/odrl/2/Constraint> ;
7
- <http://www.w3.org/2000/01/rdf-schema#label> "Only during the hackathon"@en ;
8
- <http://www.w3.org/ns/odrl/2/leftOperand> <http://www.w3.org/ns/odrl/2/event> ;
9
- <http://www.w3.org/ns/odrl/2/operator> <http://www.w3.org/ns/odrl/2/eq> ;
10
- <http://www.w3.org/ns/odrl/2/rightOperand> <https://2023.biohackathon.org> ;
11
- <http://www.w3.org/ns/odrl/2/uid> <http://example.org#constraint_68811358965684> .
12
-
13
- <http://example.org#policy_68811358965627>
14
- <http://purl.org/dc/terms/creator> <https://orcid.org/0000-0001-6960-357X> ;
15
- <http://purl.org/dc/terms/description> "An offer for Toshiaki-san to use the polyA data during the hackathon"@en ;
16
- <http://purl.org/dc/terms/identifier> <http://example.org#policy_68811358965627> ;
17
- <http://purl.org/dc/terms/subject> "collaboration"@en ;
18
- <http://purl.org/dc/terms/title> "Offer to Toshiaki-san"@en ;
19
- a <http://www.w3.org/ns/odrl/2/Offer> ;
20
- <http://www.w3.org/2000/01/rdf-schema#label> "Offer to Toshiaki-san"@en ;
21
- <http://www.w3.org/ns/odrl/2/permission> <http://example.org#rule_68811358965667> ;
22
- <http://www.w3.org/ns/odrl/2/uid> <http://example.org#policy_68811358965627> .
23
-
24
- <http://example.org#rule_68811358965667>
25
- <http://purl.org/dc/terms/identifier> <http://example.org#rule_68811358965667> ;
26
- <http://purl.org/dc/terms/title> "Permission to use"@en ;
27
- a <http://www.w3.org/ns/odrl/2/Permission> ;
28
- <http://www.w3.org/2000/01/rdf-schema#label> "Permission to use"@en ;
29
- <http://www.w3.org/ns/odrl/2/action> <http://www.w3.org/ns/odrl/2/use> ;
30
- <http://www.w3.org/ns/odrl/2/assignee> <https://orcid.org/0000-0001-6960-357X> ;
31
- <http://www.w3.org/ns/odrl/2/assigner> <https://orcid.org/0000-0003-2391-0384> ;
32
- <http://www.w3.org/ns/odrl/2/constraint> <http://example.org#constraint_68811358965684> ;
33
- <http://www.w3.org/ns/odrl/2/target> <http://mark.wilkinson.org/data/polyA> ;
34
- <http://www.w3.org/ns/odrl/2/uid> <http://example.org#rule_68811358965667> .
35
-
36
- <http://mark.wilkinson.org/data/polyA>
37
- <http://purl.org/dc/terms/identifier> <http://mark.wilkinson.org/data/polyA> ;
38
- <http://purl.org/dc/terms/title> "Mark's PolyA Database"@en ;
39
- a <http://www.w3.org/ns/odrl/2/Asset> ;
40
- <http://www.w3.org/2000/01/rdf-schema#label> "Mark's PolyA Database"@en ;
41
- <http://www.w3.org/ns/odrl/2/uid> <http://mark.wilkinson.org/data/polyA> .
42
-
43
- <http://www.w3.org/ns/odrl/2/use>
44
- <http://purl.org/dc/terms/identifier> <http://www.w3.org/ns/odrl/2/use> ;
45
- a "type"@en ;
46
- <http://www.w3.org/2000/01/rdf-schema#label> ""@en ;
47
- <http://www.w3.org/ns/odrl/2/uid> <http://www.w3.org/ns/odrl/2/use> ;
48
- <https://schema.org/name> ""@en .
49
-
50
- <https://orcid.org/0000-0001-6960-357X>
51
- <http://purl.org/dc/terms/identifier> <https://orcid.org/0000-0001-6960-357X> ;
52
- <http://purl.org/dc/terms/title> "Mark D Wilkinson"@en ;
53
- a <http://www.w3.org/ns/odrl/2/Party> ;
54
- <http://www.w3.org/2000/01/rdf-schema#label> "Mark D Wilkinson"@en ;
55
- <http://www.w3.org/ns/odrl/2/uid> <https://orcid.org/0000-0001-6960-357X> .
56
-
57
- <https://orcid.org/0000-0003-2391-0384>
58
- <http://purl.org/dc/terms/identifier> <https://orcid.org/0000-0003-2391-0384> ;
59
- <http://purl.org/dc/terms/title> "Toshiaki Katayama"@en ;
60
- a <http://www.w3.org/ns/odrl/2/Party> ;
61
- <http://www.w3.org/2000/01/rdf-schema#label> "Toshiaki Katayama"@en ;
62
- <http://www.w3.org/ns/odrl/2/uid> <https://orcid.org/0000-0003-2391-0384> .
63
-
1
+ @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
2
+
3
+ <http://example.org#constraint_68811358965684>
4
+ <http://purl.org/dc/terms/identifier> <http://example.org#constraint_68811358965684> ;
5
+ <http://purl.org/dc/terms/title> "Only during the hackathon"@en ;
6
+ a <http://www.w3.org/ns/odrl/2/Constraint> ;
7
+ <http://www.w3.org/2000/01/rdf-schema#label> "Only during the hackathon"@en ;
8
+ <http://www.w3.org/ns/odrl/2/leftOperand> <http://www.w3.org/ns/odrl/2/event> ;
9
+ <http://www.w3.org/ns/odrl/2/operator> <http://www.w3.org/ns/odrl/2/eq> ;
10
+ <http://www.w3.org/ns/odrl/2/rightOperand> <https://2023.biohackathon.org> ;
11
+ <http://www.w3.org/ns/odrl/2/uid> <http://example.org#constraint_68811358965684> .
12
+
13
+ <http://example.org#policy_68811358965627>
14
+ <http://purl.org/dc/terms/creator> <https://orcid.org/0000-0001-6960-357X> ;
15
+ <http://purl.org/dc/terms/description> "An offer for Toshiaki-san to use the polyA data during the hackathon"@en ;
16
+ <http://purl.org/dc/terms/identifier> <http://example.org#policy_68811358965627> ;
17
+ <http://purl.org/dc/terms/subject> "collaboration"@en ;
18
+ <http://purl.org/dc/terms/title> "Offer to Toshiaki-san"@en ;
19
+ a <http://www.w3.org/ns/odrl/2/Offer> ;
20
+ <http://www.w3.org/2000/01/rdf-schema#label> "Offer to Toshiaki-san"@en ;
21
+ <http://www.w3.org/ns/odrl/2/permission> <http://example.org#rule_68811358965667> ;
22
+ <http://www.w3.org/ns/odrl/2/uid> <http://example.org#policy_68811358965627> .
23
+
24
+ <http://example.org#rule_68811358965667>
25
+ <http://purl.org/dc/terms/identifier> <http://example.org#rule_68811358965667> ;
26
+ <http://purl.org/dc/terms/title> "Permission to use"@en ;
27
+ a <http://www.w3.org/ns/odrl/2/Permission> ;
28
+ <http://www.w3.org/2000/01/rdf-schema#label> "Permission to use"@en ;
29
+ <http://www.w3.org/ns/odrl/2/action> <http://www.w3.org/ns/odrl/2/use> ;
30
+ <http://www.w3.org/ns/odrl/2/assignee> <https://orcid.org/0000-0001-6960-357X> ;
31
+ <http://www.w3.org/ns/odrl/2/assigner> <https://orcid.org/0000-0003-2391-0384> ;
32
+ <http://www.w3.org/ns/odrl/2/constraint> <http://example.org#constraint_68811358965684> ;
33
+ <http://www.w3.org/ns/odrl/2/target> <http://mark.wilkinson.org/data/polyA> ;
34
+ <http://www.w3.org/ns/odrl/2/uid> <http://example.org#rule_68811358965667> .
35
+
36
+ <http://mark.wilkinson.org/data/polyA>
37
+ <http://purl.org/dc/terms/identifier> <http://mark.wilkinson.org/data/polyA> ;
38
+ <http://purl.org/dc/terms/title> "Mark's PolyA Database"@en ;
39
+ a <http://www.w3.org/ns/odrl/2/Asset> ;
40
+ <http://www.w3.org/2000/01/rdf-schema#label> "Mark's PolyA Database"@en ;
41
+ <http://www.w3.org/ns/odrl/2/uid> <http://mark.wilkinson.org/data/polyA> .
42
+
43
+ <http://www.w3.org/ns/odrl/2/use>
44
+ <http://purl.org/dc/terms/identifier> <http://www.w3.org/ns/odrl/2/use> ;
45
+ a "type"@en ;
46
+ <http://www.w3.org/2000/01/rdf-schema#label> ""@en ;
47
+ <http://www.w3.org/ns/odrl/2/uid> <http://www.w3.org/ns/odrl/2/use> ;
48
+ <https://schema.org/name> ""@en .
49
+
50
+ <https://orcid.org/0000-0001-6960-357X>
51
+ <http://purl.org/dc/terms/identifier> <https://orcid.org/0000-0001-6960-357X> ;
52
+ <http://purl.org/dc/terms/title> "Mark D Wilkinson"@en ;
53
+ a <http://www.w3.org/ns/odrl/2/Party> ;
54
+ <http://www.w3.org/2000/01/rdf-schema#label> "Mark D Wilkinson"@en ;
55
+ <http://www.w3.org/ns/odrl/2/uid> <https://orcid.org/0000-0001-6960-357X> .
56
+
57
+ <https://orcid.org/0000-0003-2391-0384>
58
+ <http://purl.org/dc/terms/identifier> <https://orcid.org/0000-0003-2391-0384> ;
59
+ <http://purl.org/dc/terms/title> "Toshiaki Katayama"@en ;
60
+ a <http://www.w3.org/ns/odrl/2/Party> ;
61
+ <http://www.w3.org/2000/01/rdf-schema#label> "Toshiaki Katayama"@en ;
62
+ <http://www.w3.org/ns/odrl/2/uid> <https://orcid.org/0000-0003-2391-0384> .
63
+
@@ -1,47 +1,48 @@
1
- require 'odrl/profile/builder'
2
-
3
- p = ODRL::Profile::Builder.new(
4
- uri: 'https://example.org/myprofiles/germplasm_odrl_profile.ttl',
5
- title: "ODRL Profile for Germplasm resources",
6
- description: "There are some properties and comparisons that only make sense in the Germplasm expert domain",
7
- author: "Mark D Wilkinson",
8
- profile_class: "https://example.org/myprofiles/ontology#SeedOffer"
9
- )
10
-
11
- p.asset_relations << ODRL::Profile::AssetRelation.new(
12
- uri: "https://example.org/myprofiles/ontology#nagoya_permission",
13
- label: "Permission under Nagoya protocol",
14
- definition: "Permission is a special thing in the Nagoya protocol")
15
-
16
-
17
- p.party_functional_roles << ODRL::Profile::PartyFunction.new(
18
- uri: "https://example.org/myprofiles/ontology#nagoya_assigner",
19
- label: "Assigner with Nagoya authority to assign",
20
- definition: "Assigners have special responsibilities in the Nagoya protocol")
21
-
22
- p.actions << ODRL::Profile::Action.new(
23
- uri: "https://example.org/myprofiles/ontology#nagoya_propogate",
24
- label: "Plant and Harvest",
25
- definition: "the action of planting and harvesting the seed",
26
- included_in: ODRLV.use,
27
- implies: ODRLV.distribute)
28
-
29
-
30
- p.leftOperands << ODRL::Profile::LeftOperand.new(
31
- uri: "https://example.org/myprofiles/ontology#at_risk_species",
32
- label: "At Risk Species",
33
- definition: "A species that has been flagged as at-risk of extinction")
34
-
35
- p.rightOperands << ODRL::Profile::RightOperand.new(
36
- uri: "https://example.org/myprofiles/ontology#on_watchlist",
37
- label: "On Watchlist",
38
- definition: "A species whose risk of extinction is on a watchlist")
39
-
40
- p.operators << ODRL::Profile::Operator.new(
41
- uri: "https://example.org/myprofiles/ontology#within_risk_boundary",
42
- label: "Within Bounds",
43
- definition: "comparison of risk boundaries")
44
-
45
-
46
- p.build()
47
- puts p.serialize
1
+ require '../lib/odrl/profile/builder'
2
+
3
+ p = ODRL::Profile::Builder.new(
4
+ uri: "https://example.org/myprofiles/grp",
5
+ title: "ODRL Profile for Germplasm resources",
6
+ description: "There are some properties and comparisons that only make sense in the Germplasm expert domain",
7
+ authors: ["Mark D Wilkinson"],
8
+ version: 0.1,
9
+ license: "https://creativecommons.org/licenses/by/4.0/"
10
+ )
11
+
12
+ p.asset_relations << ODRL::Profile::AssetRelation.new(
13
+ uri: "https://example.org/myprofiles/grp#nagoya_permission",
14
+ label: "Permission under Nagoya protocol",
15
+ definition: "Permission is a special thing in the Nagoya protocol")
16
+
17
+
18
+ p.party_functional_roles << ODRL::Profile::PartyFunction.new(
19
+ uri: "https://example.org/myprofiles/grp#nagoya_assigner",
20
+ label: "Assigner with Nagoya authority to assign",
21
+ definition: "Assigners have special responsibilities in the Nagoya protocol")
22
+
23
+ p.actions << ODRL::Profile::Action.new(
24
+ uri: "https://example.org/myprofiles/grp#nagoya_propogate",
25
+ label: "Plant and Harvest",
26
+ definition: "the action of planting and harvesting the seed",
27
+ included_in: ODRLV.use,
28
+ implies: ODRLV.distribute)
29
+
30
+
31
+ p.leftOperands << ODRL::Profile::LeftOperand.new(
32
+ uri: "https://example.org/myprofiles/grp#at_risk_species",
33
+ label: "At Risk Species",
34
+ definition: "A species that has been flagged as at-risk of extinction")
35
+
36
+ p.rightOperands << ODRL::Profile::RightOperand.new(
37
+ uri: "https://example.org/myprofiles/grp#on_watchlist",
38
+ label: "On Watchlist",
39
+ definition: "A species whose risk of extinction is on a watchlist")
40
+
41
+ p.operators << ODRL::Profile::Operator.new(
42
+ uri: "https://example.org/myprofiles/grp#within_risk_boundary",
43
+ label: "Within Bounds",
44
+ definition: "comparison of risk boundaries")
45
+
46
+
47
+ p.build()
48
+ puts p.serialize