diff --git a/.coveralls.yml b/.coveralls.yml
new file mode 100644
index 00000000..9c4d4ac8
--- /dev/null
+++ b/.coveralls.yml
@@ -0,0 +1 @@
+repo_token: VCzjHF1tTiWms12qHsCsrQyId4YWSQlfH
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 4945a5cd..54094313 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -16,15 +16,15 @@ jobs:
env:
CI: true
BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
+ ALLOW_FAILURES: ${{ endsWith(matrix.ruby, 'head') }}
strategy:
fail-fast: false
matrix:
ruby:
- - 2.4
- - 2.5
- 2.6
- 2.7
- 3.0
+ - 3.1
- ruby-head
- jruby
gemfile:
@@ -40,5 +40,9 @@ jobs:
- name: Install dependencies
run: bundle install --jobs 4 --retry 3
- name: Run tests
- run: bundle exec rspec spec
-
+ run: ruby --version; bundle exec rspec spec || $ALLOW_FAILURES
+ - name: Coveralls GitHub Action
+ uses: coverallsapp/github-action@v1.1.2
+ if: ${{ matrix.ruby == '3.0' && matrix.gemfile == 'Gemfile' }}
+ with:
+ github-token: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 2726685a..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,22 +0,0 @@
-language: ruby
-bundler_args: --without debug
-script: "bundle exec rspec spec"
-env:
- - CI=true
-gemfile:
- - Gemfile
- - Gemfile-pure
-rvm:
- - 2.4
- - 2.5
- - 2.6
- - 2.7
- - ruby-head
- - jruby
-cache: bundler
-sudo: false
-matrix:
- allow_failures:
- - rvm: ruby-head
- - rvm: jruby
-dist: trusty
diff --git a/Gemfile b/Gemfile
index 14c6f460..991f09d7 100644
--- a/Gemfile
+++ b/Gemfile
@@ -5,7 +5,7 @@ gemspec
gem 'rdf', git: "https://github.com/ruby-rdf/rdf", branch: "develop"
gem 'rdf-aggregate-repo', git: "https://github.com/ruby-rdf/rdf-aggregate-repo", branch: "develop"
gem 'sparql', git: "https://github.com/ruby-rdf/sparql", branch: "develop"
-gem "nokogiri", '~> 1.11'
+gem "nokogiri", '~> 1.10'
group :development, :test do
gem 'ebnf', git: "https://github.com/dryruby/ebnf", branch: "develop"
@@ -15,8 +15,8 @@ group :development, :test do
gem "rdf-xsd", git: "https://github.com/ruby-rdf/rdf-xsd", branch: "develop"
gem 'sxp', git: "https://github.com/dryruby/sxp.rb", branch: "develop"
gem "redcarpet", platform: :ruby
- gem 'simplecov', platforms: :mri
- gem 'coveralls', '~> 0.8', platforms: :mri
+ gem 'simplecov', '~> 0.21', platforms: :mri
+ gem 'simplecov-lcov', '~> 0.8', platforms: :mri
end
group :debug do
diff --git a/README.md b/README.md
index 91da4bd1..1ce50586 100644
--- a/README.md
+++ b/README.md
@@ -124,11 +124,11 @@ sparql.delete_data(data)
## Dependencies
-* [Ruby](https://ruby-lang.org/) (>= 2.4)
-* [RDF.rb](https://rubygems.org/gems/rdf) (~> 3.1)
+* [Ruby](https://ruby-lang.org/) (>= 2.6)
+* [RDF.rb](https://rubygems.org/gems/rdf) (~> 3.2)
* [Net::HTTP::Persistent](https://rubygems.org/gems/net-http-persistent) (~> 4.0, >= 4.0.1)
-* Soft dependency on [SPARQL](https://rubygems.org/gems/sparql) (~> 3.1)
-* Soft dependency on [Nokogiri](https://rubygems.org/gems/nokogiri) (>= 1.11)
+* Soft dependency on [SPARQL](https://rubygems.org/gems/sparql) (~> 3.2)
+* Soft dependency on [Nokogiri](https://rubygems.org/gems/nokogiri) (>= 1.12)
## Installation
diff --git a/VERSION b/VERSION
index ef538c28..944880fa 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-3.1.2
+3.2.0
diff --git a/lib/sparql/client.rb b/lib/sparql/client.rb
index 92b16620..29ef286b 100644
--- a/lib/sparql/client.rb
+++ b/lib/sparql/client.rb
@@ -442,6 +442,11 @@ def self.parse_json_value(value, nodes = {})
RDF::Literal.new(value['value'], datatype: value['datatype'], language: value['xml:lang'])
when :'typed-literal'
RDF::Literal.new(value['value'], datatype: value['datatype'])
+ when :triple
+ s = parse_json_value(value['value']['subject'], nodes)
+ p = parse_json_value(value['value']['predicate'], nodes)
+ o = parse_json_value(value['value']['object'], nodes)
+ RDF::Statement(s, p, o)
else nil
end
end
@@ -558,6 +563,11 @@ def self.parse_xml_value(value, nodes = {})
lang = value.respond_to?(:attr) ? value.attr('xml:lang') : value.attributes['xml:lang']
datatype = value.respond_to?(:attr) ? value.attr('datatype') : value.attributes['datatype']
RDF::Literal.new(value.text, language: lang, datatype: datatype)
+ when :triple
+ # Note, this is order dependent
+ res = value.elements.map {|e| e.elements.to_a}.
+ flatten.map {|e| parse_xml_value(e, nodes)}
+ RDF::Statement(*res)
else nil
end
end
diff --git a/sparql-client.gemspec b/sparql-client.gemspec
index c187aa38..a5ddf6ad 100755
--- a/sparql-client.gemspec
+++ b/sparql-client.gemspec
@@ -22,15 +22,15 @@ Gem::Specification.new do |gem|
gem.bindir = %q(bin)
gem.require_paths = %w(lib)
- gem.required_ruby_version = '>= 2.4'
+ gem.required_ruby_version = '>= 2.6'
gem.requirements = []
- gem.add_runtime_dependency 'rdf', '~> 3.1'
+ gem.add_runtime_dependency 'rdf', '~> 3.2'
gem.add_runtime_dependency 'net-http-persistent', '~> 4.0', '>= 4.0.1'
- gem.add_development_dependency 'rdf-spec', '~> 3.1'
- gem.add_development_dependency 'sparql', '~> 3.1'
+ gem.add_development_dependency 'rdf-spec', '~> 3.2'
+ gem.add_development_dependency 'sparql', '~> 3.2'
gem.add_development_dependency 'rspec', '~> 3.10'
gem.add_development_dependency 'rspec-its', '~> 1.3'
- gem.add_development_dependency 'webmock', '~> 3.11'
+ gem.add_development_dependency 'webmock', '~> 3.14'
gem.add_development_dependency 'yard' , '~> 0.9'
gem.post_install_message = nil
diff --git a/spec/client_spec.rb b/spec/client_spec.rb
index e2fc6823..23dfd3bb 100644
--- a/spec/client_spec.rb
+++ b/spec/client_spec.rb
@@ -389,6 +389,10 @@ def response(header)
name: RDF::Literal.new("Bob", language: "en"),
age: RDF::Literal.new("30", datatype: "http://www.w3.org/2001/XMLSchema#integer"),
mbox: RDF::URI.new("mailto:bob@work.example.org"),
+ triple: RDF::Statement(
+ RDF::URI('http://work.example.org/s'),
+ RDF::URI('http://work.example.org/p'),
+ RDF::URI('http://work.example.org/o')),
)
])
expect(solutions[0]["x"]).to eq nodes["r2"]
@@ -407,9 +411,9 @@ def response(header)
context "when parsing JSON" do
it "parses binding results correctly" do
- xml = File.read("spec/fixtures/results.json")
+ json = File.read("spec/fixtures/results.json")
nodes = {}
- solutions = SPARQL::Client::parse_json_bindings(xml, nodes)
+ solutions = SPARQL::Client::parse_json_bindings(json, nodes)
expect(solutions).to eq RDF::Query::Solutions.new([
RDF::Query::Solution.new(
x: RDF::Node.new("r2"),
@@ -417,6 +421,10 @@ def response(header)
name: RDF::Literal.new("Bob", language: "en"),
age: RDF::Literal.new("30", datatype: "http://www.w3.org/2001/XMLSchema#integer"),
mbox: RDF::URI.new("mailto:bob@work.example.org"),
+ triple: RDF::Statement(
+ RDF::URI('http://work.example.org/s'),
+ RDF::URI('http://work.example.org/p'),
+ RDF::URI('http://work.example.org/o')),
)
])
expect(solutions[0]["x"]).to eq nodes["r2"]
diff --git a/spec/fixtures/results.json b/spec/fixtures/results.json
index b783c010..9e790931 100644
--- a/spec/fixtures/results.json
+++ b/spec/fixtures/results.json
@@ -35,6 +35,23 @@
"mbox": {
"type": "uri",
"value": "mailto:bob@work.example.org"
+ },
+ "triple": {
+ "type": "triple",
+ "value": {
+ "subject": {
+ "type": "uri",
+ "value": "http://work.example.org/s"
+ },
+ "predicate": {
+ "type": "uri",
+ "value": "http://work.example.org/p"
+ },
+ "object": {
+ "type": "uri",
+ "value": "http://work.example.org/o"
+ }
+ }
}
}
]
diff --git a/spec/fixtures/results.xml b/spec/fixtures/results.xml
index f4258ed6..795ab039 100644
--- a/spec/fixtures/results.xml
+++ b/spec/fixtures/results.xml
@@ -25,6 +25,13 @@
mailto:bob@work.example.org
+
+
+ http://work.example.org/s
+ http://work.example.org/p
+
+
+
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index ec964673..9cec7e07 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -4,11 +4,17 @@
begin
require 'simplecov'
- require 'coveralls'
+ require 'simplecov-lcov'
+
+ SimpleCov::Formatter::LcovFormatter.config do |config|
+ #Coveralls is coverage by default/lcov. Send info results
+ config.report_with_single_file = true
+ config.single_report_path = 'coverage/lcov.info'
+ end
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
SimpleCov::Formatter::HTMLFormatter,
- Coveralls::SimpleCov::Formatter
+ SimpleCov::Formatter::LcovFormatter
])
SimpleCov.start do
add_filter "/spec/"