From da349bc8ff6f0479363caa4f2b29bc466f400c58 Mon Sep 17 00:00:00 2001 From: "E. Lynette Rayle" Date: Fri, 29 Jul 2016 15:28:56 -0400 Subject: [PATCH] Update to AT 0.10.0 and RDF 2.0.2 --- .travis.yml | 8 +++--- Gemfile | 2 ++ README.md | 4 +++ ld4l-foaf_rdf.gemspec | 5 +--- lib/ld4l/foaf_rdf.rb | 2 +- lib/ld4l/foaf_rdf/agent.rb | 2 +- lib/ld4l/foaf_rdf/person.rb | 2 +- lib/ld4l/foaf_rdf/version.rb | 2 +- spec/ld4l/foaf_rdf/agent_rdf_spec.rb | 34 +++++++++++++----------- spec/ld4l/foaf_rdf/configuration_spec.rb | 10 +++---- spec/ld4l/foaf_rdf/person_rdf_spec.rb | 34 +++++++++++++----------- spec/ld4l/foaf_rdf_spec.rb | 2 +- 12 files changed, 58 insertions(+), 49 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5a3fe48..59caf09 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,11 +4,13 @@ script: "bundle exec rspec spec" sudo: false cache: bundler rvm: + - 2.1 + - 2.2.2 - 2.2.4 - - 2.3.0 + - 2.3.1 - jruby-9.0.4.0 - - rbx-2 + - rbx matrix: allow_failures: - rvm: jruby-9.0.4.0 - - rvm: rbx-2 + - rvm: rbx diff --git a/Gemfile b/Gemfile index 9e9ddcc..ead9055 100644 --- a/Gemfile +++ b/Gemfile @@ -2,3 +2,5 @@ source 'https://rubygems.org' gemspec +gem 'activesupport', '< 5.0.0' if RUBY_VERSION =~ /2\.1\..*/ +gem 'pry-byebug' unless ENV["CI"] \ No newline at end of file diff --git a/README.md b/README.md index 28d871a..eb446b8 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,10 @@ Or install it yourself as: $ gem install ld4l-foaf_rdf +## Primary Dependencies + +* [ActiveTriples 0.10.0](https://github.com/ActiveTriples/ActiveTriples/tree/v0.10.0) +* [RDF 2.0.2](https://github.com/ruby-rdf/rdf/tree/2.0.2) ## Usage diff --git a/ld4l-foaf_rdf.gemspec b/ld4l-foaf_rdf.gemspec index ceea037..a7f16df 100644 --- a/ld4l-foaf_rdf.gemspec +++ b/ld4l-foaf_rdf.gemspec @@ -13,7 +13,7 @@ Gem::Specification.new do |spec| spec.description = %q{LD4L FOAF RDF provides tools for modeling a person triples based on the FOAF ontology and persisting to a triplestore.} spec.homepage = "https://github.com/ld4l/foaf_rdf" spec.license = "APACHE2" - spec.required_ruby_version = '>= 1.9.3' + spec.required_ruby_version = '>= 2.1' spec.files = `git ls-files -z`.split("\x0") spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) @@ -22,12 +22,9 @@ Gem::Specification.new do |spec| spec.add_dependency('active-triples') spec.add_dependency('active_triples-local_name') - spec.add_development_dependency('pry') - spec.add_development_dependency('pry-byebug') spec.add_development_dependency('rdoc') spec.add_development_dependency('rspec') spec.add_development_dependency('coveralls') - spec.add_development_dependency('guard-rspec') spec.add_development_dependency('webmock') spec.extra_rdoc_files = [ diff --git a/lib/ld4l/foaf_rdf.rb b/lib/ld4l/foaf_rdf.rb index 3f06b01..a0b53ec 100644 --- a/lib/ld4l/foaf_rdf.rb +++ b/lib/ld4l/foaf_rdf.rb @@ -27,7 +27,7 @@ def self.configure # RDF vocabularies - # none - uses RDF::FOAF vocabulary + # none - uses RDF::Vocab::FOAF vocabulary # autoload classes autoload :Configuration, 'ld4l/foaf_rdf/configuration' diff --git a/lib/ld4l/foaf_rdf/agent.rb b/lib/ld4l/foaf_rdf/agent.rb index cd031ca..b364310 100644 --- a/lib/ld4l/foaf_rdf/agent.rb +++ b/lib/ld4l/foaf_rdf/agent.rb @@ -5,7 +5,7 @@ class Agent < ActiveTriples::Resource class << self; attr_reader :localname_prefix end @localname_prefix="a" - configure :type => RDF::FOAF.Agent, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default + configure :type => RDF::Vocab::FOAF.Agent, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default property :label, :predicate => RDF::RDFS.label end diff --git a/lib/ld4l/foaf_rdf/person.rb b/lib/ld4l/foaf_rdf/person.rb index 3f41b93..3001526 100644 --- a/lib/ld4l/foaf_rdf/person.rb +++ b/lib/ld4l/foaf_rdf/person.rb @@ -5,7 +5,7 @@ class Person < ActiveTriples::Resource class << self; attr_reader :localname_prefix end @localname_prefix="p" - configure :type => RDF::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default + configure :type => RDF::Vocab::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default end end end diff --git a/lib/ld4l/foaf_rdf/version.rb b/lib/ld4l/foaf_rdf/version.rb index cbbd105..95d1cd8 100644 --- a/lib/ld4l/foaf_rdf/version.rb +++ b/lib/ld4l/foaf_rdf/version.rb @@ -1,5 +1,5 @@ module LD4L module FoafRDF - VERSION = "0.1.0" + VERSION = "0.2.0" end end diff --git a/spec/ld4l/foaf_rdf/agent_rdf_spec.rb b/spec/ld4l/foaf_rdf/agent_rdf_spec.rb index 904c56a..623ef72 100644 --- a/spec/ld4l/foaf_rdf/agent_rdf_spec.rb +++ b/spec/ld4l/foaf_rdf/agent_rdf_spec.rb @@ -21,22 +21,22 @@ describe 'when changing subject' do before do - subject << RDF::Statement.new(subject.rdf_subject, RDF::DC.title, RDF::Literal('Comet in Moominland')) - subject << RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::DC.isPartOf, subject.rdf_subject) - subject << RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::DC.relation, 'http://example.org/moomin_land') + subject << RDF::Statement.new(subject.rdf_subject, RDF::Vocab::DC.title, RDF::Literal('Comet in Moominland')) + subject << RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::Vocab::DC.isPartOf, subject.rdf_subject) + subject << RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::Vocab::DC.relation, 'http://example.org/moomin_land') subject.set_subject! RDF::URI('http://example.org/moomin') end it 'should update graph subjects' do - expect(subject.has_statement?(RDF::Statement.new(subject.rdf_subject, RDF::DC.title, RDF::Literal('Comet in Moominland')))).to be true + expect(subject.has_statement?(RDF::Statement.new(subject.rdf_subject, RDF::Vocab::DC.title, RDF::Literal('Comet in Moominland')))).to be true end it 'should update graph objects' do - expect(subject.has_statement?(RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::DC.isPartOf, subject.rdf_subject))).to be true + expect(subject.has_statement?(RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::Vocab::DC.isPartOf, subject.rdf_subject))).to be true end it 'should leave other uris alone' do - 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 + 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 end end @@ -57,8 +57,8 @@ # ------------------------------------------------- describe 'type' do - it "should be an RDF::FOAF.Agent" do - expect(subject.type.first.value).to eq RDF::FOAF.Agent.value + it "should be an RDF::Vocab::FOAF.Agent" do + expect(subject.type.first.value).to eq RDF::Vocab::FOAF.Agent.value end end @@ -139,7 +139,7 @@ describe '#destroy!' do before do - subject << RDF::Statement(RDF::DC.LicenseDocument, RDF::DC.title, 'LICENSE') + subject << RDF::Statement(RDF::Vocab::DC.LicenseDocument, RDF::Vocab::DC.title, 'LICENSE') end subject { LD4L::FoafRDF::Agent.new('456')} @@ -196,18 +196,18 @@ before do class DummyPerson < ActiveTriples::Resource configure :type => RDF::URI('http://example.org/Person') - property :foafname, :predicate => RDF::FOAF.name - property :publications, :predicate => RDF::FOAF.publications, :class_name => 'DummyDocument' - property :knows, :predicate => RDF::FOAF.knows, :class_name => DummyPerson + property :foafname, :predicate => RDF::Vocab::FOAF.name + property :publications, :predicate => RDF::Vocab::FOAF.publications, :class_name => 'DummyDocument' + property :knows, :predicate => RDF::Vocab::FOAF.knows, :class_name => DummyPerson end class DummyDocument < ActiveTriples::Resource configure :type => RDF::URI('http://example.org/Document') - property :title, :predicate => RDF::DC.title - property :creator, :predicate => RDF::DC.creator, :class_name => 'DummyPerson' + property :title, :predicate => RDF::Vocab::DC.title + property :creator, :predicate => RDF::Vocab::DC.creator, :class_name => 'DummyPerson' end - LD4L::FoafRDF::Agent.property :item, :predicate => RDF::DC.relation, :class_name => DummyDocument + LD4L::FoafRDF::Agent.property :item, :predicate => RDF::Vocab::DC.relation, :class_name => DummyDocument end subject { LD4L::FoafRDF::Agent.new } @@ -260,8 +260,10 @@ class DummyDocument < ActiveTriples::Resource document1.creator = [person1, person2] document2.creator = person1 person1.knows = person2 + person2.knows = person1 subject.item = [document1] - expect(subject.item.first.creator.first.knows.first.foafname).to eq ['Bob'] + expect(subject.item.first.creator.first.knows.first.foafname) + .to satisfy { |names| ['Alice', 'Bob'].include? names.first } end end end diff --git a/spec/ld4l/foaf_rdf/configuration_spec.rb b/spec/ld4l/foaf_rdf/configuration_spec.rb index 04b71df..f00c1c7 100644 --- a/spec/ld4l/foaf_rdf/configuration_spec.rb +++ b/spec/ld4l/foaf_rdf/configuration_spec.rb @@ -7,7 +7,7 @@ context "when base_uri is not configured" do before do class DummyPerson < LD4L::FoafRDF::Person - configure :type => RDF::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default + configure :type => RDF::Vocab::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default end end after do @@ -24,7 +24,7 @@ class DummyPerson < LD4L::FoafRDF::Person config.base_uri = "http://localhost/test_slash/" end class DummyPerson < LD4L::FoafRDF::Person - configure :type => RDF::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default + configure :type => RDF::Vocab::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default end end after do @@ -43,7 +43,7 @@ class DummyPerson < LD4L::FoafRDF::Person config.base_uri = "http://localhost/test_no_slash" end class DummyPerson < LD4L::FoafRDF::Person - configure :type => RDF::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default + configure :type => RDF::Vocab::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default end end after do @@ -86,7 +86,7 @@ class DummyPerson < LD4L::FoafRDF::Person context "when minter is nil" do before do class DummyPerson < LD4L::FoafRDF::Person - configure :type => RDF::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default + configure :type => RDF::Vocab::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default end end after do @@ -108,7 +108,7 @@ class DummyPerson < LD4L::FoafRDF::Person config.localname_minter = lambda { |prefix=""| prefix+'_configured_'+SecureRandom.uuid } end class DummyPerson < LD4L::FoafRDF::Person - configure :type => RDF::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default + configure :type => RDF::Vocab::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default end end after do diff --git a/spec/ld4l/foaf_rdf/person_rdf_spec.rb b/spec/ld4l/foaf_rdf/person_rdf_spec.rb index 2f0d74f..ee6eabe 100644 --- a/spec/ld4l/foaf_rdf/person_rdf_spec.rb +++ b/spec/ld4l/foaf_rdf/person_rdf_spec.rb @@ -22,22 +22,22 @@ describe 'when changing subject' do before do - subject << RDF::Statement.new(subject.rdf_subject, RDF::DC.title, RDF::Literal('Comet in Moominland')) - subject << RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::DC.isPartOf, subject.rdf_subject) - subject << RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::DC.relation, 'http://example.org/moomin_land') + subject << RDF::Statement.new(subject.rdf_subject, RDF::Vocab::DC.title, RDF::Literal('Comet in Moominland')) + subject << RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::Vocab::DC.isPartOf, subject.rdf_subject) + subject << RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::Vocab::DC.relation, 'http://example.org/moomin_land') subject.set_subject! RDF::URI('http://example.org/moomin') end it 'should update graph subjects' do - expect(subject.has_statement?(RDF::Statement.new(subject.rdf_subject, RDF::DC.title, RDF::Literal('Comet in Moominland')))).to be true + expect(subject.has_statement?(RDF::Statement.new(subject.rdf_subject, RDF::Vocab::DC.title, RDF::Literal('Comet in Moominland')))).to be true end it 'should update graph objects' do - expect(subject.has_statement?(RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::DC.isPartOf, subject.rdf_subject))).to be true + expect(subject.has_statement?(RDF::Statement.new(RDF::URI('http://example.org/moomin_comics'), RDF::Vocab::DC.isPartOf, subject.rdf_subject))).to be true end it 'should leave other uris alone' do - 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 + 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 end end @@ -58,8 +58,8 @@ # ------------------------------------------------- describe 'type' do - it "should be an RDF::FOAF.Person" do - expect(subject.type.first.value).to eq RDF::FOAF.Person.value + it "should be an RDF::Vocab::FOAF.Person" do + expect(subject.type.first.value).to eq RDF::Vocab::FOAF.Person.value end end @@ -128,7 +128,7 @@ describe '#destroy!' do before do - subject << RDF::Statement(RDF::DC.LicenseDocument, RDF::DC.title, 'LICENSE') + subject << RDF::Statement(RDF::Vocab::DC.LicenseDocument, RDF::Vocab::DC.title, 'LICENSE') end subject { LD4L::FoafRDF::Person.new('456')} @@ -185,18 +185,18 @@ before do class DummyPerson < ActiveTriples::Resource configure :type => RDF::URI('http://example.org/Person') - property :foafname, :predicate => RDF::FOAF.name - property :publications, :predicate => RDF::FOAF.publications, :class_name => 'DummyDocument' - property :knows, :predicate => RDF::FOAF.knows, :class_name => DummyPerson + property :foafname, :predicate => RDF::Vocab::FOAF.name + property :publications, :predicate => RDF::Vocab::FOAF.publications, :class_name => 'DummyDocument' + property :knows, :predicate => RDF::Vocab::FOAF.knows, :class_name => DummyPerson end class DummyDocument < ActiveTriples::Resource configure :type => RDF::URI('http://example.org/Document') - property :title, :predicate => RDF::DC.title - property :creator, :predicate => RDF::DC.creator, :class_name => 'DummyPerson' + property :title, :predicate => RDF::Vocab::DC.title + property :creator, :predicate => RDF::Vocab::DC.creator, :class_name => 'DummyPerson' end - LD4L::FoafRDF::Person.property :item, :predicate => RDF::DC.relation, :class_name => DummyDocument + LD4L::FoafRDF::Person.property :item, :predicate => RDF::Vocab::DC.relation, :class_name => DummyDocument end subject { LD4L::FoafRDF::Person.new } @@ -249,8 +249,10 @@ class DummyDocument < ActiveTriples::Resource document1.creator = [person1, person2] document2.creator = person1 person1.knows = person2 + person2.knows = person1 subject.item = [document1] - expect(subject.item.first.creator.first.knows.first.foafname).to eq ['Bob'] + expect(subject.item.first.creator.first.knows.first.foafname) + .to satisfy { |names| ['Alice', 'Bob'].include? names.first } end end end diff --git a/spec/ld4l/foaf_rdf_spec.rb b/spec/ld4l/foaf_rdf_spec.rb index 7f01420..fdcfa9d 100644 --- a/spec/ld4l/foaf_rdf_spec.rb +++ b/spec/ld4l/foaf_rdf_spec.rb @@ -9,7 +9,7 @@ config.localname_minter = lambda { |prefix=""| prefix+'_configured_'+SecureRandom.uuid } end class DummyPerson < LD4L::FoafRDF::Person - configure :type => RDF::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default + configure :type => RDF::Vocab::FOAF.Person, :base_uri => LD4L::FoafRDF.configuration.base_uri, :repository => :default end end after do