tripod 0.0.10 → 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.
@@ -4,60 +4,40 @@ describe Tripod::Resource do
4
4
 
5
5
  describe "#initialize" do
6
6
 
7
- let(:person) do
8
- Person.new()
7
+ it "should raise an error if the URI is given as nil" do
8
+ lambda { Person.new(nil) }.should raise_error(Tripod::Errors::UriNotSet)
9
9
  end
10
10
 
11
- it "initialises an empty repo" do
12
- person.repository.class.should == RDF::Repository
13
- person.repository.should be_empty
14
- end
15
-
16
- context 'uri passed in' do
17
-
18
- context 'graph passed in' do
19
- let(:person) do
20
- Person.new('http://foobar', 'http://graph')
21
- end
22
-
23
- it 'sets the uri instance variable' do
24
- person.uri.should == RDF::URI.new('http://foobar')
25
- end
26
-
27
- it 'sets the graph_uri instance variable' do
28
- person.graph_uri.should == RDF::URI.new('http://graph')
29
- end
11
+ context 'with a URI' do
12
+ let(:person) do
13
+ Person.new('http://foobar')
30
14
  end
31
15
 
32
- context 'no graph passed in' do
33
- let(:person) do
34
- Person.new('http://foobar')
35
- end
16
+ it 'sets the uri instance variable' do
17
+ person.uri.should == RDF::URI.new('http://foobar')
18
+ end
36
19
 
37
- it 'sets the uri instance variable' do
38
- person.uri.should == RDF::URI.new('http://foobar')
39
- end
20
+ it 'sets the graph_uri instance variable from the class by default' do
21
+ person.graph_uri.should == RDF::URI.new('http://graph')
22
+ end
40
23
 
41
- it 'doesn\'t set the graph_uri instance variable' do
42
- person.graph_uri.should be_nil
43
- end
24
+ it "sets the rdf type from the class" do
25
+ person.rdf_type.should == 'http://person'
44
26
  end
45
27
 
28
+ it "initialises a repo" do
29
+ person.repository.class.should == RDF::Repository
30
+ end
46
31
  end
47
32
 
48
- context 'no uri or graph passed in' do
49
-
33
+ context 'with a URI and a graph URI' do
50
34
  let(:person) do
51
- Person.new
35
+ Person.new('http://foobar', 'http://foobar/graph')
52
36
  end
53
37
 
54
- it 'uri and graph should be nil' do
55
- person.uri.should be_nil
56
- person.graph_uri.should be_nil
38
+ it "overrides the default graph URI with what's given" do
39
+ person.graph_uri.should == RDF::URI.new('http://foobar/graph')
57
40
  end
58
41
  end
59
-
60
42
  end
61
-
62
-
63
43
  end
@@ -0,0 +1,36 @@
1
+ require "spec_helper"
2
+
3
+ describe Tripod::Serialization do
4
+
5
+ let(:person) do
6
+ p = Person.new('http://garry')
7
+ p.name = 'Garry'
8
+ p.age = 30
9
+ p
10
+ end
11
+
12
+ describe "#to_rdf" do
13
+ it "should dump the contents of the repository as rdfxml" do
14
+ person.to_rdf.should == person.repository.dump(:rdfxml)
15
+ end
16
+ end
17
+
18
+ describe "#to_ttl" do
19
+ it "should dump the contents of the repository with the n3 serializer" do
20
+ person.to_ttl.should == person.repository.dump(:n3)
21
+ end
22
+ end
23
+
24
+ describe "#to_nt" do
25
+ it "should dump the contents of the repository as ntriples" do
26
+ person.to_nt.should == person.repository.dump(:ntriples)
27
+ end
28
+ end
29
+
30
+ describe "#to_json" do
31
+ it "should dump the contents of the repository as ntriples" do
32
+ person.to_json.should == person.repository.dump(:jsonld)
33
+ end
34
+ end
35
+
36
+ end
@@ -7,7 +7,7 @@ describe Tripod::State do
7
7
  context "when calling new on the resource" do
8
8
 
9
9
  let(:person) do
10
- Person.new
10
+ Person.new('http://uri', 'http://graph')
11
11
  end
12
12
 
13
13
  it "returns true" do
@@ -54,7 +54,7 @@ describe Tripod::State do
54
54
  describe "destroyed?" do
55
55
 
56
56
  let(:person) do
57
- Person.new
57
+ Person.new('http://uri', 'http://graph')
58
58
  end
59
59
 
60
60
  context "when destroyed is true" do
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
6
6
  gem.email = ["ric@swirrl.com"]
7
7
  gem.description = %q{RDF ruby ORM}
8
8
  gem.summary = %q{Active Model style RDF ORM}
9
- gem.homepage = ""
9
+ gem.homepage = "http://github.com/Swirrl/tripod"
10
10
 
11
11
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
12
12
  gem.files = `git ls-files`.split("\n")
@@ -21,9 +21,10 @@ Gem::Specification.new do |gem|
21
21
  gem.add_dependency "rest-client"
22
22
  gem.add_dependency "activemodel", "~> 3.1"
23
23
  gem.add_dependency "equivalent-xml"
24
- gem.add_dependency "rdf", "~> 0.3"
24
+ gem.add_dependency "rdf", "~> 1.0"
25
25
  gem.add_dependency "rdf-rdfxml"
26
26
  gem.add_dependency "rdf-n3"
27
27
  gem.add_dependency "rdf-json"
28
+ gem.add_dependency "json-ld"
28
29
  gem.add_dependency "guid"
29
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tripod
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.10
4
+ version: '0.2'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-11 00:00:00.000000000 Z
12
+ date: 2013-02-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
16
- requirement: &70363544596700 !ruby/object:Gem::Requirement
16
+ requirement: &70356011065320 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70363544596700
24
+ version_requirements: *70356011065320
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: activemodel
27
- requirement: &70363544596060 !ruby/object:Gem::Requirement
27
+ requirement: &70356011064380 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '3.1'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70363544596060
35
+ version_requirements: *70356011064380
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: equivalent-xml
38
- requirement: &70363544595540 !ruby/object:Gem::Requirement
38
+ requirement: &70356011063560 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,21 +43,21 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70363544595540
46
+ version_requirements: *70356011063560
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rdf
49
- requirement: &70363544594880 !ruby/object:Gem::Requirement
49
+ requirement: &70356011079140 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
53
53
  - !ruby/object:Gem::Version
54
- version: '0.3'
54
+ version: '1.0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70363544594880
57
+ version_requirements: *70356011079140
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rdf-rdfxml
60
- requirement: &70363544594360 !ruby/object:Gem::Requirement
60
+ requirement: &70356011078020 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '0'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70363544594360
68
+ version_requirements: *70356011078020
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rdf-n3
71
- requirement: &70363544593760 !ruby/object:Gem::Requirement
71
+ requirement: &70356011076860 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70363544593760
79
+ version_requirements: *70356011076860
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rdf-json
82
- requirement: &70363544593260 !ruby/object:Gem::Requirement
82
+ requirement: &70356011076360 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,21 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *70363544593260
90
+ version_requirements: *70356011076360
91
+ - !ruby/object:Gem::Dependency
92
+ name: json-ld
93
+ requirement: &70356011075640 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - ! '>='
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ type: :runtime
100
+ prerelease: false
101
+ version_requirements: *70356011075640
91
102
  - !ruby/object:Gem::Dependency
92
103
  name: guid
93
- requirement: &70363544592760 !ruby/object:Gem::Requirement
104
+ requirement: &70356011074860 !ruby/object:Gem::Requirement
94
105
  none: false
95
106
  requirements:
96
107
  - - ! '>='
@@ -98,7 +109,7 @@ dependencies:
98
109
  version: '0'
99
110
  type: :runtime
100
111
  prerelease: false
101
- version_requirements: *70363544592760
112
+ version_requirements: *70356011074860
102
113
  description: RDF ruby ORM
103
114
  email:
104
115
  - ric@swirrl.com
@@ -115,6 +126,7 @@ files:
115
126
  - lib/tripod/attributes.rb
116
127
  - lib/tripod/components.rb
117
128
  - lib/tripod/errors.rb
129
+ - lib/tripod/errors/field_not_present.rb
118
130
  - lib/tripod/errors/resource_not_found.rb
119
131
  - lib/tripod/errors/uri_not_set.rb
120
132
  - lib/tripod/errors/validations.rb
@@ -124,8 +136,10 @@ files:
124
136
  - lib/tripod/fields/standard.rb
125
137
  - lib/tripod/finders.rb
126
138
  - lib/tripod/persistence.rb
139
+ - lib/tripod/predicates.rb
127
140
  - lib/tripod/repository.rb
128
141
  - lib/tripod/resource.rb
142
+ - lib/tripod/serialization.rb
129
143
  - lib/tripod/sparql_client.rb
130
144
  - lib/tripod/state.rb
131
145
  - lib/tripod/version.rb
@@ -135,11 +149,13 @@ files:
135
149
  - spec/tripod/fields_spec.rb
136
150
  - spec/tripod/finders_spec.rb
137
151
  - spec/tripod/persistence_spec.rb
152
+ - spec/tripod/predicates_spec.rb
138
153
  - spec/tripod/repository_spec.rb
139
154
  - spec/tripod/resource_spec.rb
155
+ - spec/tripod/serialization_spec.rb
140
156
  - spec/tripod/state_spec.rb
141
157
  - tripod.gemspec
142
- homepage: ''
158
+ homepage: http://github.com/Swirrl/tripod
143
159
  licenses: []
144
160
  post_install_message:
145
161
  rdoc_options: []
@@ -170,7 +186,9 @@ test_files:
170
186
  - spec/tripod/fields_spec.rb
171
187
  - spec/tripod/finders_spec.rb
172
188
  - spec/tripod/persistence_spec.rb
189
+ - spec/tripod/predicates_spec.rb
173
190
  - spec/tripod/repository_spec.rb
174
191
  - spec/tripod/resource_spec.rb
192
+ - spec/tripod/serialization_spec.rb
175
193
  - spec/tripod/state_spec.rb
176
194
  has_rdoc: