tripod 0.14.0 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +24 -0
- data/Gemfile +1 -0
- data/README.md +2 -0
- data/lib/tripod/sparql_client.rb +1 -1
- data/lib/tripod/streaming.rb +6 -1
- data/lib/tripod/version.rb +1 -1
- data/spec/spec_helper.rb +5 -5
- data/spec/tripod/sparql_client_spec.rb +35 -0
- data/travis/bootstrap_fuseki.sh +10 -0
- data/travis/config_tripod.ttl +47 -0
- data/travis/run_fuseki.sh +5 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6751a737aaf323ae879368a7b41124d3b321f515
|
4
|
+
data.tar.gz: 0f69d8bff3806d7862200baa3095a6f2d488b7d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ffe4f7caa4d820206963c8d7797627619c7151fd4c78716c300ec10b9c430e0724cbbc0b60d5fbefe5e68400e1a31b1f6bd0f9bb0fa1a1b1e7ac4eab3c63df2
|
7
|
+
data.tar.gz: 55056138bc7eb95d07d25e76f11c712dfb861215884690e0931db920f967bba2998a8da7c8a8922955ef6a701817e048e24cd733420a86b0e19a10cd4f056047
|
data/.travis.yml
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
language: ruby
|
2
|
+
cache: bundler
|
3
|
+
sudo: required
|
4
|
+
jdk:
|
5
|
+
- oraclejdk8
|
6
|
+
services:
|
7
|
+
- memcached
|
8
|
+
- mongodb
|
9
|
+
- elasticsearch
|
10
|
+
rvm:
|
11
|
+
- 2.2
|
12
|
+
before_install:
|
13
|
+
- sudo chmod +rx ./travis/*
|
14
|
+
- sudo chown -R travis ./travis/*
|
15
|
+
- "./travis/bootstrap_fuseki.sh"
|
16
|
+
before_script:
|
17
|
+
- "./travis/run_fuseki.sh"
|
18
|
+
- sleep 30
|
19
|
+
script: travis_retry bundle exec rspec spec --fail-fast
|
20
|
+
notifications:
|
21
|
+
slack:
|
22
|
+
secure: gLVK3ij0fS3vk61tUq8jnombeoRBcyiL8+K9wzC7Bvqhp19ujWEyCMXxeqEVaVFR0Yc54Jiu+5LxRTx9v0B3VwyPykG7GJGcsGQ/doX5S2kieVexumSf2qh3Uj9kU/o6BYr3zjH6ABP6e7BbBdS3I7G2BZA7IQCx9XkAa8+gUpQ=
|
23
|
+
on_success: change
|
24
|
+
on_failure: always
|
data/Gemfile
CHANGED
data/README.md
CHANGED
data/lib/tripod/sparql_client.rb
CHANGED
@@ -99,7 +99,7 @@ module Tripod::SparqlClient
|
|
99
99
|
# @return [ true ]
|
100
100
|
def self.update(sparql)
|
101
101
|
begin
|
102
|
-
headers = Tripod.extra_endpoint_headers
|
102
|
+
headers = Tripod.extra_endpoint_headers
|
103
103
|
RestClient::Request.execute(
|
104
104
|
:method => :post,
|
105
105
|
:url => Tripod.update_endpoint,
|
data/lib/tripod/streaming.rb
CHANGED
@@ -39,7 +39,12 @@ module Tripod
|
|
39
39
|
response_duration = Time.now - request_start_time if Tripod.logger.debug?
|
40
40
|
|
41
41
|
Tripod.logger.debug "TRIPOD: received response code: #{res.code} in: #{response_duration} secs"
|
42
|
-
|
42
|
+
|
43
|
+
if res.code.to_i == 503
|
44
|
+
raise Tripod::Errors::Timeout.new
|
45
|
+
elsif res.code.to_s != "200"
|
46
|
+
raise Tripod::Errors::BadSparqlRequest.new(res.body)
|
47
|
+
end
|
43
48
|
|
44
49
|
stream_start_time = Time.now if Tripod.logger.debug?
|
45
50
|
|
data/lib/tripod/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -31,12 +31,12 @@ end
|
|
31
31
|
|
32
32
|
# configure any settings for testing...
|
33
33
|
Tripod.configure do |config|
|
34
|
-
|
35
|
-
|
36
|
-
|
34
|
+
config.update_endpoint = 'http://127.0.0.1:3030/tripod-test/update'
|
35
|
+
config.query_endpoint = 'http://127.0.0.1:3030/tripod-test/sparql'
|
36
|
+
config.data_endpoint = 'http://127.0.0.1:3030/tripod-test/data'
|
37
37
|
|
38
|
-
config.update_endpoint = 'http://
|
39
|
-
config.query_endpoint = 'http://
|
38
|
+
# config.update_endpoint = 'http://localhost:5820/test/update'
|
39
|
+
# config.query_endpoint = 'http://localhost:5820/test/query'
|
40
40
|
#config.data_endpoint = 'http://127.0.0.1:3030/tripod-test/data'
|
41
41
|
end
|
42
42
|
|
@@ -21,5 +21,40 @@ module Tripod::SparqlClient
|
|
21
21
|
end
|
22
22
|
end
|
23
23
|
end
|
24
|
+
|
25
|
+
describe '.query' do
|
26
|
+
let(:port) { 8080 }
|
27
|
+
before do
|
28
|
+
@query_endpoint = Tripod.query_endpoint
|
29
|
+
Tripod.query_endpoint = "http://localhost:#{port}/sparql/query"
|
30
|
+
@server_thread = Thread.new do
|
31
|
+
Timeout::timeout(5) do
|
32
|
+
listener = TCPServer.new port
|
33
|
+
client = listener.accept
|
34
|
+
|
35
|
+
# read request
|
36
|
+
loop do
|
37
|
+
line = client.gets
|
38
|
+
break if line =~ /^\s*$/
|
39
|
+
end
|
40
|
+
|
41
|
+
# write response
|
42
|
+
client.puts "HTTP/1.1 503 Timeout"
|
43
|
+
client.puts "Content-Length: 0"
|
44
|
+
client.puts
|
45
|
+
client.puts
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
after do
|
51
|
+
Tripod.query_endpoint = @query_endpoint
|
52
|
+
@server_thread.join
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'should raise timeout error' do
|
56
|
+
expect { Tripod::SparqlClient::Query.query('SELECT * WHERE { ?s ?p ?o }', 'application/n-triples') }.to raise_error(Tripod::Errors::Timeout)
|
57
|
+
end
|
58
|
+
end
|
24
59
|
end
|
25
60
|
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
mkdir -p /home/travis/tdb_data
|
4
|
+
mkdir -p /opt/fuseki
|
5
|
+
mkdir /opt/fuseki/config
|
6
|
+
sudo apt-get update
|
7
|
+
sudo apt-get -y install tar wget
|
8
|
+
wget http://apache.mirror.anlx.net/jena/binaries/jena-fuseki1-1.5.0-distribution.tar.gz -O /opt/fuseki/jena-fuseki-1.5.0.tar.gz
|
9
|
+
tar -xvzf /opt/fuseki/jena-fuseki-1.5.0.tar.gz -C /opt/fuseki
|
10
|
+
mv ./travis/config_tripod.ttl /opt/fuseki/config/config.ttl
|
@@ -0,0 +1,47 @@
|
|
1
|
+
@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
|
2
|
+
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
3
|
+
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
4
|
+
@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
|
5
|
+
@prefix fuseki: <http://jena.apache.org/fuseki#> .
|
6
|
+
|
7
|
+
[] rdf:type fuseki:Server ;
|
8
|
+
# Services available. Only explicitly listed services are configured.
|
9
|
+
# If there is a service description not linked from this list, it is ignored.
|
10
|
+
fuseki:services (
|
11
|
+
<#tripod-development>
|
12
|
+
<#tripod-test>
|
13
|
+
) .
|
14
|
+
|
15
|
+
[] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .
|
16
|
+
tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
|
17
|
+
tdb:GraphTDB rdfs:subClassOf ja:Model .
|
18
|
+
|
19
|
+
<#tripod-development> rdf:type fuseki:Service ;
|
20
|
+
fuseki:name "tripod-development" ; # http://host:port/pmddev
|
21
|
+
fuseki:serviceQuery "sparql" ; # SPARQL query service http://host:port/pmddev/sparql?query=...
|
22
|
+
fuseki:serviceUpdate "update" ; # SPARQL update servicehttp://host:port/pmddev/update?query=
|
23
|
+
fuseki:serviceReadWriteGraphStore "data" ; # SPARQL Graph store protocol (read and write)
|
24
|
+
fuseki:dataset <#dataset-tripod-development> ;
|
25
|
+
.
|
26
|
+
|
27
|
+
<#dataset-tripod-development> rdf:type tdb:DatasetTDB ;
|
28
|
+
tdb:location "/home/travis/tdb_data/tripod-development" ; # change to suit your local installation
|
29
|
+
# Query timeout on this dataset (1s, 1000 milliseconds)
|
30
|
+
ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue "10000" ] ;
|
31
|
+
tdb:unionDefaultGraph true ;
|
32
|
+
.
|
33
|
+
|
34
|
+
<#tripod-test> rdf:type fuseki:Service ;
|
35
|
+
fuseki:name "tripod-test" ; # http://host:port/pmdtest
|
36
|
+
fuseki:serviceQuery "sparql" ; # SPARQL query service http://host:port/pmdtest/sparql?query=...
|
37
|
+
fuseki:serviceUpdate "update" ; # SPARQL update servicehttp://host:port/pmdtest/update?query=
|
38
|
+
fuseki:serviceReadWriteGraphStore "data" ; # SPARQL Graph store protocol (read and write)
|
39
|
+
fuseki:dataset <#dataset-tripod-test> ;
|
40
|
+
.
|
41
|
+
|
42
|
+
<#dataset-tripod-test> rdf:type tdb:DatasetTDB ;
|
43
|
+
tdb:location "/home/travis/tdb_data/tripod-test" ; # change to suit your local installation
|
44
|
+
# Query timeout on this dataset (1s, 1000 milliseconds)
|
45
|
+
ja:context [ ja:cxtName "arq:queryTimeout" ; ja:cxtValue "10000" ] ;
|
46
|
+
tdb:unionDefaultGraph true ;
|
47
|
+
.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tripod
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ric Roberts
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-
|
13
|
+
date: 2017-04-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rest-client
|
@@ -202,6 +202,7 @@ files:
|
|
202
202
|
- ".autotest"
|
203
203
|
- ".gitignore"
|
204
204
|
- ".rspec"
|
205
|
+
- ".travis.yml"
|
205
206
|
- Gemfile
|
206
207
|
- LICENSE
|
207
208
|
- README.md
|
@@ -281,6 +282,9 @@ files:
|
|
281
282
|
- spec/tripod/state_spec.rb
|
282
283
|
- spec/tripod/streaming_spec.rb
|
283
284
|
- spec/tripod/validations/is_url_spec.rb
|
285
|
+
- travis/bootstrap_fuseki.sh
|
286
|
+
- travis/config_tripod.ttl
|
287
|
+
- travis/run_fuseki.sh
|
284
288
|
- tripod.gemspec
|
285
289
|
homepage: http://github.com/Swirrl/tripod
|
286
290
|
licenses:
|