Skip to content

Commit

Permalink
Finish 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Dec 29, 2021
2 parents 9eaca3a + 4885f42 commit eb4148c
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 43 deletions.
22 changes: 18 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,27 @@ jobs:
runs-on: ubuntu-latest
env:
CI: true
VIRTUOSO_INTEGRATION_TESTS: true
ALLOW_FAILURES: ${{ endsWith(matrix.ruby, 'head') }}
strategy:
fail-fast: false
matrix:
ruby:
- 2.4
- 2.5
- 2.6
- 2.7
- 3.0
- ruby-head # Eventualy
- 3.1
- ruby-head
- jruby
services:
virtuoso:
image: tenforce/virtuoso
env:
DBA_PASSWORD: tester
SPARQL_UPDATE: true
ports:
- 8890:8890
- 1111:1111
steps:
- name: Clone repository
uses: actions/checkout@v2
Expand All @@ -35,6 +45,10 @@ jobs:
ruby-version: ${{ matrix.ruby }}
- name: Install dependencies
run: bundle install --jobs 4 --retry 3
- name: Wait to give Virtuoso a little extra time
uses: juliangruber/sleep-action@v1
with:
time: '3s'
- name: Run tests
run: bundle exec rspec spec
run: ruby --version; bundle exec rspec spec || $ALLOW_FAILURES

2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
Gemfile.lock
pkg/*
.idea/
.yardoc/
/.byebug_history
doc/*
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

9 changes: 7 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,13 @@ source "https://rubygems.org"
# Specify your gem's dependencies in rdf-virtuoso.gemspec
gemspec

gem "rdf", github: "ruby-rdf/rdf", branch: "develop"
gem "rdf-spec", github: "ruby-rdf/rdf-spec", branch: "develop"
gem "rdf", github: "ruby-rdf/rdf", branch: "develop"

group :development, :test do
gem 'rdf-isomorphic', git: "https://github.com/ruby-rdf/rdf-isomorphic", branch: "develop"
gem "rdf-spec", github: "ruby-rdf/rdf-spec", branch: "develop"
gem "rdf-vocab", github: "ruby-rdf/rdf-vocab", branch: "develop"
end

group :debug do
gem "byebug", platforms: :mri
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.0
0.3.0
10 changes: 5 additions & 5 deletions lib/rdf/virtuoso/query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -240,22 +240,22 @@ def define(string)
self
end

# @param RDF::URI uri
# @param [RDF::URI] uri
# @return [Query]
# @see http://www.w3.org/TR/rdf-sparql-query/#specDataset
def from(uri)
options[:from] = uri
self
end

# @param RDF::URI uri
# @param [RDF::URI] uri
# @return [Query]
def from_named(uri)
(options[:from_named] ||= []) << uri
self
end

# @param RDF::URI uri
# @param [RDF::URI] uri
# @return [Query]
def graph(uri)
options[:graph] = uri
Expand Down Expand Up @@ -284,7 +284,7 @@ def group(*patterns)
end

##
# @param RDF::URI uri
# @param [RDF::URI] uri
# @return [Query]
# Inline version of graph
def graph2(uri)
Expand Down Expand Up @@ -710,7 +710,7 @@ def inspect
##
# Serializes an RDF::Value into a format appropriate for select, construct, and where clauses
#
# @param [RDF::Value]
# @param [RDF::Value] value
# @return [String]
# @private
def serialize_value(value)
Expand Down
16 changes: 9 additions & 7 deletions rdf-virtuoso.gemspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- encoding: utf-8 -*-
2# -*- encoding: utf-8 -*-

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

s.add_runtime_dependency 'rdf', '~> 3.1'
s.add_runtime_dependency 'httparty', '~> 0.18.1'
s.add_runtime_dependency 'api_smith', '~> 1.3.0'
s.required_ruby_version = '>= 2.6'

s.add_development_dependency 'rspec', '~> 3.10'
s.add_development_dependency 'rdf-spec', '~> 3.1'
s.add_development_dependency 'rdf-vocab', '~> 3.1'
s.add_runtime_dependency 'rdf', '~> 3.2'
s.add_runtime_dependency 'httparty', '~> 0.20'
s.add_runtime_dependency 'api_smith', '~> 1.3.0'

s.add_development_dependency 'rspec', '~> 3.10'
s.add_development_dependency 'rdf-spec', '~> 3.2'
s.add_development_dependency 'rdf-vocab', '~> 3.2'

end
56 changes: 56 additions & 0 deletions spec/integration_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# frozen_string_literal: true

$LOAD_PATH.unshift '.'
require_relative 'spec_helper'
require 'rdf/spec/repository'

# these tests rely on a Virtuoso service being available, at port 8890
# the easiest way to do this is with docker ( https://docs.docker.com/get-docker/ ), running the following:
# docker run -p 8890:8890 -p 1111:1111 -e DBA_PASSWORD=tester -e SPARQL_UPDATE=true --name virtuoso-testing -d tenforce/virtuoso
# when finished you can stop with
# docker stop virtuoso-testing
#
# to avoid the tests being skipped, you will need to set the environment variable VIRTUOSO_INTEGRATION_TESTS, e.g.
# VIRTUOSO_INTEGRATION_TESTS=true bundle exec rspec spec

skip = ENV['VIRTUOSO_INTEGRATION_TESTS'] ? false : 'Skipping Integration tests against a running repository, see spec/integration_spec.rb'

describe RDF::Virtuoso::Repository, skip: skip do
context('when interacting with a virtuoso repository service') do
subject(:repository) do
described_class.new(uri,
update_uri: update_uri,
username: username,
password: password,
auth_method: 'digest')
end

let(:uri) { 'http://localhost:8890/sparql' }
let(:update_uri) { 'http://localhost:8890/sparql-auth' }
let(:password) { 'tester' }
let(:username) { 'dba' }
let(:graph) { 'http://example.org/' }

it 'is able to select' do
# check a single triple result which is unlikely to change
query = RDF::Virtuoso::Query.select.where([RDF::URI('http://localhost:8890/sparql'),
RDF::URI('http://www.w3.org/ns/sparql-service-description#endpoint'), :o])

expect(repository.select(query).last.o).to eql RDF::URI('http://localhost:8890/sparql')
end

it 'is able to insert' do
query = RDF::Virtuoso::Query.insert([RDF::URI('subject:person'), RDF::URI('http://purl.org/dc/terms/title'),
'The title']).graph(graph)
expect(repository.insert(query)).to eql 'Insert into <http://example.org/>, 1 (or less) triples -- done'

# #clean up
query = RDF::Virtuoso::Query.delete([RDF::URI('subject:person'), :p,
:o]).where([RDF::URI('subject:person'), :p, :o]).graph(graph)
repository.delete(query)
end

# commented out until conformance issues are resolved, otherwise there are many errors
# it_behaves_like "an RDF::Repository"
end
end

0 comments on commit eb4148c

Please sign in to comment.