tripod 0.11.1 → 0.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8873c49c672b410661df8ca87c7702c31476e989
4
- data.tar.gz: 4526e140d24120ea3a71ba4d18d019a1d299ee9f
3
+ metadata.gz: 0e8b2231c1e29b1c0505ed07246fed4759caec36
4
+ data.tar.gz: 7f11adc9aeb2eb8da2cc0bdc9cdc7e5c6aed0375
5
5
  SHA512:
6
- metadata.gz: dfce073aec904468e271f84a28899922b26a4ce9acd2cfda3dda50484e6087a174e56cda90616ff349cc33add8813a267d6000b1f563aca72ebd928e713dd28f
7
- data.tar.gz: 734e1c9747d1266a79e811bb28f30051da8676e6b3a38812c4673b7c9b5e53b38e6633d927088de2693d9910c1df781d3e7731efacc982f8653edc740d8de244
6
+ metadata.gz: 631ba8493a054ed194a00582d6da8bb834d5e30493a82f3097ff5f0c6219637d7dec3049ec6fad916c280e2b9cd2327caed7500ee4d87c2c987c2f223207f4ae
7
+ data.tar.gz: 8504919b265ce0582f2d0d1a60795214bd119867a02ec32892d7be22d40a48ebe6228d5ab2e38c1f582a1dcd561658757236b3192e8ba3791a2d1f7c91c8cdcf
@@ -58,6 +58,11 @@ module Tripod
58
58
  mattr_accessor :response_limit_bytes
59
59
  @@response_limit_bytes = 5.megabytes
60
60
 
61
+ # this is a default to cope with headers in stardog
62
+ # override if you wish to remove the text/plain fallback
63
+ mattr_accessor :ntriples_header_str
64
+ @@ntriples_header_str = "application/n-triples, text/plain"
65
+
61
66
  mattr_accessor :cache_store
62
67
 
63
68
  mattr_accessor :logger
@@ -109,7 +109,7 @@ module Tripod::Finders
109
109
  uris_sparql_str = uris.map{ |u| "<#{u.to_s}>" }.join(" ")
110
110
 
111
111
  # Do a big describe statement, and read the results into an in-memory repo
112
- ntriples_string = Tripod::SparqlClient::Query.query("CONSTRUCT { ?s ?p ?o } WHERE { VALUES ?s { #{uris_sparql_str} }. ?s ?p ?o . }", "application/n-triples")
112
+ ntriples_string = Tripod::SparqlClient::Query.query("CONSTRUCT { ?s ?p ?o } WHERE { VALUES ?s { #{uris_sparql_str} }. ?s ?p ?o . }", Tripod.ntriples_header_str)
113
113
  graph = _rdf_graph_from_ntriples_string(ntriples_string, graph)
114
114
  end
115
115
 
@@ -149,7 +149,7 @@ module Tripod::Finders
149
149
 
150
150
  # given a construct or describe query, return a graph of triples.
151
151
  def _graph_of_triples_from_construct_or_describe(construct_query)
152
- ntriples_str = Tripod::SparqlClient::Query.query(construct_query, "application/n-triples")
152
+ ntriples_str = Tripod::SparqlClient::Query.query(construct_query, Tripod.ntriples_header_str)
153
153
  _rdf_graph_from_ntriples_string(ntriples_str, graph=nil)
154
154
  end
155
155
 
@@ -207,7 +207,7 @@ module Tripod::Finders
207
207
  # @option options [ String ] uri_variable The name of the uri variable in the query, if not 'uri'
208
208
  # @option options [ String ] accept_header The http accept header (default application/n-triples)
209
209
  def _raw_describe_select_results(select_sparql, opts={})
210
- accept_header = opts[:accept_header] || "application/n-triples"
210
+ accept_header = opts[:accept_header] || Tripod.ntriples_header_str
211
211
  query = _describe_query_for_select(select_sparql, :uri_variable => opts[:uri_variable])
212
212
  Tripod::SparqlClient::Query.query(query, accept_header)
213
213
  end
@@ -55,7 +55,7 @@ module Tripod::Repository
55
55
  g
56
56
  end
57
57
 
58
- def retrieve_triples_from_database(accept_header="application/n-triples")
58
+ def retrieve_triples_from_database(accept_header=Tripod.ntriples_header_str)
59
59
  Tripod::SparqlClient::Query.query(self.class.all_triples_query(uri, graph_uri: self.graph_uri), accept_header)
60
60
  end
61
61
 
@@ -53,10 +53,10 @@ module Tripod
53
53
  def to_nt
54
54
  time_serialization('nt') do
55
55
  if @criteria
56
- @criteria.serialize(:return_graph => @return_graph, :accept_header => "application/n-triples")
56
+ @criteria.serialize(:return_graph => @return_graph, :accept_header => Tripod.ntriples_header_str)
57
57
  elsif @sparql_query_str && @resource_class
58
58
  # run the query as a describe.
59
- @resource_class._raw_describe_select_results(@sparql_query_str, :accept_header => "application/n-triples")
59
+ @resource_class._raw_describe_select_results(@sparql_query_str, :accept_header => Tripod.ntriples_header_str)
60
60
  else
61
61
  # for n-triples we can just concatenate them
62
62
  nt = ""
@@ -15,7 +15,7 @@ module Tripod::Serialization
15
15
 
16
16
  # Serialises this resource's triples to n-triples
17
17
  def to_nt
18
- retrieve_triples_from_database(accept_header="application/n-triples")
18
+ retrieve_triples_from_database(accept_header=Tripod.ntriples_header_str)
19
19
  end
20
20
 
21
21
  # Serialises this resource's triples to JSON-LD
@@ -1,3 +1,3 @@
1
1
  module Tripod
2
- VERSION = "0.11.1"
2
+ VERSION = "0.11.2"
3
3
  end
@@ -30,7 +30,7 @@ describe Tripod::Repository do
30
30
 
31
31
  context 'graph_uri set on object' do
32
32
  it 'populates the object with triples, restricted to the graph_uri' do
33
- Tripod::SparqlClient::Query.should_receive(:query).with(Person.all_triples_query(person.uri, graph_uri: person.graph_uri), 'application/n-triples').and_call_original
33
+ Tripod::SparqlClient::Query.should_receive(:query).with(Person.all_triples_query(person.uri, graph_uri: person.graph_uri), Tripod.ntriples_header_str).and_call_original
34
34
  person.hydrate!
35
35
  person.repository.should_not be_empty
36
36
  end
@@ -38,7 +38,7 @@ describe Tripod::Repository do
38
38
 
39
39
  context 'graph_uri not set on object' do
40
40
  it 'populates the object with triples, not to a graph' do
41
- Tripod::SparqlClient::Query.should_receive(:query).with(Person.all_triples_query(person.uri), 'application/n-triples').and_call_original
41
+ Tripod::SparqlClient::Query.should_receive(:query).with(Person.all_triples_query(person.uri), Tripod.ntriples_header_str).and_call_original
42
42
  graphless_resource.hydrate!
43
43
  graphless_resource.repository.should_not be_empty
44
44
  end
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.11.1
4
+ version: 0.11.2
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: 2015-07-09 00:00:00.000000000 Z
13
+ date: 2015-11-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rest-client