diff --git a/.travis.yml b/.travis.yml
index 3a1eb50..83a126b 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,23 +1,16 @@
language: ruby
-bundler_args: --without debug
script: "bundle exec rspec spec"
-before_install:
- - 'gem update --system --conservative || (gem i "rubygems-update:~>2.7" --no-document && update_rubygems)'
- - 'gem update bundler --conservative'
env:
- CI=true
rvm:
- - 2.2.2
- - 2.3
- 2.4
- 2.5
- 2.6
- - jruby-9
- - rbx-3
+ - 2.7
+ - jruby
cache: bundler
sudo: false
matrix:
allow_failures:
- - rvm: jruby-9
- - rvm: rbx-3
+ - rvm: jruby
dist: trusty
diff --git a/Gemfile b/Gemfile
index 60de3c8..714d784 100644
--- a/Gemfile
+++ b/Gemfile
@@ -2,17 +2,20 @@ source "https://rubygems.org"
gemspec
-gem "rdf", git: "https://github.com/ruby-rdf/rdf", branch: "develop"
+gem "rdf", git: "https://github.com/ruby-rdf/rdf", branch: "develop"
group :development do
- gem "rdf-spec", git: "https://github.com/ruby-rdf/rdf-spec", branch: "develop"
- gem "rdf-isomorphic", git: "https://github.com/ruby-rdf/rdf-isomorphic", branch: "develop"
- gem "rdf-trig", git: "https://github.com/ruby-rdf/rdf-trig", branch: "develop"
- gem 'rdf-vocab', git: "https://github.com/ruby-rdf/rdf-vocab", branch: "develop"
- gem "rdf-xsd", git: "https://github.com/ruby-rdf/rdf-xsd", branch: "develop"
- gem "json-ld", git: "https://github.com/ruby-rdf/json-ld", branch: "develop"
- gem 'sparql', git: "https://github.com/ruby-rdf/sparql", branch: "develop"
- gem 'sxp', git: "https://github.com/dryruby/sxp.rb", branch: "develop"
+ gem "ebnf", git: "https://github.com/dryruby/ebnf", branch: "develop"
+ gem "rdf-aggregate-repo", git: "https://github.com/ruby-rdf/rdf-aggregate-repo", branch: "develop"
+ gem "rdf-spec", git: "https://github.com/ruby-rdf/rdf-spec", branch: "develop"
+ gem "rdf-isomorphic", git: "https://github.com/ruby-rdf/rdf-isomorphic", branch: "develop"
+ gem "rdf-trig", git: "https://github.com/ruby-rdf/rdf-trig", branch: "develop"
+ gem "rdf-turtle", git: "https://github.com/ruby-rdf/rdf-turtle", branch: "develop"
+ gem 'rdf-vocab', git: "https://github.com/ruby-rdf/rdf-vocab", branch: "develop"
+ gem "rdf-xsd", git: "https://github.com/ruby-rdf/rdf-xsd", branch: "develop"
+ gem "json-ld", git: "https://github.com/ruby-rdf/json-ld", branch: "develop"
+ gem 'sparql', git: "https://github.com/ruby-rdf/sparql", branch: "develop"
+ gem 'sxp', git: "https://github.com/dryruby/sxp.rb", branch: "develop"
end
group :debug do
diff --git a/VERSION b/VERSION
index fd2a018..94ff29c 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.1.0
+3.1.1
diff --git a/lib/rdf/n3/extensions.rb b/lib/rdf/n3/extensions.rb
index ea366c4..da17e85 100644
--- a/lib/rdf/n3/extensions.rb
+++ b/lib/rdf/n3/extensions.rb
@@ -59,21 +59,4 @@ def to_sxp
to_sxp_bin.to_sxp
end
end
-
- class Query::Variable
-
- # Transform Statement into an SXP
- # @return [Array]
- def to_sxp_bin
- [:var, name, (value.to_sxp_bin if value)].compact
- end
-
- ##
- # Returns an S-Expression (SXP) representation
- #
- # @return [String]
- def to_sxp
- to_sxp_bin.to_sxp
- end
- end
end
diff --git a/lib/rdf/n3/patches/array_hacks.rb b/lib/rdf/n3/patches/array_hacks.rb
index e09726d..17c20cd 100644
--- a/lib/rdf/n3/patches/array_hacks.rb
+++ b/lib/rdf/n3/patches/array_hacks.rb
@@ -18,7 +18,7 @@ def permute(prefixed=[])
# * :words_connector - The sign or word used to join the elements in arrays with two or more elements (default: ", ")
# * :two_words_connector - The sign or word used to join the elements in arrays with two elements (default: " and ")
# * :last_word_connector - The sign or word used to join the last element in arrays with three or more elements (default: ", and ")
- def to_sentence(options = {})
+ def to_sentence(**options)
default_words_connector = ", "
default_two_words_connector = " and "
default_last_word_connector = ", and "
diff --git a/lib/rdf/n3/reader.rb b/lib/rdf/n3/reader.rb
index 6ee65f9..a3834da 100644
--- a/lib/rdf/n3/reader.rb
+++ b/lib/rdf/n3/reader.rb
@@ -50,7 +50,7 @@ class Reader < RDF::Reader
# @yieldparam [RDF::Reader] reader
# @yieldreturn [void] ignored
# @raise [Error]:: Raises RDF::ReaderError if validating and an error is found
- def initialize(input = $stdin, options = {}, &block)
+ def initialize(input = $stdin, **options, &block)
super do
input.rewind if input.respond_to?(:rewind)
@input = input.respond_to?(:read) ? input : StringIO.new(input.to_s)
@@ -704,7 +704,7 @@ def uri(value, append = nil)
value = value.join(append) if append
value.validate! if validate? && value.respond_to?(:validate)
value.canonicalize! if canonicalize?
- value = RDF::URI.intern(value, {}) if intern?
+ value = RDF::URI.intern(value) if intern?
# Variable substitution for in-scope variables. Variables are in scope if they are defined in anthing other than the current formula
var = find_var(@formulae.last, value)
diff --git a/lib/rdf/n3/reasoner.rb b/lib/rdf/n3/reasoner.rb
index c050cb8..963da32 100644
--- a/lib/rdf/n3/reasoner.rb
+++ b/lib/rdf/n3/reasoner.rb
@@ -66,7 +66,7 @@ def initialize(input, **options, &block)
else RDF::Repository.new
end
- log_debug("reasoner: expression", options) {SXP::Generator.string(formula.to_sxp_bin)}
+ log_debug("reasoner: expression", **options) {SXP::Generator.string(formula.to_sxp_bin)}
if block_given?
case block.arity
diff --git a/lib/rdf/n3/writer.rb b/lib/rdf/n3/writer.rb
index 4942f92..d8470ad 100644
--- a/lib/rdf/n3/writer.rb
+++ b/lib/rdf/n3/writer.rb
@@ -103,7 +103,7 @@ def self.options
# @yieldreturn [void]
# @yield [writer]
# @yieldparam [RDF::Writer] writer
- def initialize(output = $stdout, options = {}, &block)
+ def initialize(output = $stdout, **options, &block)
@repo = RDF::Repository.new
@uri_to_pname = {}
@uri_to_prefix = {}
@@ -259,7 +259,7 @@ def sort_properties(properties)
# @param [RDF::Literal, String, #to_s] literal
# @param [Hash{Symbol => Object}] options
# @return [String]
- def format_literal(literal, options = {})
+ def format_literal(literal, **options)
literal = literal.dup.canonicalize! if @options[:canonicalize]
case literal
when RDF::Literal
@@ -285,7 +285,7 @@ def format_literal(literal, options = {})
# @param [RDF::URI] uri
# @param [Hash{Symbol => Object}] options
# @return [String]
- def format_uri(uri, options = {})
+ def format_uri(uri, **options)
md = uri.relativize(base_uri)
log_debug("relativize") {"#{uri.to_sxp} => #{md.inspect}"} if md != uri.to_s
md != uri.to_s ? "<#{md}>" : (get_pname(uri) || "<#{uri}>")
@@ -297,7 +297,7 @@ def format_uri(uri, options = {})
# @param [RDF::Node] node
# @param [Hash{Symbol => Object}] options
# @return [String]
- def format_node(node, options = {})
+ def format_node(node, **options)
options[:unique_bnodes] ? node.to_unique_base : node.to_base
end
@@ -349,7 +349,7 @@ def order_subjects
# Add distinguished classes
top_classes.each do |class_uri|
- graph.query(predicate: RDF.type, object: class_uri).
+ graph.query({predicate: RDF.type, object: class_uri}).
map {|st| st.subject}.
sort.
uniq.
@@ -504,7 +504,7 @@ def p_term(resource, position)
elsif resource == RDF.nil
"()"
else
- format_term(resource, options)
+ format_term(resource, **options)
end
@output.write(l)
end
@@ -566,7 +566,7 @@ def predicateObjectList(subject, from_bpl = false)
(properties[st.predicate.to_s] ||= []) << st.object
end
else
- @graph.query(subject: subject) do |st|
+ @graph.query({subject: subject}) do |st|
(properties[st.predicate.to_s] ||= []) << st.object
end
end
@@ -704,8 +704,8 @@ def resource_in_single_graph?(resource)
select {|st| st.subject.equal?(resource) || st.object.equal?(resource)}.
map(&:graph_name)
else
- graph_names = @repo.query(subject: resource).map(&:graph_name)
- graph_names += @repo.query(object: resource).map(&:graph_name)
+ graph_names = @repo.query({subject: resource}).map(&:graph_name)
+ graph_names += @repo.query({object: resource}).map(&:graph_name)
end
graph_names.uniq.length <= 1
end
diff --git a/rdf-n3.gemspec b/rdf-n3.gemspec
index d08bac6..73e125d 100755
--- a/rdf-n3.gemspec
+++ b/rdf-n3.gemspec
@@ -18,21 +18,21 @@ Gem::Specification.new do |gem|
gem.files = %w(README.md History.markdown AUTHORS VERSION UNLICENSE) + Dir.glob('lib/**/*.rb')
gem.require_paths = %w(lib)
- gem.required_ruby_version = '>= 2.2.2'
+ gem.required_ruby_version = '>= 2.4'
gem.requirements = []
- gem.add_dependency 'rdf', '~> 3.0'
- gem.add_dependency 'sparql', '~> 3.0'
- gem.add_runtime_dependency 'sxp', '~> 1.0'
+ gem.add_dependency 'rdf', '~> 3.1'
+ gem.add_dependency 'sparql', '~> 3.1'
+ gem.add_runtime_dependency 'sxp', '~> 1.1'
- gem.add_development_dependency 'json-ld', '~> 3.0'
- gem.add_development_dependency 'rspec', '~> 3.8'
- gem.add_development_dependency 'rspec-its', '~> 1.2'
- gem.add_development_dependency 'rdf-spec', '~> 3.0'
+ gem.add_development_dependency 'json-ld', '~> 3.1'
+ gem.add_development_dependency 'rspec', '~> 3.9'
+ gem.add_development_dependency 'rspec-its', '~> 1.3'
+ gem.add_development_dependency 'rdf-spec', '~> 3.1'
gem.add_development_dependency 'rdf-isomorphic', '~> 3.0'
- gem.add_development_dependency 'rdf-trig', '~> 3.0'
- gem.add_development_dependency 'rdf-vocab', '~> 3.0'
- gem.add_development_dependency 'yard' , '~> 0.9.16'
+ gem.add_development_dependency 'rdf-trig', '~> 3.1'
+ gem.add_development_dependency 'rdf-vocab', '~> 3.1'
+ gem.add_development_dependency 'yard' , '~> 0.9.20'
gem.post_install_message = nil
end
diff --git a/script/build_meta b/script/build_meta
index ebc9711..954ac87 100755
--- a/script/build_meta
+++ b/script/build_meta
@@ -81,7 +81,7 @@ class PredictiveParser
chatty("\nToken #{lhs} matches regexp #{rhs}")
tokenRegexps[lhs] = rhs.value
- cc = graph.query(subject: lhs, predicate: BNF.canStartWith)
+ cc = graph.query({subject: lhs, predicate: BNF.canStartWith})
progress(recordError("No record of what token #{lhs} can start with")) if cc.empty?
cc.each {|statement| chatty(" Can start with: #{statement.object}")}
return
@@ -96,11 +96,11 @@ class PredictiveParser
options = rhs
progress("\nProduction #{lhs} :: #{options}")
- graph.query(subject: lhs, predicate: BNF.canPrecede) do |statement|
+ graph.query({subject: lhs, predicate: BNF.canPrecede}) do |statement|
chatty(" Can precede '#{statement.object}'")
end
- graph.query(subject: lhs, predicate: BNF.branch) do |statement|
+ graph.query({subject: lhs, predicate: BNF.branch}) do |statement|
branch = statement.object
sequence = graph.first_object(subject: statement.object, predicate: BNF.sequence)
option = RDF::List.new(subject: sequence, graph: graph).to_a
@@ -110,7 +110,7 @@ class PredictiveParser
agenda << part unless already.include?(part) || agenda.include?(part)
end
- conditions = graph.query(subject: branch, predicate: BNF.condition).map(&:object)
+ conditions = graph.query({subject: branch, predicate: BNF.condition}).map(&:object)
if conditions.empty?
progress(recordError("NO SELECTOR for #{lhs} option #{option}"))
if option.empty?
diff --git a/script/parse b/script/parse
index 053ad09..cedfa88 100755
--- a/script/parse
+++ b/script/parse
@@ -9,7 +9,7 @@ require 'rdf/trig'
require 'getoptlong'
require 'open-uri'
-def run(input, options)
+def run(input, **options)
require 'profiler' if options[:profile]
reader_class = RDF::Reader.for(options[:input_format].to_sym)
@@ -166,10 +166,10 @@ end
if ARGV.empty?
s = input ? input : $stdin.read
- run(StringIO.new(s), options)
+ run(StringIO.new(s), **options)
else
ARGV.each do |test_file|
- run(Kernel.open(test_file), options)
+ run(Kernel.open(test_file), **options)
end
end
puts
diff --git a/spec/reader_spec.rb b/spec/reader_spec.rb
index 78be377..e7c2a38 100644
--- a/spec/reader_spec.rb
+++ b/spec/reader_spec.rb
@@ -960,19 +960,19 @@
it "assumption graph has 2 statements" do
tt = @repo.first(subject: RDF::URI.new("http://a/b#assumption"), predicate: RDF::OWL.sameAs)
expect(tt.object).to be_node
- expect(@repo.query(graph_name: tt.object).to_a.length).to eq 2
+ expect(@repo.query({graph_name: tt.object}).to_a.length).to eq 2
end
it "conclusion graph has 1 statements" do
tt = @repo.first(subject: RDF::URI.new("http://a/b#conclusion"), predicate: RDF::OWL.sameAs)
expect(tt.object).to be_node
- expect(@repo.query(graph_name: tt.object).to_a.length).to eq 1
+ expect(@repo.query({graph_name: tt.object}).to_a.length).to eq 1
end
it "trivialTruth equivalent to empty graph" do
tt = @repo.first(subject: RDF::URI.new("http://a/b#trivialTruth"), predicate: RDF::OWL.sameAs)
expect(tt.object).to be_node
- @repo.query(graph_name: tt.object) do |s|
+ @repo.query({graph_name: tt.object}) do |s|
puts "statement: #{s}"
end
end
diff --git a/spec/suite_helper.rb b/spec/suite_helper.rb
index 18c826b..a6b7ac2 100644
--- a/spec/suite_helper.rb
+++ b/spec/suite_helper.rb
@@ -20,7 +20,7 @@ class << self
# HTTP Request headers.
# @return [IO] File stream
# @yield [IO] File stream
- def self.open_file(filename_or_url, options = {}, &block)
+ def self.open_file(filename_or_url, **options, &block)
case
when filename_or_url.to_s =~ /^file:/
path = filename_or_url[5..-1]
@@ -103,7 +103,7 @@ def self.open(file)
g = RDF::Repository.load(file, format: :n3)
JSON::LD::API.fromRDF(g) do |expanded|
JSON::LD::API.frame(expanded, FRAME) do |framed|
- yield Manifest.new(framed['@graph'].first)
+ yield Manifest.new(framed)
end
end
end
diff --git a/spec/writer_spec.rb b/spec/writer_spec.rb
index 270e2a2..e4555ef 100644
--- a/spec/writer_spec.rb
+++ b/spec/writer_spec.rb
@@ -143,7 +143,7 @@
}
}.each do |name, params|
it name do
- serialize(params[:input], params[:regexp], params)
+ serialize(params[:input], params[:regexp], **params)
end
end
end
@@ -298,7 +298,7 @@
},
}.each do |name, params|
it name do
- serialize(params[:input], params[:regexp], params)
+ serialize(params[:input], params[:regexp], **params)
end
end
end
@@ -564,7 +564,7 @@
}
}.each do |name, params|
it name do
- serialize(params[:input], params[:regexp], params)
+ serialize(params[:input], params[:regexp], **params)
end
end
end
@@ -594,7 +594,7 @@
},
}.each do |name, params|
it name do
- serialize(params[:input], params[:regexp], params)
+ serialize(params[:input], params[:regexp], **params)
end
end
end
@@ -651,7 +651,7 @@
def parse(input, format: :n3, **options)
repo = RDF::Repository.new
reader = RDF::Reader.for(format)
- repo << reader.new(input, options)
+ repo << reader.new(input, **options)
repo
end
@@ -659,7 +659,7 @@ def parse(input, format: :n3, **options)
def serialize(ntstr, regexps = [], base_uri: nil, **options)
prefixes = options[:prefixes] || {}
g = ntstr.is_a?(RDF::Enumerable) ? ntstr : parse(ntstr, base_uri: base_uri, prefixes: prefixes, validate: false, logger: [], format: options.fetch(:input_format, :n3))
- result = RDF::N3::Writer.buffer(options.merge(logger: logger, base_uri: base_uri, prefixes: prefixes)) do |writer|
+ result = RDF::N3::Writer.buffer(**options.merge(logger: logger, base_uri: base_uri, prefixes: prefixes)) do |writer|
writer << g
end
if $verbose