Skip to content

Commit b60d7ec

Browse files
committed
Finish 3.2.0
2 parents 9c527f0 + 50398b9 commit b60d7ec

File tree

12 files changed

+74
-43
lines changed

12 files changed

+74
-43
lines changed

.coveralls.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
repo_token: VCzjHF1tTiWms12qHsCsrQyId4YWSQlfH

.github/workflows/ci.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ jobs:
1616
env:
1717
CI: true
1818
BUNDLE_GEMFILE: "${{ matrix.gemfile }}"
19+
ALLOW_FAILURES: ${{ endsWith(matrix.ruby, 'head') }}
1920
strategy:
2021
fail-fast: false
2122
matrix:
2223
ruby:
23-
- 2.4
24-
- 2.5
2524
- 2.6
2625
- 2.7
2726
- 3.0
27+
- 3.1
2828
- ruby-head
2929
- jruby
3030
gemfile:
@@ -40,5 +40,9 @@ jobs:
4040
- name: Install dependencies
4141
run: bundle install --jobs 4 --retry 3
4242
- name: Run tests
43-
run: bundle exec rspec spec
44-
43+
run: ruby --version; bundle exec rspec spec || $ALLOW_FAILURES
44+
- name: Coveralls GitHub Action
45+
uses: coverallsapp/[email protected]
46+
if: ${{ matrix.ruby == '3.0' && matrix.gemfile == 'Gemfile' }}
47+
with:
48+
github-token: ${{ secrets.GITHUB_TOKEN }}

.travis.yml

Lines changed: 0 additions & 22 deletions
This file was deleted.

Gemfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ gemspec
55
gem 'rdf', git: "https://github.com/ruby-rdf/rdf", branch: "develop"
66
gem 'rdf-aggregate-repo', git: "https://github.com/ruby-rdf/rdf-aggregate-repo", branch: "develop"
77
gem 'sparql', git: "https://github.com/ruby-rdf/sparql", branch: "develop"
8-
gem "nokogiri", '~> 1.11'
8+
gem "nokogiri", '~> 1.10'
99

1010
group :development, :test do
1111
gem 'ebnf', git: "https://github.com/dryruby/ebnf", branch: "develop"
@@ -15,8 +15,8 @@ group :development, :test do
1515
gem "rdf-xsd", git: "https://github.com/ruby-rdf/rdf-xsd", branch: "develop"
1616
gem 'sxp', git: "https://github.com/dryruby/sxp.rb", branch: "develop"
1717
gem "redcarpet", platform: :ruby
18-
gem 'simplecov', platforms: :mri
19-
gem 'coveralls', '~> 0.8', platforms: :mri
18+
gem 'simplecov', '~> 0.21', platforms: :mri
19+
gem 'simplecov-lcov', '~> 0.8', platforms: :mri
2020
end
2121

2222
group :debug do

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,11 @@ sparql.delete_data(data)
124124

125125
## Dependencies
126126

127-
* [Ruby](https://ruby-lang.org/) (>= 2.4)
128-
* [RDF.rb](https://rubygems.org/gems/rdf) (~> 3.1)
127+
* [Ruby](https://ruby-lang.org/) (>= 2.6)
128+
* [RDF.rb](https://rubygems.org/gems/rdf) (~> 3.2)
129129
* [Net::HTTP::Persistent](https://rubygems.org/gems/net-http-persistent) (~> 4.0, >= 4.0.1)
130-
* Soft dependency on [SPARQL](https://rubygems.org/gems/sparql) (~> 3.1)
131-
* Soft dependency on [Nokogiri](https://rubygems.org/gems/nokogiri) (>= 1.11)
130+
* Soft dependency on [SPARQL](https://rubygems.org/gems/sparql) (~> 3.2)
131+
* Soft dependency on [Nokogiri](https://rubygems.org/gems/nokogiri) (>= 1.12)
132132

133133
## Installation
134134

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.1.2
1+
3.2.0

lib/sparql/client.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,11 @@ def self.parse_json_value(value, nodes = {})
442442
RDF::Literal.new(value['value'], datatype: value['datatype'], language: value['xml:lang'])
443443
when :'typed-literal'
444444
RDF::Literal.new(value['value'], datatype: value['datatype'])
445+
when :triple
446+
s = parse_json_value(value['value']['subject'], nodes)
447+
p = parse_json_value(value['value']['predicate'], nodes)
448+
o = parse_json_value(value['value']['object'], nodes)
449+
RDF::Statement(s, p, o)
445450
else nil
446451
end
447452
end
@@ -558,6 +563,11 @@ def self.parse_xml_value(value, nodes = {})
558563
lang = value.respond_to?(:attr) ? value.attr('xml:lang') : value.attributes['xml:lang']
559564
datatype = value.respond_to?(:attr) ? value.attr('datatype') : value.attributes['datatype']
560565
RDF::Literal.new(value.text, language: lang, datatype: datatype)
566+
when :triple
567+
# Note, this is order dependent
568+
res = value.elements.map {|e| e.elements.to_a}.
569+
flatten.map {|e| parse_xml_value(e, nodes)}
570+
RDF::Statement(*res)
561571
else nil
562572
end
563573
end

sparql-client.gemspec

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ Gem::Specification.new do |gem|
2222
gem.bindir = %q(bin)
2323
gem.require_paths = %w(lib)
2424

25-
gem.required_ruby_version = '>= 2.4'
25+
gem.required_ruby_version = '>= 2.6'
2626
gem.requirements = []
27-
gem.add_runtime_dependency 'rdf', '~> 3.1'
27+
gem.add_runtime_dependency 'rdf', '~> 3.2'
2828
gem.add_runtime_dependency 'net-http-persistent', '~> 4.0', '>= 4.0.1'
29-
gem.add_development_dependency 'rdf-spec', '~> 3.1'
30-
gem.add_development_dependency 'sparql', '~> 3.1'
29+
gem.add_development_dependency 'rdf-spec', '~> 3.2'
30+
gem.add_development_dependency 'sparql', '~> 3.2'
3131
gem.add_development_dependency 'rspec', '~> 3.10'
3232
gem.add_development_dependency 'rspec-its', '~> 1.3'
33-
gem.add_development_dependency 'webmock', '~> 3.11'
33+
gem.add_development_dependency 'webmock', '~> 3.14'
3434
gem.add_development_dependency 'yard' , '~> 0.9'
3535

3636
gem.post_install_message = nil

spec/client_spec.rb

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,10 @@ def response(header)
389389
name: RDF::Literal.new("Bob", language: "en"),
390390
age: RDF::Literal.new("30", datatype: "http://www.w3.org/2001/XMLSchema#integer"),
391391
mbox: RDF::URI.new("mailto:[email protected]"),
392+
triple: RDF::Statement(
393+
RDF::URI('http://work.example.org/s'),
394+
RDF::URI('http://work.example.org/p'),
395+
RDF::URI('http://work.example.org/o')),
392396
)
393397
])
394398
expect(solutions[0]["x"]).to eq nodes["r2"]
@@ -407,16 +411,20 @@ def response(header)
407411

408412
context "when parsing JSON" do
409413
it "parses binding results correctly" do
410-
xml = File.read("spec/fixtures/results.json")
414+
json = File.read("spec/fixtures/results.json")
411415
nodes = {}
412-
solutions = SPARQL::Client::parse_json_bindings(xml, nodes)
416+
solutions = SPARQL::Client::parse_json_bindings(json, nodes)
413417
expect(solutions).to eq RDF::Query::Solutions.new([
414418
RDF::Query::Solution.new(
415419
x: RDF::Node.new("r2"),
416420
hpage: RDF::URI.new("http://work.example.org/bob/"),
417421
name: RDF::Literal.new("Bob", language: "en"),
418422
age: RDF::Literal.new("30", datatype: "http://www.w3.org/2001/XMLSchema#integer"),
419423
mbox: RDF::URI.new("mailto:[email protected]"),
424+
triple: RDF::Statement(
425+
RDF::URI('http://work.example.org/s'),
426+
RDF::URI('http://work.example.org/p'),
427+
RDF::URI('http://work.example.org/o')),
420428
)
421429
])
422430
expect(solutions[0]["x"]).to eq nodes["r2"]

spec/fixtures/results.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,23 @@
3535
"mbox": {
3636
"type": "uri",
3737
"value": "mailto:[email protected]"
38+
},
39+
"triple": {
40+
"type": "triple",
41+
"value": {
42+
"subject": {
43+
"type": "uri",
44+
"value": "http://work.example.org/s"
45+
},
46+
"predicate": {
47+
"type": "uri",
48+
"value": "http://work.example.org/p"
49+
},
50+
"object": {
51+
"type": "uri",
52+
"value": "http://work.example.org/o"
53+
}
54+
}
3855
}
3956
}
4057
]

spec/fixtures/results.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,13 @@
2525
<binding name="mbox">
2626
<uri>mailto:[email protected]</uri>
2727
</binding>
28+
<binding name="triple">
29+
<triple>
30+
<subject><uri>http://work.example.org/s</uri></subject>
31+
<predicate><uri>http://work.example.org/p</uri></predicate>
32+
<object><uri>http://work.example.org/o</uri></object>
33+
</triple>
34+
</binding>
2835
</result>
2936
</results>
3037
</sparql>

spec/spec_helper.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@
44

55
begin
66
require 'simplecov'
7-
require 'coveralls'
7+
require 'simplecov-lcov'
8+
9+
SimpleCov::Formatter::LcovFormatter.config do |config|
10+
#Coveralls is coverage by default/lcov. Send info results
11+
config.report_with_single_file = true
12+
config.single_report_path = 'coverage/lcov.info'
13+
end
814

915
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new([
1016
SimpleCov::Formatter::HTMLFormatter,
11-
Coveralls::SimpleCov::Formatter
17+
SimpleCov::Formatter::LcovFormatter
1218
])
1319
SimpleCov.start do
1420
add_filter "/spec/"

0 commit comments

Comments
 (0)