dbd_onto 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 15cd696a44197409a3a17797ebf8bcbd93631d9c
4
- data.tar.gz: f001d417f57720e846231c268934346025d6fb64
3
+ metadata.gz: 35d5a01f7cfad54d12d69aa386c8b6224c350eba
4
+ data.tar.gz: 38f1e559e587785ce22a7004b39d409d50323540
5
5
  SHA512:
6
- metadata.gz: c1667901bdee7e801ec0fe148cd8abd015ab580c0ac563911ce0b1f0a46e86efcc2258db8f1ebc4bc86f4ebd1d2e30d54a9aea5482c123058784f1ab9345215b
7
- data.tar.gz: ce7659741dbcc13bb87463ebda947178a173e3fdc880e0155e812a256f04aa3e3d889899aa28f2dc4f3b7f0461ffd51e5557ac0c5599fcdd8d401b3f9e0a1907
6
+ metadata.gz: 0f46bec9c0b1ec2f1e1f17984258597dcc310fa9fb671b7c0a7394cdd83e4a6adde8157822b0d0276b5ae47cd0571d1a2d34d13b3dd675e2f86804967803350a
7
+ data.tar.gz: b8547fc8357c129249922621c3fe0c210836e5ed5c40671895c5ff15fb36e911f8c0a4293894df3d373dfa96fb0ba31b4a3499f25302e4bac792aa4638f1621b
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .idea
data/.travis.yml CHANGED
@@ -4,7 +4,8 @@ script: "bundle exec rspec spec"
4
4
  rvm:
5
5
  - 2.0.0
6
6
  - 1.9.3
7
- - 1.9.2
8
7
  - jruby-19mode
9
- - ruby-head
10
8
  - jruby-head
9
+ branches:
10
+ only:
11
+ - master
data/Guardfile CHANGED
@@ -1,4 +1,4 @@
1
- guard :rspec do
1
+ guard :rspec, :all_after_pass => true, :all_on_start => true do
2
2
  watch(%r{^spec/.+_spec\.rb$})
3
3
  watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
4
4
  watch('spec/spec_helper.rb') { "spec" }
data/HISTORY.txt CHANGED
@@ -3,3 +3,9 @@
3
3
 
4
4
  * A basic DbdOnto::Provenance ontology
5
5
  * bootstrapping with a self referential provenance ontology
6
+
7
+ 0.0.2 (2013-08-09)
8
+ =====
9
+
10
+ * Update to Dbd 0.0.14 (Provenance => Context)
11
+ * use dc:creator (instead of dcterms:creator that has a specific range)
data/README.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  Ontologies for [Dbd].
4
4
 
5
- First a limited Provenance ontology is constructed, because it is required for all facts. This provenance ontology also has a provenance resource (using the provenance predicates defined in itself, to bootstrap the system).
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 Provenance 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)).
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.0-p195 :001 > require 'dbd_onto'
27
+ /Users/peter_v/dbd_onto $ irb
28
+ 2.0.0p247 :001 > require 'dbd_onto'
29
29
  => true
30
- 2.0.0-p195 :002 > DbdOnto::Provenance.new.each {|f| puts f.short} ; nil
31
- [ prov ] : 44c2dd0f : prov:context : public
32
- [ prov ] : 44c2dd0f : prov:source : https://github.com/petervandenabeele/dbd/blob/d37360070e7f8e6
33
- [ prov ] : 44c2dd0f : dcterms:creator : Peter Vandenabeele (@peter_v)
34
- [ prov ] : 44c2dd0f : dcterms:created : 2013-05-26 21:30:00 UTC
35
- [ prov ] : 44c2dd0f : prov:license : Copyright 2013 Peter Vandenabeele (http://vandenabeele.com),
36
- 44c2dd0f : e350ae17 : meta:defines_predicate : prov:context
37
- 44c2dd0f : e350ae17 : rdfs:label : Context
38
- 44c2dd0f : 5256a1be : meta:defines_predicate : prov:source
39
- 44c2dd0f : 5256a1be : rdfs:label : Source
40
- 44c2dd0f : dd57068f : meta:defines_predicate : prov:license
41
- 44c2dd0f : dd57068f : rdfs:label : License
42
- 44c2dd0f : 5cddba10 : meta:defines_predicate : dcterms:creator
43
- 44c2dd0f : 5cddba10 : rdfs:label : Creator
44
- 44c2dd0f : ece58739 : meta:defines_predicate : dcterms:created
45
- 44c2dd0f : ece58739 : rdfs:label : Created
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.2.4'
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.8'
28
- spec.add_runtime_dependency 'dbd', '>= 0.0.5'
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
@@ -1,6 +1,6 @@
1
1
  module DbdOnto
2
2
  class Base < Dbd::Graph
3
- include ProvenanceMethods
3
+ include MetaContext
4
4
  include FactMethods
5
5
  end
6
6
  end
@@ -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 << provenance
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 = Dbd::Resource.new(provenance_subject: provenance.subject)
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
@@ -1,3 +1,3 @@
1
1
  module DbdOnto
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
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/provenance'
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::Provenance do
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 provenance ontology have a provenance with context public" do
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::ProvenanceFact) ||
12
- check_provenance?(subject.by_subject(fact.provenance_subject))
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(:context_subject) do
20
+ let(:visibility_subject) do
27
21
  subject.detect do |fact|
28
22
  fact.predicate == 'meta:defines_predicate' &&
29
- fact.object == 'prov:context'
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 == 'prov:source'
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
- context_subject.should_not == source_subject
43
+ visibility_subject.should_not == source_subject
43
44
  end
44
45
  end
45
46
 
46
- describe "prov:context" do
47
+ describe "context:visibility" do
47
48
 
48
- let(:context_facts) { subject.by_subject(context_subject) }
49
+ let(:visibility_facts) { subject.by_subject(visibility_subject) }
49
50
 
50
- it "defines the predicate prov:context" do
51
- context_subject.should_not be_nil
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
- context_facts.detect do |fact|
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 == 'Context'
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 "dcterms:creator" do
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 == 'dcterms:creator'
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 "prov:license" do
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 == 'prov:license'
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 provenance ontology have a provenance with context public" do
11
+ it "all facts in the meta ontology have the meta context" do
10
12
  subject.all? do |fact|
11
- fact.is_a?(Dbd::ProvenanceFact) ||
12
- check_provenance?(subject.by_subject(fact.provenance_subject))
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
- RSpec.configure do |config|
4
- config.treat_symbols_as_metadata_keys_with_true_values = true
3
+ # load all support files
4
+ root = File.expand_path('../', __FILE__)
5
+ Dir[root + '/support/**/*.rb'].each {|f| require f}
5
6
 
6
- # Run specs in random order to surface order dependencies. If you find an
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.1
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-06-03 00:00:00.000000000 Z
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.2.4
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.2.4
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.8
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.8
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.5
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.5
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/provenance.rb
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:
@@ -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