dbd_onto 0.0.3 → 0.0.4

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: 739a46718120265eb188bb28df0e65f3086acbf7
4
- data.tar.gz: 450eee39e90813d0d493de83ebcb471b2839859a
3
+ metadata.gz: 0382ccd88bbbf2f4c2e56ce56ff522a940408738
4
+ data.tar.gz: 08075be0484873e471667099ef3b28be6aeed485
5
5
  SHA512:
6
- metadata.gz: 86d4c7bd75bf84101ea630d6dde7da93d212dcaec68bc33a733c2b7062bf65a83008301cbe982849cac42b448868b8dfb7446c4d8adc59e4ed781d9531636454
7
- data.tar.gz: 888fc2cd8752a2b6495a41f7168c668442ff8eade3e87c9fa49439003443474bd52b098720914fd845d802bbfc26bc679c733dd78b443906607608bc23381827
6
+ metadata.gz: 0032c66e512c6218d4d41b7d9741dd8f12e15dd02515254403590a0bc0ee1d3b1169922cb6beed22dd8362badba2becb9c6f3062085ce1acf142f4a3ea7e717f
7
+ data.tar.gz: 29e4e706a4cd105b84774956ae49371f4058e04b96eecb4f3aad3ce90e6a8e142494b51548073fbcc8d7e66296a42a366747c2b4ce964ac140de3ad7c974df26
data/HISTORY.txt CHANGED
@@ -14,3 +14,9 @@
14
14
  =====
15
15
 
16
16
  * DbdOnto::Meta now has static data (constant id, subject, ...)
17
+
18
+ 0.0.4 (2013-09-94)
19
+ =====
20
+
21
+ * DbdOnto::Meta and Context are now fully static data
22
+ * simplification of code (using Dbd 0.0.19)
data/README.md CHANGED
@@ -17,14 +17,14 @@ Add this line to your application's Gemfile:
17
17
 
18
18
  ## Usage
19
19
 
20
- Used by Dbd and applications that use Dbd.
20
+ E.g. use the predicates defined in DbdOnto::Context to fully populate a Context.
21
21
 
22
22
  ## Examples
23
23
 
24
24
  The ontology is stored as a [Dbd]::Graph. Displaying it in short format:
25
25
 
26
26
  ```
27
- /Users/peter_v/dbd_onto $ irb
27
+ $ irb
28
28
  2.0.0p247 :001 > require 'dbd_onto'
29
29
  => true
30
30
  2.0.0p247 :002 > DbdOnto::Meta.new.each {|f| puts f.short} ; nil
@@ -37,25 +37,25 @@ The ontology is stored as a [Dbd]::Graph. Displaying it in short format:
37
37
  36c0b50f : 619e69d4 : meta:defines_predicate : meta:defines_predicate
38
38
  36c0b50f : 619e69d4 : rdfs:label : Defines predicate
39
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
40
+ 2.0.0p247 :003 > DbdOnto::Context.new.each {|f| puts f.short} ; nil
41
+ [ cont ] : 36c0b50f : context:visibility : public
42
+ [ cont ] : 36c0b50f : context:encryption : clear
43
+ [ cont ] : 36c0b50f : context:license : Copyright 2013 Peter Vandenabeele (http://vandenabeele.com), licensed under MIT
44
+ [ cont ] : 36c0b50f : dc:source : https://github.com/petervandenabeele/dbd/blob/d37360070e7f8e61a19c2bca210c881a15
45
+ [ cont ] : 36c0b50f : dc:creator : Peter Vandenabeele (@peter_v)
46
+ [ cont ] : 36c0b50f : dcterms:created : 2013-08-09 21:45:00 UTC
47
+ 36c0b50f : 03e72b0c : meta:defines_predicate : context:visibility
48
+ 36c0b50f : 03e72b0c : rdfs:label : Visibility
49
+ 36c0b50f : 735ae2a2 : meta:defines_predicate : context:encryption
50
+ 36c0b50f : 735ae2a2 : rdfs:label : Encryption
51
+ 36c0b50f : 5b2c73e5 : meta:defines_predicate : context:license
52
+ 36c0b50f : 5b2c73e5 : rdfs:label : License
53
+ 36c0b50f : ffc41d9c : meta:defines_predicate : dc:source
54
+ 36c0b50f : ffc41d9c : rdfs:label : Source
55
+ 36c0b50f : 2b5008b0 : meta:defines_predicate : dc:creator
56
+ 36c0b50f : 2b5008b0 : rdfs:label : Creator
57
+ 36c0b50f : 4aba46de : meta:defines_predicate : dcterms:created
58
+ 36c0b50f : 4aba46de : rdfs:label : Created
59
59
  => nil
60
60
  ```
61
61
 
data/dbd_onto.gemspec CHANGED
@@ -25,5 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency 'yard'
26
26
  spec.add_runtime_dependency 'rdf'
27
27
  spec.add_runtime_dependency 'ruby_peter_v', '>= 0.0.11'
28
- spec.add_runtime_dependency 'dbd', '>= 0.0.18'
28
+ spec.add_runtime_dependency 'dbd', '>= 0.0.19'
29
29
  end
data/lib/dbd_onto/base.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  module DbdOnto
2
2
  class Base < Dbd::Graph
3
3
  include MetaContext
4
- include FactMethods
5
4
  end
6
5
  end
@@ -1,47 +1,31 @@
1
1
  module DbdOnto
2
2
  class Context < Base
3
3
 
4
- CONTEXT_ATTRIBUTES = %w(visibility encryption license)
5
- DC_ATTRIBUTES = %w(source creator)
6
- DCTERMS_ATTRIBUTES = %w(created)
7
-
8
4
  def initialize
9
5
  super
10
6
  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
7
+ self << context_definition
24
8
  end
25
9
 
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
10
+ def context_definition
11
+ Dbd::Graph.new.from_CSV(context_definition_csv)
32
12
  end
33
13
 
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
14
+ def context_definition_csv
15
+ <<EOS
16
+ "2013-09-04 20:06:29.398680722 UTC","49a95413-64b6-4f86-ad44-caa7b03931f6","36c0b50f-834e-45f5-a911-e3f2b47fe4b9","03e72b0c-041f-4afd-aab4-520db49b1fb1","meta:defines_predicate","context:visibility"
17
+ "2013-09-04 20:06:29.398711938 UTC","1614f36e-5b64-43ef-9228-ef391dc2902a","36c0b50f-834e-45f5-a911-e3f2b47fe4b9","03e72b0c-041f-4afd-aab4-520db49b1fb1","rdfs:label","Visibility"
18
+ "2013-09-04 20:06:29.398728011 UTC","886738b0-fcf8-455e-a5a1-3f192b3cbbc1","36c0b50f-834e-45f5-a911-e3f2b47fe4b9","735ae2a2-ed1f-405a-808a-07117cd6888c","meta:defines_predicate","context:encryption"
19
+ "2013-09-04 20:06:29.398743950 UTC","b85ea90d-01ea-4fc6-81b1-24cdabe9a968","36c0b50f-834e-45f5-a911-e3f2b47fe4b9","735ae2a2-ed1f-405a-808a-07117cd6888c","rdfs:label","Encryption"
20
+ "2013-09-04 20:06:29.398758526 UTC","6d9b18f7-ed98-488e-8d67-bd830c51efbd","36c0b50f-834e-45f5-a911-e3f2b47fe4b9","5b2c73e5-490c-47e0-a014-592d8665ba58","meta:defines_predicate","context:license"
21
+ "2013-09-04 20:06:29.398775364 UTC","cd7d3d4a-d9c4-46e5-ba12-bc41938e50d4","36c0b50f-834e-45f5-a911-e3f2b47fe4b9","5b2c73e5-490c-47e0-a014-592d8665ba58","rdfs:label","License"
22
+ "2013-09-04 20:06:29.411179884 UTC","a95a1e01-5701-41fa-ae57-5a93fc4e530e","36c0b50f-834e-45f5-a911-e3f2b47fe4b9","ffc41d9c-ba51-4121-ae01-c2b04234b5f0","meta:defines_predicate","dc:source"
23
+ "2013-09-04 20:06:29.411232005 UTC","f063bd74-f767-47ed-a561-842eba382b79","36c0b50f-834e-45f5-a911-e3f2b47fe4b9","ffc41d9c-ba51-4121-ae01-c2b04234b5f0","rdfs:label","Source"
24
+ "2013-09-04 20:06:29.411249613 UTC","8ebc54af-bfd9-47ad-8e19-c04282720743","36c0b50f-834e-45f5-a911-e3f2b47fe4b9","2b5008b0-e12d-4aa2-8bb1-f9c20c36f8ef","meta:defines_predicate","dc:creator"
25
+ "2013-09-04 20:06:29.411264605 UTC","6d726d47-31cb-43a9-9e6d-b44401149500","36c0b50f-834e-45f5-a911-e3f2b47fe4b9","2b5008b0-e12d-4aa2-8bb1-f9c20c36f8ef","rdfs:label","Creator"
26
+ "2013-09-04 20:06:29.414653441 UTC","90b35dd7-baa3-49b7-a224-d67d3ccadb7a","36c0b50f-834e-45f5-a911-e3f2b47fe4b9","4aba46de-f35a-4754-913d-bdc4c926fc73","meta:defines_predicate","dcterms:created"
27
+ "2013-09-04 20:06:29.414677275 UTC","1ed030cf-260d-4380-bbbf-84f7c7e9d753","36c0b50f-834e-45f5-a911-e3f2b47fe4b9","4aba46de-f35a-4754-913d-bdc4c926fc73","rdfs:label","Created"
28
+ EOS
40
29
  end
41
-
42
- def fact_defines_predicate(prefix, attribute)
43
- Dbd::Fact.new(predicate: 'meta:defines_predicate', object: "#{prefix}:#{attribute}")
44
- end
45
-
46
30
  end
47
31
  end
data/lib/dbd_onto/meta.rb CHANGED
@@ -1,8 +1,6 @@
1
1
  module DbdOnto
2
2
  class Meta < Base
3
3
 
4
- META_ATTRIBUTES = %w(defines_predicate)
5
-
6
4
  def initialize
7
5
  super
8
6
  self << meta_context
@@ -12,22 +10,10 @@ module DbdOnto
12
10
  private
13
11
 
14
12
  def meta_resource
15
- graph = Dbd::Graph.new.from_CSV(meta_facts_csv)
16
- subject = graph.subjects.single
17
- meta_facts = graph.by_subject(subject)
18
- resource = resource_with_meta_context(subject: subject)
19
- add_meta_facts(resource, meta_facts)
20
- resource
21
- end
22
-
23
- def add_meta_facts(resource, meta_facts)
24
- # NOTE this can be cleaned-up when Dbd is Context << [] is fixed
25
- meta_facts.each do |meta_fact|
26
- resource << meta_fact
27
- end
13
+ Dbd::Graph.new.from_CSV(meta_resource_csv)
28
14
  end
29
15
 
30
- def meta_facts_csv
16
+ def meta_resource_csv
31
17
  <<EOS
32
18
  "2013-09-03 21:41:36.627034414 UTC","1e84b23b-edf0-49f5-8ad3-76182dcfa124","36c0b50f-834e-45f5-a911-e3f2b47fe4b9","619e69d4-6dad-4b14-bfce-8fd67d8e126c","meta:defines_predicate","meta:defines_predicate"
33
19
  "2013-09-03 21:41:36.627066056 UTC","96d595be-205d-4c3a-8724-35b46457f9ed","36c0b50f-834e-45f5-a911-e3f2b47fe4b9","619e69d4-6dad-4b14-bfce-8fd67d8e126c","rdfs:label","Defines predicate"
@@ -14,17 +14,7 @@ module DbdOnto
14
14
  def fixed_meta_context
15
15
  graph = Dbd::Graph.new.from_CSV(fixed_meta_context_csv)
16
16
  subject = graph.subjects.single
17
- context_facts = graph.by_subject(subject)
18
- Dbd::Context.new(subject: subject).tap do |context|
19
- add_context_facts(context, context_facts)
20
- end
21
- end
22
-
23
- def add_context_facts(context, context_facts)
24
- # NOTE this can be cleaned-up when Dbd is Context << [] is fixed
25
- context_facts.each do |context_fact|
26
- context << context_fact
27
- end
17
+ Dbd::Context.new(subject: subject) << graph
28
18
  end
29
19
 
30
20
  def fixed_meta_context_csv
@@ -1,3 +1,3 @@
1
1
  module DbdOnto
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/dbd_onto.rb CHANGED
@@ -1,6 +1,5 @@
1
1
  require 'dbd'
2
2
  require 'dbd_onto/version'
3
- require 'dbd_onto/fact_methods'
4
3
  require 'dbd_onto/meta_context'
5
4
  require 'dbd_onto/base'
6
5
  require 'dbd_onto/context'
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.3
4
+ version: 0.0.4
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-09-03 00:00:00.000000000 Z
11
+ date: 2013-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - '>='
116
116
  - !ruby/object:Gem::Version
117
- version: 0.0.18
117
+ version: 0.0.19
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.18
124
+ version: 0.0.19
125
125
  description: Ontologies for Dbd
126
126
  email:
127
127
  - peter@vandenabeele.com
@@ -143,7 +143,6 @@ files:
143
143
  - lib/dbd_onto.rb
144
144
  - lib/dbd_onto/base.rb
145
145
  - lib/dbd_onto/context.rb
146
- - lib/dbd_onto/fact_methods.rb
147
146
  - lib/dbd_onto/meta.rb
148
147
  - lib/dbd_onto/meta_context.rb
149
148
  - lib/dbd_onto/version.rb
@@ -1,10 +0,0 @@
1
- module DbdOnto
2
- module FactMethods
3
-
4
- def fact_label(attribute)
5
- # TODO in Dbd : turn predicate into a proper Predicate class
6
- Dbd::Fact.new(predicate: RDF::RDFS.label.qname.join(':'), object: attribute.gsub(/_/,' ').capitalize)
7
- end
8
-
9
- end
10
- end