Skip to content

Update to ActiveTriples 0.10.0 and RDF 2.0.2 #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ source 'https://rubygems.org'

gemspec

gem 'active-triples', :github => 'ActiveTriples/ActiveTriples', :branch => 'fix206_exclude_othersubj_preds'
gem 'activesupport', '< 5.0.0' if RUBY_VERSION =~ /2\.1\..*/
gem 'pry-byebug' unless ENV["CI"]
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ Or install it yourself as:
$ gem install ld4l-ore_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

**Caveat:** This gem is part of the LD4L Project and is being used in that context. There is no guarantee that the
Expand Down Expand Up @@ -167,7 +172,7 @@ aggregation_uris = LD4L::OreRDF::FindAggregations.call

# Find all and return title and description
aggregation_properties = LD4L::OreRDF::FindAggregations.call(
:properties => { :title => RDF::DC.title, :description => RDF::DC.description } )
:properties => { :title => RDF::Vocab::DC.title, :description => RDF::Vocab::DC.description } )

```

Expand Down
8 changes: 2 additions & 6 deletions ld4l-ore_rdf.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,21 @@ Gem::Specification.new do |spec|
spec.description = %q{LD4L ORE RDF provides tools for modeling list triples based on the ORE ontology and persisting to a triplestore.}
spec.homepage = "https://github.com/ld4l/ore_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)/})

spec.add_dependency('rdf', '= 1.99.0')

spec.add_dependency('rdf')
spec.add_dependency('active-triples')
spec.add_dependency('active_triples-local_name')
spec.add_dependency('active_triples-solrizer')
spec.add_dependency('ld4l-foaf_rdf')
spec.add_dependency('doubly_linked_list')

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 = [
Expand Down
9 changes: 0 additions & 9 deletions lib/ld4l/ore_rdf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
require 'doubly_linked_list'
require 'ld4l/foaf_rdf'
require 'ld4l/ore_rdf/version'
require 'ld4l/ore_rdf/vocab/ore'
require 'ld4l/ore_rdf/vocab/iana'
require 'ld4l/ore_rdf/vocab/dcterms'

module LD4L
module OreRDF
Expand All @@ -31,12 +28,6 @@ def self.configure
end


# RDF vocabularies
autoload :DCTERMS, 'ld4l/ore_rdf/vocab/dcterms'
autoload :IANA, 'ld4l/ore_rdf/vocab/iana'
autoload :ORE, 'ld4l/ore_rdf/vocab/ore'


# autoload classes
autoload :Configuration, 'ld4l/ore_rdf/configuration'

Expand Down
14 changes: 7 additions & 7 deletions lib/ld4l/ore_rdf/models/aggregation_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,29 @@ class << self; attr_reader :localname_prefix end
# TODO DOWNSIDE: items and aggregators could get out of sync. Then which is right? Could be a problem with the first option too.


configure :type => RDFVocabularies::ORE.Aggregation, :base_uri => LD4L::OreRDF.configuration.base_uri, :repository => :default
configure :type => RDF::Vocab::ORE.Aggregation, :base_uri => LD4L::OreRDF.configuration.base_uri, :repository => :default

# extended properties for LD4L implementation
property :title, :predicate => RDF::DC.title do |index|
property :title, :predicate => RDF::Vocab::DC.title do |index|
index.data_type = :text
index.as :indexed, :sortable
end
property :description, :predicate => RDF::DC.description do |index|
property :description, :predicate => RDF::Vocab::DC.description do |index|
index.data_type = :text
index.as :indexed
end
property :owner, :predicate => RDFVocabularies::DCTERMS.creator, :class_name => LD4L::FoafRDF::Person do |index|
property :owner, :predicate => RDF::Vocab::DC.creator, :class_name => LD4L::FoafRDF::Person do |index|
index.data_type = :string
index.as :stored, :indexed
end

# properties from ORE.Aggregation
property :aggregates, :predicate => RDFVocabularies::ORE.aggregates, :cast => false do |index|
property :aggregates, :predicate => RDF::Vocab::ORE.aggregates, :cast => false do |index|
index.data_type = :text
index.as :stored, :indexed, :multiValued
end
property :first_proxy_, :predicate => RDFVocabularies::IANA.first, :class_name => LD4L::OreRDF::ProxyResource
property :last_proxy_, :predicate => RDFVocabularies::IANA.last, :class_name => LD4L::OreRDF::ProxyResource
property :first_proxy_, :predicate => RDF::Vocab::IANA.first, :class_name => LD4L::OreRDF::ProxyResource
property :last_proxy_, :predicate => RDF::Vocab::IANA.last, :class_name => LD4L::OreRDF::ProxyResource


def first_proxy= value
Expand Down
16 changes: 8 additions & 8 deletions lib/ld4l/ore_rdf/models/proxy_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ class << self; attr_reader :localname_prefix end
@localname_prefix="px"

# configure :base_uri => LD4L::OreRDF.configuration.base_uri, repository => :default
configure :type => RDFVocabularies::ORE.Proxy, :base_uri => LD4L::OreRDF.configuration.base_uri, :repository => :default
configure :type => RDF::Vocab::ORE.Proxy, :base_uri => LD4L::OreRDF.configuration.base_uri, :repository => :default

property :proxy_for_, :predicate => RDFVocabularies::ORE.proxyFor, :cast => false
property :proxy_in_, :predicate => RDFVocabularies::ORE.proxyIn, :class_name => LD4L::OreRDF::AggregationResource
property :next_proxy_, :predicate => RDFVocabularies::IANA.next, :class_name => LD4L::OreRDF::ProxyResource
property :prev_proxy_, :predicate => RDFVocabularies::IANA.prev, :class_name => LD4L::OreRDF::ProxyResource
property :contributor, :predicate => RDF::DC.contributor, :class_name => LD4L::FoafRDF::Person # TODO User who added this item to the Aggregation (default=Aggregation's owner)
property :proxy_for_, :predicate => RDF::Vocab::ORE.proxyFor, :cast => false
property :proxy_in_, :predicate => RDF::Vocab::ORE.proxyIn, :class_name => LD4L::OreRDF::AggregationResource
property :next_proxy_, :predicate => RDF::Vocab::IANA.next, :class_name => LD4L::OreRDF::ProxyResource
property :prev_proxy_, :predicate => RDF::Vocab::IANA.prev, :class_name => LD4L::OreRDF::ProxyResource
property :contributor, :predicate => RDF::Vocab::DC.contributor, :class_name => LD4L::FoafRDF::Person # TODO User who added this item to the Aggregation (default=Aggregation's owner)


def proxy_for= value
Expand Down Expand Up @@ -90,8 +90,8 @@ def self.get_range( aggregation, start=0, limit=nil )
graph = ActiveTriples::Repositories.repositories[repository]
query = RDF::Query.new({
:proxy => {
RDF.type => RDFVocabularies::ORE.Proxy,
RDFVocabularies::ORE.proxyIn => aggregation_resource,
RDF.type => RDF::Vocab::ORE.Proxy,
RDF::Vocab::ORE.proxyIn => aggregation_resource,
}
})

Expand Down
6 changes: 3 additions & 3 deletions lib/ld4l/ore_rdf/services/aggregation/find.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ class FindAggregations
# Find aggregations matching the specified criteria.
#
# @param [Hash] options the options to use to find aggregations
# @option options [Hash<Object,Object>] :criteria for finding aggregations (ex. RDF::DC.title=>'My Aggregation') (default - nil for all aggregations)
# @option options [Hash<Symbol><Object>] :properties to return with the aggregation uri (ex. :first_proxy=>RDFVocabularies::IANA.first) (default - nil aggregation uri only)
# @option options [Hash<Object,Object>] :criteria for finding aggregations (ex. RDF::Vocab::DC.title=>'My Aggregation') (default - nil for all aggregations)
# @option options [Hash<Symbol><Object>] :properties to return with the aggregation uri (ex. :first_proxy=>RDF::Vocab::IANA.first) (default - nil aggregation uri only)
# @option options [Symbol] :repository to search (default - :default)
# @option options [TrueClass,FalseClass] :resume if true, find and resume; otherwise, find only (default - false)
#
Expand All @@ -31,7 +31,7 @@ def self.call( options={} )
raise ArgumentError, 'criteria must be a hash of attribute-value pairs for searching for aggregations' unless
criteria.nil? || criteria.kind_of?(Hash)
criteria = criteria ? criteria.dup : {}
criteria[RDF.type] = RDFVocabularies::ORE.Aggregation
criteria[RDF.type] = RDF::Vocab::ORE.Aggregation

# properties are ignored when resume==true because all properties are returned as part of the resumed aggregations
properties = options[:properties] || nil
Expand Down
8 changes: 4 additions & 4 deletions lib/ld4l/ore_rdf/services/proxy/find.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ class FindProxies
#
# @param [Hash] options the options to use to find proxies
# @option options [String, RDF::URI, LD4L::OreRDF::AggregationResource] :aggregation - limit proxies found to this aggregation (required)
# @option options [Hash<Object,Object>] :criteria for finding proxies (ex. RDF::DC.proxy_in=>RDF::URI('http://example.org/ag123')) (default - nil for all proxies in the aggregation)
# @option options [Hash<Symbol><Object>] :properties to return with the proxy uri (ex. :proxy_for=>RDFVocabularies::ORE.proxyFor) (default - nil aggregation uri only)
# @option options [Hash<Object,Object>] :criteria for finding proxies (ex. RDF::Vocab::ORE.proxy_in=>RDF::URI('http://example.org/ag123')) (default - nil for all proxies in the aggregation)
# @option options [Hash<Symbol><Object>] :properties to return with the proxy uri (ex. :proxy_for=>RDF::Vocab::ORE.proxyFor) (default - nil aggregation uri only)
# @option options [Symbol] :repository to search (default - :default)
# @option options [TrueClass,FalseClass] :resume if true, find and resume; otherwise, find only (default - false)
#
Expand Down Expand Up @@ -50,8 +50,8 @@ def self.call( options={} )
raise ArgumentError, 'criteria must be a hash of attribute-value pairs for searching for proxies' unless
criteria.nil? || criteria.kind_of?(Hash)
criteria = criteria ? criteria.dup : {}
criteria[RDF.type] = RDFVocabularies::ORE.Proxy
criteria[RDFVocabularies::ORE.proxyIn] = aggregation
criteria[RDF.type] = RDF::Vocab::ORE.Proxy
criteria[RDF::Vocab::ORE.proxyIn] = aggregation

# properties are ignored when resume==true because all properties are returned as part of the resumed proxies
properties = options[:properties] || nil
Expand Down
2 changes: 1 addition & 1 deletion lib/ld4l/ore_rdf/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module LD4L
module OreRDF
VERSION = "0.2.0"
VERSION = "0.3.0"
end
end
27 changes: 0 additions & 27 deletions lib/ld4l/ore_rdf/vocab/co.rb

This file was deleted.

6 changes: 0 additions & 6 deletions lib/ld4l/ore_rdf/vocab/dcterms.rb

This file was deleted.

9 changes: 0 additions & 9 deletions lib/ld4l/ore_rdf/vocab/iana.rb

This file was deleted.

16 changes: 0 additions & 16 deletions lib/ld4l/ore_rdf/vocab/ore.rb

This file was deleted.

10 changes: 5 additions & 5 deletions spec/ld4l/ore_rdf/configuration_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
context "when base_uri is not configured" do
before do
class DummyAggregation < LD4L::OreRDF::AggregationResource
configure :type => RDFVocabularies::ORE.Aggregation, :base_uri => LD4L::OreRDF.configuration.base_uri, :repository => :default
configure :type => RDF::Vocab::ORE.Aggregation, :base_uri => LD4L::OreRDF.configuration.base_uri, :repository => :default
end
end
after do
Expand All @@ -28,7 +28,7 @@ class DummyAggregation < LD4L::OreRDF::AggregationResource
config.base_uri = "http://localhost/test_slash/"
end
class DummyAggregation < LD4L::OreRDF::AggregationResource
configure :type => RDFVocabularies::ORE.Aggregation, :base_uri => LD4L::OreRDF.configuration.base_uri, :repository => :default
configure :type => RDF::Vocab::ORE.Aggregation, :base_uri => LD4L::OreRDF.configuration.base_uri, :repository => :default
end
end
after do
Expand All @@ -47,7 +47,7 @@ class DummyAggregation < LD4L::OreRDF::AggregationResource
config.base_uri = "http://localhost/test_no_slash"
end
class DummyAggregation < LD4L::OreRDF::AggregationResource
configure :type => RDFVocabularies::ORE.Aggregation, :base_uri => LD4L::OreRDF.configuration.base_uri, :repository => :default
configure :type => RDF::Vocab::ORE.Aggregation, :base_uri => LD4L::OreRDF.configuration.base_uri, :repository => :default
end
end
after do
Expand Down Expand Up @@ -90,7 +90,7 @@ class DummyAggregation < LD4L::OreRDF::AggregationResource
context "when minter is nil" do
before do
class DummyAggregation < LD4L::OreRDF::AggregationResource
configure :type => RDFVocabularies::ORE.Aggregation, :base_uri => LD4L::OreRDF.configuration.base_uri, :repository => :default
configure :type => RDF::Vocab::ORE.Aggregation, :base_uri => LD4L::OreRDF.configuration.base_uri, :repository => :default
end
end
after do
Expand All @@ -112,7 +112,7 @@ class DummyAggregation < LD4L::OreRDF::AggregationResource
config.localname_minter = lambda { |prefix=""| prefix+'_configured_'+SecureRandom.uuid }
end
class DummyAggregation < LD4L::OreRDF::AggregationResource
configure :type => RDFVocabularies::ORE.Aggregation, :base_uri => LD4L::OreRDF.configuration.base_uri, :repository => :default
configure :type => RDF::Vocab::ORE.Aggregation, :base_uri => LD4L::OreRDF.configuration.base_uri, :repository => :default
end
end
after do
Expand Down
Loading