turtle_reader 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Binary file
Binary file
@@ -0,0 +1,13 @@
1
+ $:.unshift('lib') unless $:.first == 'lib'
2
+
3
+ require 'turtle_reader'
4
+
5
+ RSpec.configure { |config|
6
+ config.expect_with(:rspec) { |c| c.syntax = [:should, :expect] }
7
+
8
+ config.include(Module.new {
9
+ def data(file)
10
+ File.join(File.dirname(__FILE__), 'data', file)
11
+ end
12
+ })
13
+ }
@@ -0,0 +1,55 @@
1
+ describe TurtleReader do
2
+
3
+ context 'GND' do
4
+
5
+ let(:ttl) { data('GND-sample.ttl') }
6
+
7
+ example do
8
+ prefixes = { nil => '' }
9
+
10
+ prefixes.update(
11
+ dc: 'http://purl.org/dc/elements/1.1/',
12
+ gnd: 'http://d-nb.info/standards/elementset/gnd#',
13
+ rda: 'http://rdvocab.info/',
14
+ foaf: 'http://xmlns.com/foaf/0.1/',
15
+ isbd: 'http://iflastandards.info/ns/isbd/elements/',
16
+ dcterms: 'http://purl.org/dc/terms/',
17
+ rdfs: 'http://www.w3.org/2000/01/rdf-schema#',
18
+ marcRole: 'http://id.loc.gov/vocabulary/relators/',
19
+ lib: 'http://purl.org/library/',
20
+ umbel: 'http://umbel.org/umbel#',
21
+ bibo: 'http://purl.org/ontology/bibo/',
22
+ owl: 'http://www.w3.org/2002/07/owl#',
23
+ rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
24
+ skos: 'http://www.w3.org/2004/02/skos/core#'
25
+ ) unless RUBY_PLATFORM == 'java'
26
+
27
+ TurtleReader.open(ttl) { |r| r.prefixes }.map { |k, v| [k, v.to_s]}
28
+ .sort_by { |k,| k.to_s }.should == prefixes.sort_by { |k,| k.to_s }
29
+ end
30
+
31
+ example do
32
+ TurtleReader.open(ttl) { |r| r.statements.first.to_a }.map(&:to_s).should == %w[
33
+ http://d-nb.info/gnd/1-2 http://d-nb.info/standards/elementset/gnd#gndIdentifier 1-2
34
+ ]
35
+ end
36
+
37
+ example do
38
+ TurtleReader.open(ttl) { |r| r.statements.size }.should == 838
39
+ end
40
+
41
+ example do
42
+ TurtleReader.open(ttl + '.gz') { |r| r.statements.size }.should == 838
43
+ end
44
+
45
+ if Object.const_defined?(:RBzip2)
46
+
47
+ example do
48
+ TurtleReader.open(ttl + '.bz2') { |r| r.statements.size }.should == 838
49
+ end
50
+
51
+ end
52
+
53
+ end
54
+
55
+ end
metadata ADDED
@@ -0,0 +1,144 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: turtle_reader
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Jens Wille
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-04-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rdf-turtle
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rbzip2
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: hen
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description: A convenience wrapper for reading RDF Turtle data.
84
+ email: jens.wille@gmail.com
85
+ executables: []
86
+ extensions: []
87
+ extra_rdoc_files:
88
+ - README
89
+ - COPYING
90
+ - ChangeLog
91
+ files:
92
+ - COPYING
93
+ - ChangeLog
94
+ - README
95
+ - Rakefile
96
+ - lib/turtle_reader.rb
97
+ - lib/turtle_reader/rdf/compression.rb
98
+ - lib/turtle_reader/rdf/prefix.rb
99
+ - lib/turtle_reader/rdf/turtle/reader.rb
100
+ - lib/turtle_reader/rdf/uri.rb
101
+ - lib/turtle_reader/version.rb
102
+ - spec/data/GND-sample.ttl
103
+ - spec/data/GND-sample.ttl.bz2
104
+ - spec/data/GND-sample.ttl.gz
105
+ - spec/spec_helper.rb
106
+ - spec/turtle_reader_spec.rb
107
+ homepage: http://github.com/blackwinter/turtle_reader
108
+ licenses:
109
+ - AGPL-3.0
110
+ metadata: {}
111
+ post_install_message: |2+
112
+
113
+ turtle_reader-0.0.1 [2014-04-30]:
114
+
115
+ * First release (extracted from ruby-nuggets).
116
+
117
+ rdoc_options:
118
+ - "--title"
119
+ - turtle_reader Application documentation (v0.0.1)
120
+ - "--charset"
121
+ - UTF-8
122
+ - "--line-numbers"
123
+ - "--all"
124
+ - "--main"
125
+ - README
126
+ require_paths:
127
+ - lib
128
+ required_ruby_version: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - ">="
131
+ - !ruby/object:Gem::Version
132
+ version: 1.9.3
133
+ required_rubygems_version: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ requirements: []
139
+ rubyforge_project:
140
+ rubygems_version: 2.2.2.x
141
+ signing_key:
142
+ specification_version: 4
143
+ summary: RDF Turtle reader.
144
+ test_files: []