dbd_onto 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +3 -2
- data/Guardfile +1 -1
- data/HISTORY.txt +6 -0
- data/README.md +33 -29
- data/dbd_onto.gemspec +3 -3
- data/lib/dbd_onto/base.rb +1 -1
- data/lib/dbd_onto/context.rb +47 -0
- data/lib/dbd_onto/meta.rb +2 -13
- data/lib/dbd_onto/meta_context.rb +42 -0
- data/lib/dbd_onto/version.rb +1 -1
- data/lib/dbd_onto.rb +3 -3
- data/spec/lib/dbd_onto/{provenance_spec.rb → context_spec.rb} +43 -26
- data/spec/lib/dbd_onto/meta_context_spec.rb +28 -0
- data/spec/lib/dbd_onto/meta_spec.rb +5 -11
- data/spec/spec_helper.rb +4 -6
- data/spec/support/meta_provenance.rb +14 -0
- metadata +16 -12
- data/lib/dbd_onto/provenance.rb +0 -54
- data/lib/dbd_onto/provenance_methods.rb +0 -24
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35d5a01f7cfad54d12d69aa386c8b6224c350eba
|
4
|
+
data.tar.gz: 38f1e559e587785ce22a7004b39d409d50323540
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f46bec9c0b1ec2f1e1f17984258597dcc310fa9fb671b7c0a7394cdd83e4a6adde8157822b0d0276b5ae47cd0571d1a2d34d13b3dd675e2f86804967803350a
|
7
|
+
data.tar.gz: b8547fc8357c129249922621c3fe0c210836e5ed5c40671895c5ff15fb36e911f8c0a4293894df3d373dfa96fb0ba31b4a3499f25302e4bac792aa4638f1621b
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/Guardfile
CHANGED
data/HISTORY.txt
CHANGED
data/README.md
CHANGED
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
Ontologies for [Dbd].
|
4
4
|
|
5
|
-
First a limited
|
5
|
+
First a limited context ontology is constructed, because it is required for all facts. This context ontology also has a "meta" context itself (using the context predicates defined in itself, to bootstrap the system).
|
6
6
|
|
7
|
-
The
|
7
|
+
The context ontology uses one meta:defines_predicate attribute from a new Meta ontology. This is needed to describe the definition of predicates, since predicates cannot be the subject of Fact (in Dbd, a subject is an abstract UUID, not a URI, so a link is needed between a resource (all facts with the same subject) and the predicate (that is then the object for this fact that defines the predicate)).
|
8
8
|
|
9
9
|
[![Gem Version](https://badge.fury.io/rb/dbd_onto.png)](http://badge.fury.io/rb/dbd_onto)
|
10
10
|
[![Build Status](https://travis-ci.org/petervandenabeele/dbd_onto.png?branch=master)](http://travis-ci.org/petervandenabeele/dbd_onto)
|
@@ -24,35 +24,39 @@ Used by Dbd and applications that use Dbd.
|
|
24
24
|
The ontology is stored as a [Dbd]::Graph. Displaying it in short format:
|
25
25
|
|
26
26
|
```
|
27
|
-
dbd_onto $ irb
|
28
|
-
2.0.
|
27
|
+
/Users/peter_v/dbd_onto $ irb
|
28
|
+
2.0.0p247 :001 > require 'dbd_onto'
|
29
29
|
=> true
|
30
|
-
2.0.
|
31
|
-
[
|
32
|
-
[
|
33
|
-
[
|
34
|
-
[
|
35
|
-
[
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
30
|
+
2.0.0p247 :002 > DbdOnto::Meta.new.each {|f| puts f.short} ; nil
|
31
|
+
[ cont ] : bd5ae676 : context:visibility : public
|
32
|
+
[ cont ] : bd5ae676 : context:encryption : clear
|
33
|
+
[ cont ] : bd5ae676 : context:license : Copyright 2013 Peter Vandenabeele (http://vandenabeele.com), licensed under MIT
|
34
|
+
[ cont ] : bd5ae676 : dc:source : https://github.com/petervandenabeele/dbd/blob/d37360070e7f8e61a19c2bca210c881a15
|
35
|
+
[ cont ] : bd5ae676 : dc:creator : Peter Vandenabeele (@peter_v)
|
36
|
+
[ cont ] : bd5ae676 : dcterms:created : 2013-08-09 21:45:00 UTC
|
37
|
+
bd5ae676 : 8c20a99a : meta:defines_predicate : meta:defines_predicate
|
38
|
+
bd5ae676 : 8c20a99a : rdfs:label : Defines predicate
|
39
|
+
=> nil
|
40
|
+
2.0.0p247 :003 > DbdOnto::Context.new.each {|f| puts f.short} ; nil
|
41
|
+
[ cont ] : 6aac5473 : context:visibility : public
|
42
|
+
[ cont ] : 6aac5473 : context:encryption : clear
|
43
|
+
[ cont ] : 6aac5473 : context:license : Copyright 2013 Peter Vandenabeele (http://vandenabeele.com), licensed under MIT
|
44
|
+
[ cont ] : 6aac5473 : dc:source : https://github.com/petervandenabeele/dbd/blob/d37360070e7f8e61a19c2bca210c881a15
|
45
|
+
[ cont ] : 6aac5473 : dc:creator : Peter Vandenabeele (@peter_v)
|
46
|
+
[ cont ] : 6aac5473 : dcterms:created : 2013-08-09 21:45:00 UTC
|
47
|
+
6aac5473 : a2e3ed3f : meta:defines_predicate : context:visibility
|
48
|
+
6aac5473 : a2e3ed3f : rdfs:label : Visibility
|
49
|
+
6aac5473 : 57ff4dc0 : meta:defines_predicate : context:encryption
|
50
|
+
6aac5473 : 57ff4dc0 : rdfs:label : Encryption
|
51
|
+
6aac5473 : d3a1fcc9 : meta:defines_predicate : context:license
|
52
|
+
6aac5473 : d3a1fcc9 : rdfs:label : License
|
53
|
+
6aac5473 : aea4f895 : meta:defines_predicate : dc:source
|
54
|
+
6aac5473 : aea4f895 : rdfs:label : Source
|
55
|
+
6aac5473 : f60f60ba : meta:defines_predicate : dc:creator
|
56
|
+
6aac5473 : f60f60ba : rdfs:label : Creator
|
57
|
+
6aac5473 : 225c6fe5 : meta:defines_predicate : dcterms:created
|
58
|
+
6aac5473 : 225c6fe5 : rdfs:label : Created
|
46
59
|
=> nil
|
47
|
-
2.0.0-p195 :003 > DbdOnto::Meta.new.each {|f| puts f.short} ; nil
|
48
|
-
[ prov ] : b75f3b8c : prov:context : public
|
49
|
-
[ prov ] : b75f3b8c : prov:source : https://github.com/petervandenabeele/dbd_onto/blob/08adb5bf0e
|
50
|
-
[ prov ] : b75f3b8c : dcterms:creator : Peter Vandenabeele (@peter_v)
|
51
|
-
[ prov ] : b75f3b8c : dcterms:created : 2013-06-03 21:00:00 UTC
|
52
|
-
[ prov ] : b75f3b8c : prov:license : Copyright 2013 Peter Vandenabeele (http://vandenabeele.com),
|
53
|
-
b75f3b8c : bd07e072 : meta:defines_predicate : meta:defines_predicate
|
54
|
-
b75f3b8c : bd07e072 : rdfs:label : Defines predicate
|
55
|
-
=> nil
|
56
60
|
```
|
57
61
|
|
58
62
|
[Dbd]: https://github.com/petervandenabeele/dbd#readme
|
data/dbd_onto.gemspec
CHANGED
@@ -18,12 +18,12 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_development_dependency 'bundler', '>= 1.
|
21
|
+
spec.add_development_dependency 'bundler', '>= 1.3.5'
|
22
22
|
spec.add_development_dependency 'rake'
|
23
23
|
spec.add_development_dependency 'guard-rspec'
|
24
24
|
spec.add_development_dependency 'terminal-notifier-guard'
|
25
25
|
spec.add_development_dependency 'yard'
|
26
26
|
spec.add_runtime_dependency 'rdf', '~> 1.0.6'
|
27
|
-
spec.add_runtime_dependency 'ruby_peter_v', '>= 0.0.
|
28
|
-
spec.add_runtime_dependency 'dbd', '>= 0.0.
|
27
|
+
spec.add_runtime_dependency 'ruby_peter_v', '>= 0.0.11'
|
28
|
+
spec.add_runtime_dependency 'dbd', '>= 0.0.14'
|
29
29
|
end
|
data/lib/dbd_onto/base.rb
CHANGED
@@ -0,0 +1,47 @@
|
|
1
|
+
module DbdOnto
|
2
|
+
class Context < Base
|
3
|
+
|
4
|
+
CONTEXT_ATTRIBUTES = %w(visibility encryption license)
|
5
|
+
DC_ATTRIBUTES = %w(source creator)
|
6
|
+
DCTERMS_ATTRIBUTES = %w(created)
|
7
|
+
|
8
|
+
def initialize
|
9
|
+
super
|
10
|
+
self << meta_context
|
11
|
+
self << context_resources
|
12
|
+
self << dc_resources
|
13
|
+
self << dcterms_resources
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def context_resources
|
19
|
+
CONTEXT_ATTRIBUTES.map do |attribute|
|
20
|
+
resource = resource_with_meta_context
|
21
|
+
resource << fact_defines_predicate(:context, attribute)
|
22
|
+
resource << fact_label(attribute)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def dc_resources
|
27
|
+
DC_ATTRIBUTES.map do |attribute|
|
28
|
+
resource = resource_with_meta_context
|
29
|
+
resource << fact_defines_predicate(:dc, attribute)
|
30
|
+
resource << fact_label(attribute)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def dcterms_resources
|
35
|
+
DCTERMS_ATTRIBUTES.map do |attribute|
|
36
|
+
resource = resource_with_meta_context
|
37
|
+
resource << fact_defines_predicate(:dcterms, attribute)
|
38
|
+
resource << fact_label(attribute)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def fact_defines_predicate(prefix, attribute)
|
43
|
+
Dbd::Fact.new(predicate: 'meta:defines_predicate', object: "#{prefix}:#{attribute}")
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
47
|
+
end
|
data/lib/dbd_onto/meta.rb
CHANGED
@@ -5,26 +5,15 @@ module DbdOnto
|
|
5
5
|
|
6
6
|
def initialize
|
7
7
|
super
|
8
|
-
self <<
|
8
|
+
self << meta_context
|
9
9
|
self << meta_resources
|
10
10
|
end
|
11
11
|
|
12
12
|
private
|
13
13
|
|
14
|
-
def provenance_attributes
|
15
|
-
[
|
16
|
-
#[predicate, object]
|
17
|
-
['prov:context', 'public'],
|
18
|
-
['prov:source' , 'https://github.com/petervandenabeele/dbd_onto/blob/08adb5bf0ed5cd259ad4d31d9d8ebbbe230c66b1/lib/dbd_onto/provenance.rb'],
|
19
|
-
['dcterms:creator' , 'Peter Vandenabeele (@peter_v)'],
|
20
|
-
['dcterms:created', Time.new(2013,6,3,23,0,0,'+02:00').utc],
|
21
|
-
['prov:license', 'Copyright 2013 Peter Vandenabeele (http://vandenabeele.com), licensed under MIT license.']
|
22
|
-
]
|
23
|
-
end
|
24
|
-
|
25
14
|
def meta_resources
|
26
15
|
META_ATTRIBUTES.map do |attribute|
|
27
|
-
resource =
|
16
|
+
resource = resource_with_meta_context
|
28
17
|
resource << fact_defines_predicate_meta(attribute)
|
29
18
|
resource << fact_label(attribute)
|
30
19
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module DbdOnto
|
2
|
+
module MetaContext
|
3
|
+
|
4
|
+
def resource_with_meta_context
|
5
|
+
Dbd::Resource.new(context_subject: meta_context.subject)
|
6
|
+
end
|
7
|
+
|
8
|
+
def meta_context
|
9
|
+
# memoize to avoid making new_context on each call
|
10
|
+
@context_resource ||= new_context_resource
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def new_context_resource
|
16
|
+
Dbd::Context.new.tap do |_context|
|
17
|
+
context_attributes.each do |context_fact_data|
|
18
|
+
_context << context_fact(context_fact_data)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def context_fact(context_fact_data)
|
24
|
+
Dbd::ContextFact.new(
|
25
|
+
predicate: context_fact_data.first,
|
26
|
+
object: context_fact_data.last)
|
27
|
+
end
|
28
|
+
|
29
|
+
def context_attributes
|
30
|
+
[
|
31
|
+
#[predicate, object]
|
32
|
+
['context:visibility', 'public'],
|
33
|
+
['context:encryption', 'clear'],
|
34
|
+
['context:license', 'Copyright 2013 Peter Vandenabeele (http://vandenabeele.com), licensed under MIT license.'],
|
35
|
+
['dc:source' , 'https://github.com/petervandenabeele/dbd/blob/d37360070e7f8e61a19c2bca210c881a151ded75/docs/rationale.md'],
|
36
|
+
['dc:creator' , 'Peter Vandenabeele (@peter_v)'],
|
37
|
+
['dcterms:created', Time.new(2013,8,9,23,45,0,'+02:00').utc]
|
38
|
+
]
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
data/lib/dbd_onto/version.rb
CHANGED
data/lib/dbd_onto.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'dbd'
|
2
|
-
require 'dbd_onto/provenance_methods'
|
3
|
-
require 'dbd_onto/fact_methods'
|
4
2
|
require 'dbd_onto/version'
|
3
|
+
require 'dbd_onto/fact_methods'
|
4
|
+
require 'dbd_onto/meta_context'
|
5
5
|
require 'dbd_onto/base'
|
6
|
-
require 'dbd_onto/
|
6
|
+
require 'dbd_onto/context'
|
7
7
|
require 'dbd_onto/meta'
|
@@ -1,60 +1,77 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe DbdOnto::
|
3
|
+
describe DbdOnto::Context do
|
4
|
+
|
5
|
+
include Spec::Context
|
4
6
|
|
5
7
|
it "is a Dbd::Graph" do
|
6
8
|
subject.should be_a(Dbd::Graph)
|
7
9
|
end
|
8
10
|
|
9
|
-
it "all facts in the
|
11
|
+
it "all facts in the context ontology have the meta context as context" do
|
10
12
|
subject.all? do |fact|
|
11
|
-
fact.is_a?(Dbd::
|
12
|
-
|
13
|
+
fact.is_a?(Dbd::ContextFact) ||
|
14
|
+
check_context?(subject.by_subject(fact.context_subject))
|
13
15
|
end.should be_true
|
14
16
|
end
|
15
17
|
|
16
|
-
def check_provenance?(provenance_facts)
|
17
|
-
provenance_facts.detect {|p| p.predicate == 'prov:context' && p.object == 'public'} &&
|
18
|
-
provenance_facts.detect {|p| p.predicate == 'prov:source'} &&
|
19
|
-
provenance_facts.detect {|p| p.predicate == 'dcterms:creator'} &&
|
20
|
-
provenance_facts.detect {|p| p.predicate == 'dcterms:created'} &&
|
21
|
-
provenance_facts.detect {|p| p.predicate == 'prov:license'}
|
22
|
-
end
|
23
|
-
|
24
18
|
describe "properties include" do
|
25
19
|
|
26
|
-
let(:
|
20
|
+
let(:visibility_subject) do
|
27
21
|
subject.detect do |fact|
|
28
22
|
fact.predicate == 'meta:defines_predicate' &&
|
29
|
-
fact.object == '
|
23
|
+
fact.object == 'context:visibility'
|
24
|
+
end.subject
|
25
|
+
end
|
26
|
+
|
27
|
+
let(:encryption_subject) do
|
28
|
+
subject.detect do |fact|
|
29
|
+
fact.predicate == 'meta:defines_predicate' &&
|
30
|
+
fact.object == 'context:encryption'
|
30
31
|
end.subject
|
31
32
|
end
|
32
33
|
|
33
34
|
let(:source_subject) do
|
34
35
|
subject.detect do |fact|
|
35
36
|
fact.predicate == 'meta:defines_predicate' &&
|
36
|
-
fact.object == '
|
37
|
+
fact.object == 'dc:source'
|
37
38
|
end.subject
|
38
39
|
end
|
39
40
|
|
40
41
|
describe "prov:subject and prov:source" do
|
41
42
|
it "are different subjects" do
|
42
|
-
|
43
|
+
visibility_subject.should_not == source_subject
|
43
44
|
end
|
44
45
|
end
|
45
46
|
|
46
|
-
describe "
|
47
|
+
describe "context:visibility" do
|
47
48
|
|
48
|
-
let(:
|
49
|
+
let(:visibility_facts) { subject.by_subject(visibility_subject) }
|
49
50
|
|
50
|
-
it "defines the predicate
|
51
|
-
|
51
|
+
it "defines the predicate context:visibility" do
|
52
|
+
visibility_subject.should_not be_nil
|
52
53
|
end
|
53
54
|
|
54
55
|
it "has label Context" do
|
55
|
-
|
56
|
+
visibility_facts.detect do |fact|
|
57
|
+
fact.predicate == 'rdfs:label' &&
|
58
|
+
fact.object == 'Visibility'
|
59
|
+
end.should_not be_nil
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
describe "prov:encryption" do
|
64
|
+
|
65
|
+
let(:encryption_facts) { subject.by_subject(encryption_subject) }
|
66
|
+
|
67
|
+
it "defines the predicate prov:encryption" do
|
68
|
+
encryption_subject.should_not be_nil
|
69
|
+
end
|
70
|
+
|
71
|
+
it "has label Encryption" do
|
72
|
+
encryption_facts.detect do |fact|
|
56
73
|
fact.predicate == 'rdfs:label' &&
|
57
|
-
fact.object == '
|
74
|
+
fact.object == 'Encryption'
|
58
75
|
end.should_not be_nil
|
59
76
|
end
|
60
77
|
end
|
@@ -75,11 +92,11 @@ describe DbdOnto::Provenance do
|
|
75
92
|
end
|
76
93
|
end
|
77
94
|
|
78
|
-
describe "
|
95
|
+
describe "dc:creator" do
|
79
96
|
it "defines the predicate" do
|
80
97
|
subject.detect do |fact|
|
81
98
|
fact.predicate == 'meta:defines_predicate' &&
|
82
|
-
fact.object == '
|
99
|
+
fact.object == 'dc:creator'
|
83
100
|
end.should_not be_nil
|
84
101
|
end
|
85
102
|
end
|
@@ -93,11 +110,11 @@ describe DbdOnto::Provenance do
|
|
93
110
|
end
|
94
111
|
end
|
95
112
|
|
96
|
-
describe "
|
113
|
+
describe "context:license" do
|
97
114
|
it "defines the predicate" do
|
98
115
|
subject.detect do |fact|
|
99
116
|
fact.predicate == 'meta:defines_predicate' &&
|
100
|
-
fact.object == '
|
117
|
+
fact.object == 'context:license'
|
101
118
|
end.should_not be_nil
|
102
119
|
end
|
103
120
|
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module DbdOnto
|
4
|
+
describe MetaContext do
|
5
|
+
|
6
|
+
include Spec::Context
|
7
|
+
|
8
|
+
let(:meta_context) do
|
9
|
+
Object.new.tap do |_meta_context|
|
10
|
+
_meta_context.extend(described_class)
|
11
|
+
end.meta_context
|
12
|
+
end
|
13
|
+
|
14
|
+
it "is a Dbd::Context" do
|
15
|
+
meta_context.should be_a(Dbd::Context)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "all facts in the meta_context are context facts" do
|
19
|
+
meta_context.all? do |context_fact|
|
20
|
+
context_fact.should be_a(Dbd::ContextFact)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
it "the meta_context has all the needed entries" do
|
25
|
+
check_context?(meta_context).should be_true
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -2,25 +2,19 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe DbdOnto::Meta do
|
4
4
|
|
5
|
+
include Spec::Context
|
6
|
+
|
5
7
|
it "is a Dbd::Graph" do
|
6
8
|
subject.should be_a(Dbd::Graph)
|
7
9
|
end
|
8
10
|
|
9
|
-
it "all facts in the
|
11
|
+
it "all facts in the meta ontology have the meta context" do
|
10
12
|
subject.all? do |fact|
|
11
|
-
fact.is_a?(Dbd::
|
12
|
-
|
13
|
+
fact.is_a?(Dbd::ContextFact) ||
|
14
|
+
check_context?(subject.by_subject(fact.context_subject))
|
13
15
|
end.should be_true
|
14
16
|
end
|
15
17
|
|
16
|
-
def check_provenance?(provenance_facts)
|
17
|
-
provenance_facts.detect {|p| p.predicate == 'prov:context' && p.object == 'public'} &&
|
18
|
-
provenance_facts.detect {|p| p.predicate == 'prov:source'} &&
|
19
|
-
provenance_facts.detect {|p| p.predicate == 'dcterms:creator'} &&
|
20
|
-
provenance_facts.detect {|p| p.predicate == 'dcterms:created'} &&
|
21
|
-
provenance_facts.detect {|p| p.predicate == 'prov:license'}
|
22
|
-
end
|
23
|
-
|
24
18
|
describe "properties include" do
|
25
19
|
|
26
20
|
let(:meta_defines_predicate_subject) do
|
data/spec/spec_helper.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
require 'dbd_onto'
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
# load all support files
|
4
|
+
root = File.expand_path('../', __FILE__)
|
5
|
+
Dir[root + '/support/**/*.rb'].each {|f| require f}
|
5
6
|
|
6
|
-
|
7
|
-
# order dependency and want to debug it, you can fix the order by providing
|
8
|
-
# the seed, which is printed after each run.
|
9
|
-
# --seed 1234
|
7
|
+
RSpec.configure do |config|
|
10
8
|
config.order = 'random'
|
11
9
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Spec
|
2
|
+
module Context
|
3
|
+
|
4
|
+
def check_context?(context_resource)
|
5
|
+
context_resource.detect {|p| p.predicate == 'context:visibility' && p.object == 'public'} &&
|
6
|
+
context_resource.detect {|p| p.predicate == 'context:encryption' && p.object == 'clear'} &&
|
7
|
+
context_resource.detect {|p| p.predicate == 'context:license'} &&
|
8
|
+
context_resource.detect {|p| p.predicate == 'dc:source'} &&
|
9
|
+
context_resource.detect {|p| p.predicate == 'dc:creator'} &&
|
10
|
+
context_resource.detect {|p| p.predicate == 'dcterms:created'}
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dbd_onto
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Peter Vandenabeele
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.3.5
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.3.5
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,28 +100,28 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - '>='
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.0.
|
103
|
+
version: 0.0.11
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - '>='
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.0.
|
110
|
+
version: 0.0.11
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: dbd
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - '>='
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.0.
|
117
|
+
version: 0.0.14
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - '>='
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.0.
|
124
|
+
version: 0.0.14
|
125
125
|
description: Ontologies for Dbd
|
126
126
|
email:
|
127
127
|
- peter@vandenabeele.com
|
@@ -142,15 +142,17 @@ files:
|
|
142
142
|
- dbd_onto.gemspec
|
143
143
|
- lib/dbd_onto.rb
|
144
144
|
- lib/dbd_onto/base.rb
|
145
|
+
- lib/dbd_onto/context.rb
|
145
146
|
- lib/dbd_onto/fact_methods.rb
|
146
147
|
- lib/dbd_onto/meta.rb
|
147
|
-
- lib/dbd_onto/
|
148
|
-
- lib/dbd_onto/provenance_methods.rb
|
148
|
+
- lib/dbd_onto/meta_context.rb
|
149
149
|
- lib/dbd_onto/version.rb
|
150
150
|
- spec/lib/dbd_onto/base_spec.rb
|
151
|
+
- spec/lib/dbd_onto/context_spec.rb
|
152
|
+
- spec/lib/dbd_onto/meta_context_spec.rb
|
151
153
|
- spec/lib/dbd_onto/meta_spec.rb
|
152
|
-
- spec/lib/dbd_onto/provenance_spec.rb
|
153
154
|
- spec/spec_helper.rb
|
155
|
+
- spec/support/meta_provenance.rb
|
154
156
|
homepage: ''
|
155
157
|
licenses:
|
156
158
|
- MIT
|
@@ -177,7 +179,9 @@ specification_version: 4
|
|
177
179
|
summary: Ontologies for Dbd
|
178
180
|
test_files:
|
179
181
|
- spec/lib/dbd_onto/base_spec.rb
|
182
|
+
- spec/lib/dbd_onto/context_spec.rb
|
183
|
+
- spec/lib/dbd_onto/meta_context_spec.rb
|
180
184
|
- spec/lib/dbd_onto/meta_spec.rb
|
181
|
-
- spec/lib/dbd_onto/provenance_spec.rb
|
182
185
|
- spec/spec_helper.rb
|
186
|
+
- spec/support/meta_provenance.rb
|
183
187
|
has_rdoc:
|
data/lib/dbd_onto/provenance.rb
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
module DbdOnto
|
2
|
-
class Provenance < Base
|
3
|
-
|
4
|
-
PROV_ATTRIBUTES = %w(context source license)
|
5
|
-
DCTERMS_ATTRIBUTES = %w(creator created)
|
6
|
-
|
7
|
-
def initialize
|
8
|
-
super
|
9
|
-
self << provenance
|
10
|
-
self << prov_resources
|
11
|
-
self << dcterms_resources
|
12
|
-
end
|
13
|
-
|
14
|
-
private
|
15
|
-
|
16
|
-
def provenance_attributes
|
17
|
-
[
|
18
|
-
#[predicate, object]
|
19
|
-
['prov:context', 'public'],
|
20
|
-
['prov:source' , 'https://github.com/petervandenabeele/dbd/blob/d37360070e7f8e61a19c2bca210c881a151ded75/docs/rationale.md'],
|
21
|
-
['dcterms:creator' , 'Peter Vandenabeele (@peter_v)'],
|
22
|
-
['dcterms:created', Time.new(2013,5,26,23,30,0,'+02:00').utc],
|
23
|
-
['prov:license', 'Copyright 2013 Peter Vandenabeele (http://vandenabeele.com), licensed under MIT license.']
|
24
|
-
]
|
25
|
-
end
|
26
|
-
|
27
|
-
def prov_resources
|
28
|
-
PROV_ATTRIBUTES.map do |attribute|
|
29
|
-
resource = Dbd::Resource.new(provenance_subject: provenance.subject)
|
30
|
-
resource << fact_defines_predicate_prov(attribute)
|
31
|
-
resource << fact_label(attribute)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
# NOTE using dcterms:creator is not exact for now as the range
|
36
|
-
# should be a dcterms:Agent and it is a Literal here.
|
37
|
-
def dcterms_resources
|
38
|
-
DCTERMS_ATTRIBUTES.map do |attribute|
|
39
|
-
resource = Dbd::Resource.new(provenance_subject: provenance.subject)
|
40
|
-
resource << fact_defines_predicate_dcterms(attribute)
|
41
|
-
resource << fact_label(attribute)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
def fact_defines_predicate_prov(attribute)
|
46
|
-
Dbd::Fact.new(predicate: 'meta:defines_predicate', object: "prov:#{attribute}")
|
47
|
-
end
|
48
|
-
|
49
|
-
def fact_defines_predicate_dcterms(attribute)
|
50
|
-
Dbd::Fact.new(predicate: 'meta:defines_predicate', object: "dcterms:#{attribute}")
|
51
|
-
end
|
52
|
-
|
53
|
-
end
|
54
|
-
end
|
@@ -1,24 +0,0 @@
|
|
1
|
-
module DbdOnto
|
2
|
-
module ProvenanceMethods
|
3
|
-
|
4
|
-
def provenance
|
5
|
-
# memoize to avoid making new_provenance on each call
|
6
|
-
@provenance ||= new_provenance
|
7
|
-
end
|
8
|
-
|
9
|
-
def new_provenance
|
10
|
-
Dbd::ProvenanceResource.new.tap do |_provenance|
|
11
|
-
provenance_attributes.each do |provenance_fact_data|
|
12
|
-
_provenance << provenance_fact(provenance_fact_data)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
|
17
|
-
def provenance_fact(provenance_fact_data)
|
18
|
-
Dbd::ProvenanceFact.new(
|
19
|
-
predicate: provenance_fact_data.first,
|
20
|
-
object: provenance_fact_data.last)
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
end
|