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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 97401517139ef33894d86ded8cd4ed10007dc75e
4
- data.tar.gz: aabb5ab123ef69ca3805afc94425815a915c4a9d
3
+ metadata.gz: 6751a737aaf323ae879368a7b41124d3b321f515
4
+ data.tar.gz: 0f69d8bff3806d7862200baa3095a6f2d488b7d0
5
5
  SHA512:
6
- metadata.gz: ea32f4217e66b4490113c77e47fc5c5f1e0ba0b924a46afb8bd094eb459e2aa0036b17bdfb76f1a1c12fea2aa50be205df6dade6b9ee58c77ec5895333bd33ae
7
- data.tar.gz: 148e7e01dc2b3afeac9ee3f313a4db039fbb688f93358cf217ce8c6fb70aa5a1eb4e15c3d1ad84748229de498a473a1eed04bac929eda9cbf6d262f36149c654
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
@@ -8,4 +8,5 @@ group :test do
8
8
  gem "webmock"
9
9
  gem 'pry', '~> 0.9.12.6'
10
10
  gem 'binding_of_caller', '~> 0.7.2'
11
+ gem 'rest-client', '2.0.0'
11
12
  end
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Build Status](https://travis-ci.org/Swirrl/tripod.svg?branch=master)](https://travis-ci.org/Swirrl/tripod)
2
+
1
3
  # Tripod
2
4
 
3
5
  ActiveModel-style Ruby ORM for RDF Linked Data. Works with SPARQL 1.1 HTTP endpoints.
@@ -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.merge({:content_type => 'application/sparql-update'})
102
+ headers = Tripod.extra_endpoint_headers
103
103
  RestClient::Request.execute(
104
104
  :method => :post,
105
105
  :url => Tripod.update_endpoint,
@@ -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
- raise Tripod::Errors::BadSparqlRequest.new(res.body) if res.code.to_s != "200"
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
 
@@ -1,3 +1,3 @@
1
1
  module Tripod
2
- VERSION = "0.14.0"
2
+ VERSION = "0.15.0"
3
3
  end
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
- # 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'
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://127.0.0.1:3002/sparql/raw/update'
39
- config.query_endpoint = 'http://127.0.0.1:3002/sparql/raw'
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
+ .
@@ -0,0 +1,5 @@
1
+ #!/bin/bash
2
+
3
+ FUSEKI_HOME=/opt/fuseki/jena-fuseki1-1.5.0
4
+ cd /opt/fuseki/jena-fuseki1-1.5.0
5
+ env JAVA_HOME=/usr/lib/jvm/java-8-oracle/bin/java JVM_ARGS=-Xmx4096M ./fuseki-server --config="/opt/fuseki/config/config.ttl" > /dev/null &
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.14.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-02-28 00:00:00.000000000 Z
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: