rdf-ldp 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/IMPLEMENTATION.md +4 -2
- data/README.md +4 -4
- data/VERSION +1 -1
- data/app/lamprey.rb +2 -2
- data/lib/rdf/ldp/direct_container.rb +18 -8
- data/lib/rdf/ldp/indirect_container.rb +12 -5
- data/lib/rdf/ldp/non_rdf_source.rb +7 -4
- data/lib/rdf/ldp/rdf_source.rb +5 -8
- data/lib/rdf/ldp/resource.rb +5 -1
- metadata +46 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6984fe1fabab30524697db0471c39721f68fb54
|
4
|
+
data.tar.gz: fc3b6d95051b4c82b02cb9d474a379b15e5584d0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0243e142e3b59232c19360ad4b507dda9e32ea9643e794318fb5227fe653261b64a61b82e655620976a05fec535f35193c5c7fccb225ed65669ff07192875693
|
7
|
+
data.tar.gz: 7256e7bb1c2c2a59c16e64def71c9101e5cd1b071d6f2432564d1dfb3d8feb559732b85821a3e0a71773f15f69cab5d8ee1da9e36af3dc1d4ee3b29793d89811
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
0.7.0
|
2
|
+
-----
|
3
|
+
- Changes handling of input streams to be compliant with Rack. Allows
|
4
|
+
the server to run with `Rack::Lint` middleware. In the process, the
|
5
|
+
`RDFSource` and `NonRDFSource` interfaces are changed to accept only
|
6
|
+
IO-like objects conforming to Rack's input expectations. `String`
|
7
|
+
objects are no longer handled.
|
8
|
+
|
1
9
|
0.6.0
|
2
10
|
-----
|
3
11
|
- Upgrades to RDF.rb 2.0
|
data/IMPLEMENTATION.md
CHANGED
@@ -14,8 +14,10 @@ LDP Implementation Overview
|
|
14
14
|
creation.
|
15
15
|
- __4.2.1.3__: Etags are generated for all LDPRs and returned for all requests
|
16
16
|
to the resource.
|
17
|
-
- __4.2.1.4__: Link headers for the
|
18
|
-
`Rack::LDP::Headers` middleware.
|
17
|
+
- __4.2.1.4__: Link headers for the __returned__ resource are added by
|
18
|
+
`Rack::LDP::Headers` middleware. The requirement to return Link headers for
|
19
|
+
the requested resource is ignored in the case of successful POST requests;
|
20
|
+
instead, the headers for the created resource are given.
|
19
21
|
- __4.2.1.5__: Relative URI resolution in RDF graphs is handled with
|
20
22
|
`RDF::Reader#base_uri`. This is tested for Turtle input.
|
21
23
|
- __4.2.1.6__: Constraints are published in the {CONSTRAINED_BY.md} file in
|
data/README.md
CHANGED
@@ -106,10 +106,10 @@ $ rackup
|
|
106
106
|
Compliance
|
107
107
|
----------
|
108
108
|
|
109
|
-
Current compliance reports for Lamprey are located in [/
|
110
|
-
Reports are generated by the LDP test suite.
|
111
|
-
|
112
|
-
|
109
|
+
Current compliance reports for Lamprey are located in [/report](report/).
|
110
|
+
Reports are generated by the LDP test suite. We use the
|
111
|
+
[`ldp_testsuite_wrapper`](https://github.com/cbeer/ldp_testsuite_wrapper)
|
112
|
+
gem to run the suite and generate the tests.
|
113
113
|
|
114
114
|
RDF.rb 1.x Compatibility
|
115
115
|
--------------------------
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.7.0
|
data/app/lamprey.rb
CHANGED
@@ -2,7 +2,7 @@ require 'rack/ldp'
|
|
2
2
|
require 'sinatra/base'
|
3
3
|
|
4
4
|
class RDF::Lamprey < Sinatra::Base
|
5
|
-
|
5
|
+
use Rack::Lint
|
6
6
|
use Rack::LDP::ContentNegotiation
|
7
7
|
use Rack::LDP::Errors
|
8
8
|
use Rack::LDP::Responses
|
@@ -16,7 +16,7 @@ class RDF::Lamprey < Sinatra::Base
|
|
16
16
|
|
17
17
|
get '/*' do
|
18
18
|
RDF::LDP::Container.new(RDF::URI(request.url), settings.repository)
|
19
|
-
.create(
|
19
|
+
.create(StringIO.new, 'text/turtle') if settings.repository.empty?
|
20
20
|
RDF::LDP::Resource.find(RDF::URI(request.url), settings.repository)
|
21
21
|
end
|
22
22
|
|
@@ -32,17 +32,27 @@ module RDF::LDP
|
|
32
32
|
end
|
33
33
|
|
34
34
|
##
|
35
|
+
# Creates and inserts default relation triples if none are given.
|
36
|
+
#
|
37
|
+
# @note the addition of default triples is handled in a separate
|
38
|
+
# transaction. It is possible for the second transaction to fail, causing
|
39
|
+
# the resource to persist in an invalid state. It is also possible for a
|
40
|
+
# read to occur between the two transactions.
|
41
|
+
# @todo Make atomic. Consider just raising an error instead of adding
|
42
|
+
# triples. There's a need to handle this issue for repositories with
|
43
|
+
# snapshot reads, as well as those without.
|
44
|
+
#
|
35
45
|
# @see Container#create
|
36
46
|
def create(input, content_type, &block)
|
37
47
|
super
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
48
|
+
|
49
|
+
graph.transaction(mutable: true) do |tx|
|
50
|
+
tx.insert(default_member_relation_statement) if
|
51
|
+
member_relation_statements.empty?
|
52
|
+
tx.insert(default_membership_resource_statement) if
|
53
|
+
membership_resource_statements.empty?
|
54
|
+
end
|
55
|
+
|
46
56
|
self
|
47
57
|
end
|
48
58
|
|
@@ -29,13 +29,20 @@ module RDF::LDP
|
|
29
29
|
end
|
30
30
|
|
31
31
|
##
|
32
|
-
#
|
32
|
+
# Creates and inserts default relation triples if none are given.
|
33
|
+
#
|
34
|
+
# @see DirectContainer#create for information about the behavior and
|
35
|
+
# transactionality of this method.
|
33
36
|
def create(input, content_type, &block)
|
34
37
|
super
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
38
|
+
|
39
|
+
graph.transaction(mutable: true) do |tx|
|
40
|
+
tx.insert RDF::Statement(subject_uri,
|
41
|
+
RDF::Vocab::LDP.insertedContentRelation,
|
42
|
+
RDF::Vocab::LDP.MemberSubject) if
|
43
|
+
inserted_content_statements.empty?
|
44
|
+
end
|
45
|
+
|
39
46
|
self
|
40
47
|
end
|
41
48
|
|
@@ -47,17 +47,20 @@ module RDF::LDP
|
|
47
47
|
#
|
48
48
|
# @see RDF::LDP::Resource#create
|
49
49
|
def create(input, c_type)
|
50
|
-
storage.io { |io| IO.copy_stream(input
|
50
|
+
storage.io { |io| IO.copy_stream(input, io) }
|
51
51
|
super
|
52
52
|
self.content_type = c_type
|
53
|
-
|
53
|
+
|
54
|
+
RDFSource.new(description_uri, @data)
|
55
|
+
.create(StringIO.new, 'application/n-triples')
|
56
|
+
|
54
57
|
self
|
55
58
|
end
|
56
59
|
|
57
60
|
##
|
58
61
|
# @see RDF::LDP::Resource#update
|
59
62
|
def update(input, c_type)
|
60
|
-
storage.io { |io| IO.copy_stream(input
|
63
|
+
storage.io { |io| IO.copy_stream(input, io) }
|
61
64
|
super
|
62
65
|
self.content_type = c_type
|
63
66
|
self
|
@@ -180,7 +183,7 @@ module RDF::LDP
|
|
180
183
|
#
|
181
184
|
# @example writing to a `StorageAdapter`
|
182
185
|
# storage = StorageAdapter.new(an_nr_source)
|
183
|
-
# storage.io { |io| io.write('moomin')
|
186
|
+
# storage.io { |io| io.write('moomin') }
|
184
187
|
#
|
185
188
|
# Beyond this interface, implementations are permitted to behave as desired.
|
186
189
|
# They may, for instance, reject undesirable content or alter the graph (or
|
data/lib/rdf/ldp/rdf_source.rb
CHANGED
@@ -98,8 +98,7 @@ module RDF::LDP
|
|
98
98
|
# @return [RDF::LDP::Resource] self
|
99
99
|
def create(input, content_type, &block)
|
100
100
|
super do |transaction|
|
101
|
-
|
102
|
-
transaction.insert(statements)
|
101
|
+
transaction.insert(parse_graph(input, content_type))
|
103
102
|
yield transaction if block_given?
|
104
103
|
end
|
105
104
|
end
|
@@ -137,7 +136,6 @@ module RDF::LDP
|
|
137
136
|
transaction.insert parse_graph(input, content_type)
|
138
137
|
yield transaction if block_given?
|
139
138
|
end
|
140
|
-
self
|
141
139
|
end
|
142
140
|
|
143
141
|
##
|
@@ -193,13 +191,13 @@ module RDF::LDP
|
|
193
191
|
end
|
194
192
|
|
195
193
|
def ld_patch(input, graph, &block)
|
196
|
-
LD::Patch.parse(input).execute(graph)
|
194
|
+
LD::Patch.parse(input.read).execute(graph)
|
197
195
|
rescue LD::Patch::Error => e
|
198
196
|
raise BadRequest, e.message
|
199
197
|
end
|
200
198
|
|
201
199
|
def sparql_update(input, graph)
|
202
|
-
SPARQL.execute(input, graph, update: true)
|
200
|
+
SPARQL.execute(input.read, graph, update: true)
|
203
201
|
rescue SPARQL::MalformedQuery => e
|
204
202
|
raise BadRequest, e.message
|
205
203
|
end
|
@@ -245,11 +243,10 @@ module RDF::LDP
|
|
245
243
|
reader = RDF::Reader.for(content_type: content_type.to_s)
|
246
244
|
raise(RDF::LDP::UnsupportedMediaType, content_type) if reader.nil?
|
247
245
|
|
248
|
-
input = input.read if input.respond_to? :read
|
249
|
-
|
250
246
|
begin
|
247
|
+
input.rewind
|
251
248
|
RDF::Graph.new(graph_name: subject_uri, data: RDF::Repository.new) <<
|
252
|
-
reader.new(input, base_uri: subject_uri, validate: true)
|
249
|
+
reader.new(input.read, base_uri: subject_uri, validate: true)
|
253
250
|
rescue RDF::ReaderError => e
|
254
251
|
raise RDF::LDP::BadRequest, e.message
|
255
252
|
end
|
data/lib/rdf/ldp/resource.rb
CHANGED
@@ -246,10 +246,12 @@ module RDF::LDP
|
|
246
246
|
# subclasses for the appropriate response codes.
|
247
247
|
def update(input, content_type, &block)
|
248
248
|
return create(input, content_type, &block) unless exists?
|
249
|
+
|
249
250
|
@data.transaction(mutable: true) do |transaction|
|
250
251
|
yield transaction if block_given?
|
251
252
|
set_last_modified(transaction)
|
252
253
|
end
|
254
|
+
|
253
255
|
self
|
254
256
|
end
|
255
257
|
|
@@ -455,7 +457,9 @@ module RDF::LDP
|
|
455
457
|
##
|
456
458
|
# Process & generate response for DELETE requests.
|
457
459
|
def delete(status, headers, env)
|
458
|
-
|
460
|
+
destroy
|
461
|
+
headers.delete('Content-Type')
|
462
|
+
[204, headers, []]
|
459
463
|
end
|
460
464
|
|
461
465
|
##
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdf-ldp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Johnson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -296,6 +296,48 @@ dependencies:
|
|
296
296
|
- - "~>"
|
297
297
|
- !ruby/object:Gem::Version
|
298
298
|
version: '0.8'
|
299
|
+
- !ruby/object:Gem::Dependency
|
300
|
+
name: faraday
|
301
|
+
requirement: !ruby/object:Gem::Requirement
|
302
|
+
requirements:
|
303
|
+
- - ">="
|
304
|
+
- !ruby/object:Gem::Version
|
305
|
+
version: '0'
|
306
|
+
type: :development
|
307
|
+
prerelease: false
|
308
|
+
version_requirements: !ruby/object:Gem::Requirement
|
309
|
+
requirements:
|
310
|
+
- - ">="
|
311
|
+
- !ruby/object:Gem::Version
|
312
|
+
version: '0'
|
313
|
+
- !ruby/object:Gem::Dependency
|
314
|
+
name: capybara_discoball
|
315
|
+
requirement: !ruby/object:Gem::Requirement
|
316
|
+
requirements:
|
317
|
+
- - ">="
|
318
|
+
- !ruby/object:Gem::Version
|
319
|
+
version: '0'
|
320
|
+
type: :development
|
321
|
+
prerelease: false
|
322
|
+
version_requirements: !ruby/object:Gem::Requirement
|
323
|
+
requirements:
|
324
|
+
- - ">="
|
325
|
+
- !ruby/object:Gem::Version
|
326
|
+
version: '0'
|
327
|
+
- !ruby/object:Gem::Dependency
|
328
|
+
name: ldp_testsuite_wrapper
|
329
|
+
requirement: !ruby/object:Gem::Requirement
|
330
|
+
requirements:
|
331
|
+
- - "~>"
|
332
|
+
- !ruby/object:Gem::Version
|
333
|
+
version: 0.0.4
|
334
|
+
type: :development
|
335
|
+
prerelease: false
|
336
|
+
version_requirements: !ruby/object:Gem::Requirement
|
337
|
+
requirements:
|
338
|
+
- - "~>"
|
339
|
+
- !ruby/object:Gem::Version
|
340
|
+
version: 0.0.4
|
299
341
|
description: Implements a Linked Data Platform domain model, Rack middleware for server
|
300
342
|
implementers, and a simple Sinatra-based server for RDF.rb
|
301
343
|
email: public-rdf-ruby@w3.org
|
@@ -335,7 +377,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
335
377
|
requirements:
|
336
378
|
- - ">="
|
337
379
|
- !ruby/object:Gem::Version
|
338
|
-
version:
|
380
|
+
version: 2.0.0
|
339
381
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
340
382
|
requirements:
|
341
383
|
- - ">="
|
@@ -343,7 +385,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
343
385
|
version: '0'
|
344
386
|
requirements: []
|
345
387
|
rubyforge_project:
|
346
|
-
rubygems_version: 2.
|
388
|
+
rubygems_version: 2.5.1
|
347
389
|
signing_key:
|
348
390
|
specification_version: 4
|
349
391
|
summary: A suite of LDP software and middleware for RDF.rb.
|