Skip to content

Commit eb4148c

Browse files
committed
Finish 0.3.0
2 parents 9eaca3a + 4885f42 commit eb4148c

File tree

8 files changed

+98
-43
lines changed

8 files changed

+98
-43
lines changed

.github/workflows/ci.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,27 @@ jobs:
1515
runs-on: ubuntu-latest
1616
env:
1717
CI: true
18+
VIRTUOSO_INTEGRATION_TESTS: true
19+
ALLOW_FAILURES: ${{ endsWith(matrix.ruby, 'head') }}
1820
strategy:
1921
fail-fast: false
2022
matrix:
2123
ruby:
22-
- 2.4
23-
- 2.5
2424
- 2.6
2525
- 2.7
2626
- 3.0
27-
- ruby-head # Eventualy
27+
- 3.1
28+
- ruby-head
2829
- jruby
30+
services:
31+
virtuoso:
32+
image: tenforce/virtuoso
33+
env:
34+
DBA_PASSWORD: tester
35+
SPARQL_UPDATE: true
36+
ports:
37+
- 8890:8890
38+
- 1111:1111
2939
steps:
3040
- name: Clone repository
3141
uses: actions/checkout@v2
@@ -35,6 +45,10 @@ jobs:
3545
ruby-version: ${{ matrix.ruby }}
3646
- name: Install dependencies
3747
run: bundle install --jobs 4 --retry 3
48+
- name: Wait to give Virtuoso a little extra time
49+
uses: juliangruber/sleep-action@v1
50+
with:
51+
time: '3s'
3852
- name: Run tests
39-
run: bundle exec rspec spec
53+
run: ruby --version; bundle exec rspec spec || $ALLOW_FAILURES
4054

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,6 @@
33
Gemfile.lock
44
pkg/*
55
.idea/
6+
.yardoc/
67
/.byebug_history
8+
doc/*

.travis.yml

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

Gemfile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@ source "https://rubygems.org"
33
# Specify your gem's dependencies in rdf-virtuoso.gemspec
44
gemspec
55

6-
gem "rdf", github: "ruby-rdf/rdf", branch: "develop"
7-
gem "rdf-spec", github: "ruby-rdf/rdf-spec", branch: "develop"
6+
gem "rdf", github: "ruby-rdf/rdf", branch: "develop"
7+
8+
group :development, :test do
9+
gem 'rdf-isomorphic', git: "https://github.com/ruby-rdf/rdf-isomorphic", branch: "develop"
10+
gem "rdf-spec", github: "ruby-rdf/rdf-spec", branch: "develop"
11+
gem "rdf-vocab", github: "ruby-rdf/rdf-vocab", branch: "develop"
12+
end
813

914
group :debug do
1015
gem "byebug", platforms: :mri

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.2.0
1+
0.3.0

lib/rdf/virtuoso/query.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,22 +240,22 @@ def define(string)
240240
self
241241
end
242242

243-
# @param RDF::URI uri
243+
# @param [RDF::URI] uri
244244
# @return [Query]
245245
# @see http://www.w3.org/TR/rdf-sparql-query/#specDataset
246246
def from(uri)
247247
options[:from] = uri
248248
self
249249
end
250250

251-
# @param RDF::URI uri
251+
# @param [RDF::URI] uri
252252
# @return [Query]
253253
def from_named(uri)
254254
(options[:from_named] ||= []) << uri
255255
self
256256
end
257257

258-
# @param RDF::URI uri
258+
# @param [RDF::URI] uri
259259
# @return [Query]
260260
def graph(uri)
261261
options[:graph] = uri
@@ -284,7 +284,7 @@ def group(*patterns)
284284
end
285285

286286
##
287-
# @param RDF::URI uri
287+
# @param [RDF::URI] uri
288288
# @return [Query]
289289
# Inline version of graph
290290
def graph2(uri)
@@ -710,7 +710,7 @@ def inspect
710710
##
711711
# Serializes an RDF::Value into a format appropriate for select, construct, and where clauses
712712
#
713-
# @param [RDF::Value]
713+
# @param [RDF::Value] value
714714
# @return [String]
715715
# @private
716716
def serialize_value(value)

rdf-virtuoso.gemspec

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# -*- encoding: utf-8 -*-
1+
2# -*- encoding: utf-8 -*-
22

33
Gem::Specification.new do |s|
44
s.name = 'rdf-virtuoso'
@@ -15,12 +15,14 @@ Gem::Specification.new do |s|
1515
s.files = %w(README.md LICENSE VERSION) + Dir.glob('lib/**/*.rb')
1616
s.require_paths = ['lib']
1717

18-
s.add_runtime_dependency 'rdf', '~> 3.1'
19-
s.add_runtime_dependency 'httparty', '~> 0.18.1'
20-
s.add_runtime_dependency 'api_smith', '~> 1.3.0'
18+
s.required_ruby_version = '>= 2.6'
2119

22-
s.add_development_dependency 'rspec', '~> 3.10'
23-
s.add_development_dependency 'rdf-spec', '~> 3.1'
24-
s.add_development_dependency 'rdf-vocab', '~> 3.1'
20+
s.add_runtime_dependency 'rdf', '~> 3.2'
21+
s.add_runtime_dependency 'httparty', '~> 0.20'
22+
s.add_runtime_dependency 'api_smith', '~> 1.3.0'
23+
24+
s.add_development_dependency 'rspec', '~> 3.10'
25+
s.add_development_dependency 'rdf-spec', '~> 3.2'
26+
s.add_development_dependency 'rdf-vocab', '~> 3.2'
2527

2628
end

spec/integration_spec.rb

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# frozen_string_literal: true
2+
3+
$LOAD_PATH.unshift '.'
4+
require_relative 'spec_helper'
5+
require 'rdf/spec/repository'
6+
7+
# these tests rely on a Virtuoso service being available, at port 8890
8+
# the easiest way to do this is with docker ( https://docs.docker.com/get-docker/ ), running the following:
9+
# docker run -p 8890:8890 -p 1111:1111 -e DBA_PASSWORD=tester -e SPARQL_UPDATE=true --name virtuoso-testing -d tenforce/virtuoso
10+
# when finished you can stop with
11+
# docker stop virtuoso-testing
12+
#
13+
# to avoid the tests being skipped, you will need to set the environment variable VIRTUOSO_INTEGRATION_TESTS, e.g.
14+
# VIRTUOSO_INTEGRATION_TESTS=true bundle exec rspec spec
15+
16+
skip = ENV['VIRTUOSO_INTEGRATION_TESTS'] ? false : 'Skipping Integration tests against a running repository, see spec/integration_spec.rb'
17+
18+
describe RDF::Virtuoso::Repository, skip: skip do
19+
context('when interacting with a virtuoso repository service') do
20+
subject(:repository) do
21+
described_class.new(uri,
22+
update_uri: update_uri,
23+
username: username,
24+
password: password,
25+
auth_method: 'digest')
26+
end
27+
28+
let(:uri) { 'http://localhost:8890/sparql' }
29+
let(:update_uri) { 'http://localhost:8890/sparql-auth' }
30+
let(:password) { 'tester' }
31+
let(:username) { 'dba' }
32+
let(:graph) { 'http://example.org/' }
33+
34+
it 'is able to select' do
35+
# check a single triple result which is unlikely to change
36+
query = RDF::Virtuoso::Query.select.where([RDF::URI('http://localhost:8890/sparql'),
37+
RDF::URI('http://www.w3.org/ns/sparql-service-description#endpoint'), :o])
38+
39+
expect(repository.select(query).last.o).to eql RDF::URI('http://localhost:8890/sparql')
40+
end
41+
42+
it 'is able to insert' do
43+
query = RDF::Virtuoso::Query.insert([RDF::URI('subject:person'), RDF::URI('http://purl.org/dc/terms/title'),
44+
'The title']).graph(graph)
45+
expect(repository.insert(query)).to eql 'Insert into <http://example.org/>, 1 (or less) triples -- done'
46+
47+
# #clean up
48+
query = RDF::Virtuoso::Query.delete([RDF::URI('subject:person'), :p,
49+
:o]).where([RDF::URI('subject:person'), :p, :o]).graph(graph)
50+
repository.delete(query)
51+
end
52+
53+
# commented out until conformance issues are resolved, otherwise there are many errors
54+
# it_behaves_like "an RDF::Repository"
55+
end
56+
end

0 commit comments

Comments
 (0)