Skip to content

Commit 90e8d59

Browse files
authored
Merge pull request #6 from ld4l/at_0.10_upgrade
Update to AT 0.10.0 and RDF 2.0.2
2 parents 31d901c + eb24770 commit 90e8d59

13 files changed

+59
-67
lines changed

.travis.yml

+5-3
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ script: "bundle exec rspec spec"
44
sudo: false
55
cache: bundler
66
rvm:
7+
- 2.1
8+
- 2.2.2
79
- 2.2.4
8-
- 2.3.0
10+
- 2.3.1
911
- jruby-9.0.4.0
10-
- rbx-2
12+
- rbx
1113
matrix:
1214
allow_failures:
1315
- rvm: jruby-9.0.4.0
14-
- rvm: rbx-2
16+
- rvm: rbx

Gemfile

+2
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@ source 'https://rubygems.org'
22

33
gemspec
44

5+
gem 'activesupport', '< 5.0.0' if RUBY_VERSION =~ /2\.1\..*/
6+
gem 'pry-byebug' unless ENV["CI"]

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ Or install it yourself as:
2525

2626
$ gem install ld4l-foaf_rdf
2727

28+
## Primary Dependencies
29+
30+
* [ActiveTriples 0.10.0](https://github.com/ActiveTriples/ActiveTriples/tree/v0.10.0)
31+
* [RDF 2.0.2](https://github.com/ruby-rdf/rdf/tree/2.0.2)
2832

2933
## Usage
3034

ld4l-foaf_rdf.gemspec

+1-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
1313
spec.description = %q{LD4L FOAF RDF provides tools for modeling a person triples based on the FOAF ontology and persisting to a triplestore.}
1414
spec.homepage = "https://github.com/ld4l/foaf_rdf"
1515
spec.license = "APACHE2"
16-
spec.required_ruby_version = '>= 1.9.3'
16+
spec.required_ruby_version = '>= 2.1'
1717

1818
spec.files = `git ls-files -z`.split("\x0")
1919
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
@@ -22,17 +22,13 @@ Gem::Specification.new do |spec|
2222
spec.add_dependency('active-triples')
2323
spec.add_dependency('active_triples-local_name')
2424

25-
spec.add_development_dependency('pry')
26-
spec.add_development_dependency('pry-byebug')
2725
spec.add_development_dependency('rdoc')
2826
spec.add_development_dependency('rspec')
2927
spec.add_development_dependency('coveralls')
30-
spec.add_development_dependency('guard-rspec')
3128
spec.add_development_dependency('webmock')
3229

3330
spec.extra_rdoc_files = [
3431
"LICENSE.txt",
3532
"README.md"
3633
]
3734
end
38-

lib/ld4l/foaf_rdf.rb

+1-17
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,12 @@ def self.configure
2727

2828

2929
# RDF vocabularies
30-
# none - uses RDF::FOAF vocabulary
30+
# none - uses RDF::Vocab::FOAF vocabulary
3131

3232
# autoload classes
3333
autoload :Configuration, 'ld4l/foaf_rdf/configuration'
3434
autoload :Person, 'ld4l/foaf_rdf/person'
3535
autoload :Agent, 'ld4l/foaf_rdf/agent'
36-
37-
def self.class_from_string(class_name, container_class=Kernel)
38-
container_class = container_class.name if container_class.is_a? Module
39-
container_parts = container_class.split('::')
40-
(container_parts + class_name.split('::')).flatten.inject(Kernel) do |mod, class_name|
41-
if mod == Kernel
42-
Object.const_get(class_name)
43-
elsif mod.const_defined? class_name.to_sym
44-
mod.const_get(class_name)
45-
else
46-
container_parts.pop
47-
class_from_string(class_name, container_parts.join('::'))
48-
end
49-
end
50-
end
51-
5236
end
5337
end
5438

lib/ld4l/foaf_rdf/agent.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class Agent < ActiveTriples::Resource
55
class << self; attr_reader :localname_prefix end
66
@localname_prefix="a"
77

8-
configure :type => RDF::FOAF.Agent, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default
8+
configure :type => RDF::Vocab::FOAF.Agent, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default
99

1010
property :label, :predicate => RDF::RDFS.label
1111
end

lib/ld4l/foaf_rdf/person.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class Person < ActiveTriples::Resource
55
class << self; attr_reader :localname_prefix end
66
@localname_prefix="p"
77

8-
configure :type => RDF::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default
8+
configure :type => RDF::Vocab::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default
99
end
1010
end
1111
end

lib/ld4l/foaf_rdf/version.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module LD4L
22
module FoafRDF
3-
VERSION = "0.1.0"
3+
VERSION = "0.2.0"
44
end
55
end

spec/ld4l/foaf_rdf/agent_rdf_spec.rb

+18-16
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,22 @@
2121

2222
describe 'when changing subject' do
2323
before do
24-
subject << RDF::Statement.new(subject.rdf_subject, RDF::DC.title, RDF::Literal('Comet in Moominland'))
25-
subject << RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::DC.isPartOf, subject.rdf_subject)
26-
subject << RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::DC.relation, 'http://example.org/moomin_land')
24+
subject << RDF::Statement.new(subject.rdf_subject, RDF::Vocab::DC.title, RDF::Literal('Comet in Moominland'))
25+
subject << RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::Vocab::DC.isPartOf, subject.rdf_subject)
26+
subject << RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::Vocab::DC.relation, 'http://example.org/moomin_land')
2727
subject.set_subject! RDF::URI('http://example.org/moomin')
2828
end
2929

3030
it 'should update graph subjects' do
31-
expect(subject.has_statement?(RDF::Statement.new(subject.rdf_subject, RDF::DC.title, RDF::Literal('Comet in Moominland')))).to be true
31+
expect(subject.has_statement?(RDF::Statement.new(subject.rdf_subject, RDF::Vocab::DC.title, RDF::Literal('Comet in Moominland')))).to be true
3232
end
3333

3434
it 'should update graph objects' do
35-
expect(subject.has_statement?(RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::DC.isPartOf, subject.rdf_subject))).to be true
35+
expect(subject.has_statement?(RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::Vocab::DC.isPartOf, subject.rdf_subject))).to be true
3636
end
3737

3838
it 'should leave other uris alone' do
39-
expect(subject.has_statement?(RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::DC.relation, 'http://example.org/moomin_land'))).to be true
39+
expect(subject.has_statement?(RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::Vocab::DC.relation, 'http://example.org/moomin_land'))).to be true
4040
end
4141
end
4242

@@ -57,8 +57,8 @@
5757
# -------------------------------------------------
5858

5959
describe 'type' do
60-
it "should be an RDF::FOAF.Agent" do
61-
expect(subject.type.first.value).to eq RDF::FOAF.Agent.value
60+
it "should be an RDF::Vocab::FOAF.Agent" do
61+
expect(subject.type.first.value).to eq RDF::Vocab::FOAF.Agent.value
6262
end
6363
end
6464

@@ -139,7 +139,7 @@
139139

140140
describe '#destroy!' do
141141
before do
142-
subject << RDF::Statement(RDF::DC.LicenseDocument, RDF::DC.title, 'LICENSE')
142+
subject << RDF::Statement(RDF::Vocab::DC.LicenseDocument, RDF::Vocab::DC.title, 'LICENSE')
143143
end
144144

145145
subject { LD4L::FoafRDF::Agent.new('456')}
@@ -196,18 +196,18 @@
196196
before do
197197
class DummyPerson < ActiveTriples::Resource
198198
configure :type => RDF::URI('http://example.org/Person')
199-
property :foafname, :predicate => RDF::FOAF.name
200-
property :publications, :predicate => RDF::FOAF.publications, :class_name => 'DummyDocument'
201-
property :knows, :predicate => RDF::FOAF.knows, :class_name => DummyPerson
199+
property :foafname, :predicate => RDF::Vocab::FOAF.name
200+
property :publications, :predicate => RDF::Vocab::FOAF.publications, :class_name => 'DummyDocument'
201+
property :knows, :predicate => RDF::Vocab::FOAF.knows, :class_name => DummyPerson
202202
end
203203

204204
class DummyDocument < ActiveTriples::Resource
205205
configure :type => RDF::URI('http://example.org/Document')
206-
property :title, :predicate => RDF::DC.title
207-
property :creator, :predicate => RDF::DC.creator, :class_name => 'DummyPerson'
206+
property :title, :predicate => RDF::Vocab::DC.title
207+
property :creator, :predicate => RDF::Vocab::DC.creator, :class_name => 'DummyPerson'
208208
end
209209

210-
LD4L::FoafRDF::Agent.property :item, :predicate => RDF::DC.relation, :class_name => DummyDocument
210+
LD4L::FoafRDF::Agent.property :item, :predicate => RDF::Vocab::DC.relation, :class_name => DummyDocument
211211
end
212212

213213
subject { LD4L::FoafRDF::Agent.new }
@@ -260,8 +260,10 @@ class DummyDocument < ActiveTriples::Resource
260260
document1.creator = [person1, person2]
261261
document2.creator = person1
262262
person1.knows = person2
263+
person2.knows = person1
263264
subject.item = [document1]
264-
expect(subject.item.first.creator.first.knows.first.foafname).to eq ['Bob']
265+
expect(subject.item.first.creator.first.knows.first.foafname)
266+
.to satisfy { |names| ['Alice', 'Bob'].include? names.first }
265267
end
266268
end
267269
end

spec/ld4l/foaf_rdf/configuration_spec.rb

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
context "when base_uri is not configured" do
88
before do
99
class DummyPerson < LD4L::FoafRDF::Person
10-
configure :type => RDF::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default
10+
configure :type => RDF::Vocab::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default
1111
end
1212
end
1313
after do
@@ -24,7 +24,7 @@ class DummyPerson < LD4L::FoafRDF::Person
2424
config.base_uri = "http://localhost/test_slash/"
2525
end
2626
class DummyPerson < LD4L::FoafRDF::Person
27-
configure :type => RDF::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default
27+
configure :type => RDF::Vocab::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default
2828
end
2929
end
3030
after do
@@ -43,7 +43,7 @@ class DummyPerson < LD4L::FoafRDF::Person
4343
config.base_uri = "http://localhost/test_no_slash"
4444
end
4545
class DummyPerson < LD4L::FoafRDF::Person
46-
configure :type => RDF::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default
46+
configure :type => RDF::Vocab::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default
4747
end
4848
end
4949
after do
@@ -86,7 +86,7 @@ class DummyPerson < LD4L::FoafRDF::Person
8686
context "when minter is nil" do
8787
before do
8888
class DummyPerson < LD4L::FoafRDF::Person
89-
configure :type => RDF::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default
89+
configure :type => RDF::Vocab::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default
9090
end
9191
end
9292
after do
@@ -108,7 +108,7 @@ class DummyPerson < LD4L::FoafRDF::Person
108108
config.localname_minter = lambda { |prefix=""| prefix+'_configured_'+SecureRandom.uuid }
109109
end
110110
class DummyPerson < LD4L::FoafRDF::Person
111-
configure :type => RDF::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default
111+
configure :type => RDF::Vocab::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default
112112
end
113113
end
114114
after do

spec/ld4l/foaf_rdf/person_rdf_spec.rb

+18-16
Original file line numberDiff line numberDiff line change
@@ -22,22 +22,22 @@
2222

2323
describe 'when changing subject' do
2424
before do
25-
subject << RDF::Statement.new(subject.rdf_subject, RDF::DC.title, RDF::Literal('Comet in Moominland'))
26-
subject << RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::DC.isPartOf, subject.rdf_subject)
27-
subject << RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::DC.relation, 'http://example.org/moomin_land')
25+
subject << RDF::Statement.new(subject.rdf_subject, RDF::Vocab::DC.title, RDF::Literal('Comet in Moominland'))
26+
subject << RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::Vocab::DC.isPartOf, subject.rdf_subject)
27+
subject << RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::Vocab::DC.relation, 'http://example.org/moomin_land')
2828
subject.set_subject! RDF::URI('http://example.org/moomin')
2929
end
3030

3131
it 'should update graph subjects' do
32-
expect(subject.has_statement?(RDF::Statement.new(subject.rdf_subject, RDF::DC.title, RDF::Literal('Comet in Moominland')))).to be true
32+
expect(subject.has_statement?(RDF::Statement.new(subject.rdf_subject, RDF::Vocab::DC.title, RDF::Literal('Comet in Moominland')))).to be true
3333
end
3434

3535
it 'should update graph objects' do
36-
expect(subject.has_statement?(RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::DC.isPartOf, subject.rdf_subject))).to be true
36+
expect(subject.has_statement?(RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::Vocab::DC.isPartOf, subject.rdf_subject))).to be true
3737
end
3838

3939
it 'should leave other uris alone' do
40-
expect(subject.has_statement?(RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::DC.relation, 'http://example.org/moomin_land'))).to be true
40+
expect(subject.has_statement?(RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::Vocab::DC.relation, 'http://example.org/moomin_land'))).to be true
4141
end
4242
end
4343

@@ -58,8 +58,8 @@
5858
# -------------------------------------------------
5959

6060
describe 'type' do
61-
it "should be an RDF::FOAF.Person" do
62-
expect(subject.type.first.value).to eq RDF::FOAF.Person.value
61+
it "should be an RDF::Vocab::FOAF.Person" do
62+
expect(subject.type.first.value).to eq RDF::Vocab::FOAF.Person.value
6363
end
6464
end
6565

@@ -128,7 +128,7 @@
128128

129129
describe '#destroy!' do
130130
before do
131-
subject << RDF::Statement(RDF::DC.LicenseDocument, RDF::DC.title, 'LICENSE')
131+
subject << RDF::Statement(RDF::Vocab::DC.LicenseDocument, RDF::Vocab::DC.title, 'LICENSE')
132132
end
133133

134134
subject { LD4L::FoafRDF::Person.new('456')}
@@ -185,18 +185,18 @@
185185
before do
186186
class DummyPerson < ActiveTriples::Resource
187187
configure :type => RDF::URI('http://example.org/Person')
188-
property :foafname, :predicate => RDF::FOAF.name
189-
property :publications, :predicate => RDF::FOAF.publications, :class_name => 'DummyDocument'
190-
property :knows, :predicate => RDF::FOAF.knows, :class_name => DummyPerson
188+
property :foafname, :predicate => RDF::Vocab::FOAF.name
189+
property :publications, :predicate => RDF::Vocab::FOAF.publications, :class_name => 'DummyDocument'
190+
property :knows, :predicate => RDF::Vocab::FOAF.knows, :class_name => DummyPerson
191191
end
192192

193193
class DummyDocument < ActiveTriples::Resource
194194
configure :type => RDF::URI('http://example.org/Document')
195-
property :title, :predicate => RDF::DC.title
196-
property :creator, :predicate => RDF::DC.creator, :class_name => 'DummyPerson'
195+
property :title, :predicate => RDF::Vocab::DC.title
196+
property :creator, :predicate => RDF::Vocab::DC.creator, :class_name => 'DummyPerson'
197197
end
198198

199-
LD4L::FoafRDF::Person.property :item, :predicate => RDF::DC.relation, :class_name => DummyDocument
199+
LD4L::FoafRDF::Person.property :item, :predicate => RDF::Vocab::DC.relation, :class_name => DummyDocument
200200
end
201201

202202
subject { LD4L::FoafRDF::Person.new }
@@ -249,8 +249,10 @@ class DummyDocument < ActiveTriples::Resource
249249
document1.creator = [person1, person2]
250250
document2.creator = person1
251251
person1.knows = person2
252+
person2.knows = person1
252253
subject.item = [document1]
253-
expect(subject.item.first.creator.first.knows.first.foafname).to eq ['Bob']
254+
expect(subject.item.first.creator.first.knows.first.foafname)
255+
.to satisfy { |names| ['Alice', 'Bob'].include? names.first }
254256
end
255257
end
256258
end

spec/ld4l/foaf_rdf_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
config.localname_minter = lambda { |prefix=""| prefix+'_configured_'+SecureRandom.uuid }
1010
end
1111
class DummyPerson < LD4L::FoafRDF::Person
12-
configure :type => RDF::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default
12+
configure :type => RDF::Vocab::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default
1313
end
1414
end
1515
after do

spec/spec_helper.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Bundler.setup
66

77
require 'ld4l/foaf_rdf'
8-
require 'pry'
8+
require 'pry' unless ENV["CI"]
99

1010
Dir['./spec/support/**/*.rb'].each { |f| require f }
1111

0 commit comments

Comments
 (0)