turtle_reader 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +4 -0
- data/README +4 -4
- data/Rakefile +2 -2
- data/lib/turtle_reader.rb +3 -3
- data/lib/turtle_reader/rdf/turtle/reader.rb +1 -1
- data/lib/turtle_reader/version.rb +2 -2
- data/spec/spec_helper.rb +8 -0
- data/spec/turtle_reader_spec.rb +20 -11
- metadata +24 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5c0835344b8f0df56e43b61679a483511eb5350c
|
4
|
+
data.tar.gz: 49b058b34a628b653d06044bbb730ea2a0928cc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 31c21b89faf27d39a98e8bdf6522ab4362ca4db10c749461505cffe4e9e87eff92584ac210f02b8ddcdf3a533704e831c05a17a336c65d281a60eee14ebd4c26
|
7
|
+
data.tar.gz: c3c2fdb8f324edfd56b36b190549e5c3041fb8490a6aa77889010f39356714133171fb6028fe2adc33f50c78b2fd61f022902b30c965df8f959665f05afcceb8
|
data/ChangeLog
CHANGED
data/README
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
== VERSION
|
4
4
|
|
5
|
-
This documentation refers to turtle_reader version 0.0
|
5
|
+
This documentation refers to turtle_reader version 0.1.0
|
6
6
|
|
7
7
|
|
8
8
|
== DESCRIPTION
|
@@ -12,10 +12,10 @@ A convenience wrapper for reading RDF Turtle data.
|
|
12
12
|
|
13
13
|
== LINKS
|
14
14
|
|
15
|
-
Documentation:: https://blackwinter.github.
|
15
|
+
Documentation:: https://blackwinter.github.com/turtle_reader
|
16
16
|
Source code:: https://github.com/blackwinter/turtle_reader
|
17
17
|
RubyGem:: https://rubygems.org/gems/turtle_reader
|
18
|
-
Travis CI:: https
|
18
|
+
Travis CI:: https://travis-ci.org/blackwinter/turtle_reader
|
19
19
|
|
20
20
|
|
21
21
|
== AUTHORS
|
@@ -25,7 +25,7 @@ Travis CI:: https//travis-ci.org/blackwinter/turtle_reader
|
|
25
25
|
|
26
26
|
== LICENSE AND COPYRIGHT
|
27
27
|
|
28
|
-
Copyright (C) 2014 Jens Wille
|
28
|
+
Copyright (C) 2014-2015 Jens Wille
|
29
29
|
|
30
30
|
turtle_reader is free software: you can redistribute it and/or modify it
|
31
31
|
under the terms of the GNU Affero General Public License as published by
|
data/Rakefile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
require_relative 'lib/turtle_reader/version'
|
2
2
|
|
3
3
|
begin
|
4
4
|
require 'hen'
|
@@ -13,7 +13,7 @@ begin
|
|
13
13
|
email: %q{jens.wille@gmail.com},
|
14
14
|
license: %q{AGPL-3.0},
|
15
15
|
homepage: :blackwinter,
|
16
|
-
dependencies:
|
16
|
+
dependencies: { 'rdf-turtle' => ['~> 1.1', '<= 1.1.7'] },
|
17
17
|
|
18
18
|
development_dependencies: %w[rbzip2],
|
19
19
|
|
data/lib/turtle_reader.rb
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
# #
|
6
6
|
# turtle_reader -- RDF Turtle reader #
|
7
7
|
# #
|
8
|
-
# Copyright (C) 2014 Jens Wille
|
8
|
+
# Copyright (C) 2014-2015 Jens Wille #
|
9
9
|
# #
|
10
10
|
# Authors: #
|
11
11
|
# Jens Wille <jens.wille@gmail.com> #
|
@@ -85,13 +85,13 @@ class TurtleReader
|
|
85
85
|
end
|
86
86
|
|
87
87
|
def each_statement(&block)
|
88
|
-
return enum_for(
|
88
|
+
return enum_for(__method__) unless block_given?
|
89
89
|
reader.parse_statements(&block)
|
90
90
|
self
|
91
91
|
end
|
92
92
|
|
93
93
|
def each
|
94
|
-
return enum_for(
|
94
|
+
return enum_for(__method__) unless block_given?
|
95
95
|
|
96
96
|
uri, map, base = RDF::URI, self.map, self.base
|
97
97
|
|
@@ -39,7 +39,7 @@ module RDF
|
|
39
39
|
|
40
40
|
# NoMethodError: undefined method `[]' for nil:NilClass (line 17) [GND-sample.ttl]
|
41
41
|
# from .../lib/ruby/gems/shared/gems/rdf-turtle-1.1.3.1/lib/rdf/turtle/reader.rb:153
|
42
|
-
progress:
|
42
|
+
progress: RUBY_ENGINE == 'jruby'
|
43
43
|
}
|
44
44
|
|
45
45
|
def closed?
|
data/spec/spec_helper.rb
CHANGED
@@ -9,5 +9,13 @@ RSpec.configure { |config|
|
|
9
9
|
def data(file)
|
10
10
|
File.join(File.dirname(__FILE__), 'data', file)
|
11
11
|
end
|
12
|
+
|
13
|
+
def turtle(file, &block)
|
14
|
+
TurtleReader.open(data(file), &block)
|
15
|
+
end
|
16
|
+
|
17
|
+
def statements(file)
|
18
|
+
turtle(file, &:statements)
|
19
|
+
end
|
12
20
|
})
|
13
21
|
}
|
data/spec/turtle_reader_spec.rb
CHANGED
@@ -2,10 +2,10 @@ describe TurtleReader do
|
|
2
2
|
|
3
3
|
context 'GND' do
|
4
4
|
|
5
|
-
let(:ttl) {
|
5
|
+
let(:ttl) { 'GND-sample.ttl' }
|
6
6
|
|
7
7
|
example do
|
8
|
-
prefixes = { nil => '' }
|
8
|
+
prefixes, sort = { nil => '' }, lambda { |ary| ary.sort_by { |k,| k.to_s } }
|
9
9
|
|
10
10
|
prefixes.update(
|
11
11
|
dc: 'http://purl.org/dc/elements/1.1/',
|
@@ -22,30 +22,39 @@ describe TurtleReader do
|
|
22
22
|
owl: 'http://www.w3.org/2002/07/owl#',
|
23
23
|
rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
|
24
24
|
skos: 'http://www.w3.org/2004/02/skos/core#'
|
25
|
-
) unless
|
25
|
+
) unless RUBY_ENGINE == 'jruby'
|
26
26
|
|
27
|
-
|
28
|
-
.sort_by { |k,| k.to_s }.should == prefixes.sort_by { |k,| k.to_s }
|
27
|
+
sort[turtle(ttl, &:prefixes).map { |k, v| [k, v.to_s] }].should == sort[prefixes]
|
29
28
|
end
|
30
29
|
|
31
30
|
example do
|
32
|
-
|
33
|
-
http://d-nb.info/gnd/1-2
|
31
|
+
statements(ttl).first.to_a.map(&:to_s).should == %w[
|
32
|
+
http://d-nb.info/gnd/1-2
|
33
|
+
http://d-nb.info/standards/elementset/gnd#gndIdentifier
|
34
|
+
1-2
|
34
35
|
]
|
35
36
|
end
|
36
37
|
|
37
38
|
example do
|
38
|
-
|
39
|
+
statements(ttl).last.to_a.map(&:to_s).should == %w[
|
40
|
+
http://d-nb.info/gnd/185-5
|
41
|
+
http://www.w3.org/1999/02/22-rdf-syntax-ns#type
|
42
|
+
http://d-nb.info/standards/elementset/gnd#SeriesOfConferenceOrEvent
|
43
|
+
]
|
39
44
|
end
|
40
45
|
|
41
46
|
example do
|
42
|
-
|
47
|
+
statements(ttl).size.should == 838
|
48
|
+
end
|
49
|
+
|
50
|
+
xexample do
|
51
|
+
statements(ttl + '.gz').size.should == 838
|
43
52
|
end
|
44
53
|
|
45
54
|
if Object.const_defined?(:RBzip2)
|
46
55
|
|
47
|
-
|
48
|
-
|
56
|
+
xexample do
|
57
|
+
statements(ttl + '.bz2').size.should == 838
|
49
58
|
end
|
50
59
|
|
51
60
|
end
|
metadata
CHANGED
@@ -1,29 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turtle_reader
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jens Wille
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-10-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdf-turtle
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '1.1'
|
20
|
+
- - "<="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.1.7
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
29
|
+
version: '1.1'
|
30
|
+
- - "<="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.1.7
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: rbzip2
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,16 +48,22 @@ dependencies:
|
|
42
48
|
name: hen
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0.8'
|
45
54
|
- - ">="
|
46
55
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
56
|
+
version: 0.8.3
|
48
57
|
type: :development
|
49
58
|
prerelease: false
|
50
59
|
version_requirements: !ruby/object:Gem::Requirement
|
51
60
|
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0.8'
|
52
64
|
- - ">="
|
53
65
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
66
|
+
version: 0.8.3
|
55
67
|
- !ruby/object:Gem::Dependency
|
56
68
|
name: rake
|
57
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -110,13 +122,13 @@ licenses:
|
|
110
122
|
metadata: {}
|
111
123
|
post_install_message: |2+
|
112
124
|
|
113
|
-
turtle_reader-0.0
|
125
|
+
turtle_reader-0.1.0 [2015-10-02]:
|
114
126
|
|
115
|
-
*
|
127
|
+
* Some refactoring.
|
116
128
|
|
117
129
|
rdoc_options:
|
118
130
|
- "--title"
|
119
|
-
- turtle_reader Application documentation (v0.0
|
131
|
+
- turtle_reader Application documentation (v0.1.0)
|
120
132
|
- "--charset"
|
121
133
|
- UTF-8
|
122
134
|
- "--line-numbers"
|
@@ -137,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
149
|
version: '0'
|
138
150
|
requirements: []
|
139
151
|
rubyforge_project:
|
140
|
-
rubygems_version: 2.
|
152
|
+
rubygems_version: 2.4.8
|
141
153
|
signing_key:
|
142
154
|
specification_version: 4
|
143
155
|
summary: RDF Turtle reader.
|