rdf-turtle 0.0.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/History CHANGED
@@ -1,3 +1,7 @@
1
+ ### 0.1.0
2
+ * Updates for RDF.rb 0.3.4.
3
+ * Format detection.
4
+
1
5
  ### 0.0.5
2
6
  * Update turtle and writer specs to use latest version of Turtle specs.
3
7
  * Use Spira Manifest w/list to order tests.
@@ -91,7 +91,7 @@ Using SWAP utilities, this is done as follows:
91
91
  ## Dependencies
92
92
 
93
93
  * [Ruby](http://ruby-lang.org/) (>= 1.8.7) or (>= 1.8.1 with [Backports][])
94
- * [RDF.rb](http://rubygems.org/gems/rdf) (>= 0.3.0)
94
+ * [RDF.rb](http://rubygems.org/gems/rdf) (>= 0.3.4)
95
95
 
96
96
  ## Installation
97
97
 
@@ -133,4 +133,4 @@ see <http://unlicense.org/> or the accompanying {file:UNLICENSE} file.
133
133
  [N-Triples]: http://www.w3.org/TR/rdf-testcases/#ntriples
134
134
  [Turtle]: http://www.w3.org/TR/2011/WD-turtle-20110809/
135
135
  [Turtle doc]: http://rubydoc.info/github/gkellogg/rdf-turtle/master/file/README.markdown
136
- [Turtle EBNF]: http://www.w3.org/2000/10/swap/grammar/turtle.bnf
136
+ [Turtle EBNF]: http://www.w3.org/TR/2011/WD-turtle-20110809/turtle.bnf
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.1.0
@@ -1,6 +1,6 @@
1
1
  module RDF::Turtle
2
2
  ##
3
- # RDFa format specification.
3
+ # Turtle format specification.
4
4
  #
5
5
  # @example Obtaining an Turtle format class
6
6
  # RDF::Format.for("etc/foaf.ttl")
@@ -24,6 +24,32 @@ module RDF::Turtle
24
24
 
25
25
  reader { RDF::Turtle::Reader }
26
26
  writer { RDF::Turtle::Writer }
27
+
28
+ ##
29
+ # Sample detection to see if it matches Turtle (or N-Triples)
30
+ #
31
+ # Use a text sample to detect the format of an input file. Sub-classes implement
32
+ # a matcher sufficient to detect probably format matches, including disambiguating
33
+ # between other similar formats.
34
+ #
35
+ # @param [String] sample Beginning several bytes (~ 1K) of input.
36
+ # @return [Boolean]
37
+ def self.detect(sample)
38
+ !!sample.match(%r(
39
+ (?:@(base|prefix|keywords)) | # N3 keywords
40
+ ["']{3} | # STRING_LITERAL_LONG1/2
41
+ "[^"]*"^^ | "[^"]*"@ | # Typed/Language literals
42
+ (?:
43
+ (?:\s*(?:(?:<[^>]*>) | (?:\w*:\w+) | (?:"[^"]*"))\s*[,;]) ||
44
+ (?:\s*(?:(?:<[^>]*>) | (?:\w*:\w+) | (?:"[^"]*"))){3}
45
+ )
46
+ )mx) && !(
47
+ sample.match(%r(@keywords|=>|\{)) || # N3
48
+ sample.match(%r(<(?:\/|html|rdf))i) || # HTML, RDF/XML
49
+ sample.match(%r(^(?:\s*<[^>]*>){4}.*\.\s*$)) || # N-Quads
50
+ sample.match(%r("@(context|subject|iri)")) # JSON-LD
51
+ )
52
+ end
27
53
  end
28
54
 
29
55
  # Alias for TTL format
@@ -173,12 +173,6 @@ module RDF::Turtle
173
173
  input[:resource] = reader.literal(current[:string_value], opts)
174
174
  end
175
175
 
176
- ##
177
- # Missing in 0.3.2
178
- def base_uri
179
- @options[:base_uri]
180
- end
181
-
182
176
  ##
183
177
  # Initializes a new reader instance.
184
178
  #
@@ -206,7 +200,7 @@ module RDF::Turtle
206
200
  super do
207
201
  @options = {:anon_base => "b0", :validate => false}.merge(options)
208
202
 
209
- debug("def prefix") {base_uri.inspect}
203
+ debug("base IRI") {base_uri.inspect}
210
204
 
211
205
  debug("validate") {validate?.inspect}
212
206
  debug("canonicalize") {canonicalize?.inspect}
@@ -265,7 +265,7 @@ module RDF::Turtle
265
265
  def start_document
266
266
  @started = true
267
267
 
268
- @output.write("#{indent}@base <#{@base_uri}> .\n") unless @base_uri.to_s.empty?
268
+ @output.write("#{indent}@base <#{base_uri}> .\n") unless base_uri.to_s.empty?
269
269
 
270
270
  debug {"start_document: #{prefixes.inspect}"}
271
271
  prefixes.keys.sort_by(&:to_s).each do |prefix|
@@ -273,12 +273,12 @@ module RDF::Turtle
273
273
  end
274
274
  end
275
275
 
276
- # If @base_uri is defined, use it to try to make uri relative
276
+ # If base_uri is defined, use it to try to make uri relative
277
277
  # @param [#to_s] uri
278
278
  # @return [String]
279
279
  def relativize(uri)
280
280
  uri = uri.to_s
281
- @base_uri ? uri.sub(@base_uri.to_s, "") : uri
281
+ base_uri ? uri.sub(base_uri.to_s, "") : uri
282
282
  end
283
283
 
284
284
  # Defines rdf:type of subjects to be emitted at the beginning of the graph. Defaults to rdfs:Class
metadata CHANGED
@@ -1,127 +1,88 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rdf-turtle
3
- version: !ruby/object:Gem::Version
4
- hash: 21
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 0
9
- - 5
10
- version: 0.0.5
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Gregg Kellogg
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2011-09-04 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2011-09-27 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: rdf
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &2161375780 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 21
29
- segments:
30
- - 0
31
- - 3
32
- - 3
33
- version: 0.3.3
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: 0.3.4
34
22
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
37
- name: yard
38
23
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *2161375780
25
+ - !ruby/object:Gem::Dependency
26
+ name: yard
27
+ requirement: &2161375180 !ruby/object:Gem::Requirement
40
28
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 7
45
- segments:
46
- - 0
47
- - 6
48
- - 0
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
49
32
  version: 0.6.0
50
33
  type: :development
51
- version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: rspec
54
34
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *2161375180
36
+ - !ruby/object:Gem::Dependency
37
+ name: rspec
38
+ requirement: &2161374480 !ruby/object:Gem::Requirement
56
39
  none: false
57
- requirements:
58
- - - ">="
59
- - !ruby/object:Gem::Version
60
- hash: 27
61
- segments:
62
- - 2
63
- - 5
64
- - 0
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
65
43
  version: 2.5.0
66
44
  type: :development
67
- version_requirements: *id003
68
- - !ruby/object:Gem::Dependency
69
- name: rdf-n3
70
45
  prerelease: false
71
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *2161374480
47
+ - !ruby/object:Gem::Dependency
48
+ name: rdf-n3
49
+ requirement: &2161373540 !ruby/object:Gem::Requirement
72
50
  none: false
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- hash: 25
77
- segments:
78
- - 0
79
- - 3
80
- - 5
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
81
54
  version: 0.3.5
82
55
  type: :development
83
- version_requirements: *id004
84
- - !ruby/object:Gem::Dependency
85
- name: rdf-spec
86
56
  prerelease: false
87
- requirement: &id005 !ruby/object:Gem::Requirement
57
+ version_requirements: *2161373540
58
+ - !ruby/object:Gem::Dependency
59
+ name: rdf-spec
60
+ requirement: &2161372320 !ruby/object:Gem::Requirement
88
61
  none: false
89
- requirements:
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- hash: 23
93
- segments:
94
- - 0
95
- - 3
96
- - 2
97
- version: 0.3.2
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: 0.3.4
98
66
  type: :development
99
- version_requirements: *id005
100
- - !ruby/object:Gem::Dependency
101
- name: rdf-isomorphic
102
67
  prerelease: false
103
- requirement: &id006 !ruby/object:Gem::Requirement
68
+ version_requirements: *2161372320
69
+ - !ruby/object:Gem::Dependency
70
+ name: rdf-isomorphic
71
+ requirement: &2161347600 !ruby/object:Gem::Requirement
104
72
  none: false
105
- requirements:
106
- - - ">="
107
- - !ruby/object:Gem::Version
108
- hash: 27
109
- segments:
110
- - 0
111
- - 3
112
- - 4
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
113
76
  version: 0.3.4
114
77
  type: :development
115
- version_requirements: *id006
116
- description: Turtle reader/writer for Ruby.
78
+ prerelease: false
79
+ version_requirements: *2161347600
80
+ description: RDF::Turtle is an Turtle reader/writer for the RDF.rb library suite.
117
81
  email: public-rdf-ruby@w3.org
118
82
  executables: []
119
-
120
83
  extensions: []
121
-
122
84
  extra_rdoc_files: []
123
-
124
- files:
85
+ files:
125
86
  - AUTHORS
126
87
  - README.markdown
127
88
  - History
@@ -139,39 +100,28 @@ files:
139
100
  - lib/rdf/turtle/writer.rb
140
101
  - lib/rdf/turtle.rb
141
102
  homepage: http://github.com/gkellogg/rdf-turtle
142
- licenses:
103
+ licenses:
143
104
  - Public Domain
144
105
  post_install_message:
145
106
  rdoc_options: []
146
-
147
- require_paths:
107
+ require_paths:
148
108
  - lib
149
- required_ruby_version: !ruby/object:Gem::Requirement
109
+ required_ruby_version: !ruby/object:Gem::Requirement
150
110
  none: false
151
- requirements:
152
- - - ">="
153
- - !ruby/object:Gem::Version
154
- hash: 53
155
- segments:
156
- - 1
157
- - 8
158
- - 1
111
+ requirements:
112
+ - - ! '>='
113
+ - !ruby/object:Gem::Version
159
114
  version: 1.8.1
160
- required_rubygems_version: !ruby/object:Gem::Requirement
115
+ required_rubygems_version: !ruby/object:Gem::Requirement
161
116
  none: false
162
- requirements:
163
- - - ">="
164
- - !ruby/object:Gem::Version
165
- hash: 3
166
- segments:
167
- - 0
168
- version: "0"
117
+ requirements:
118
+ - - ! '>='
119
+ - !ruby/object:Gem::Version
120
+ version: '0'
169
121
  requirements: []
170
-
171
122
  rubyforge_project: rdf-turtle
172
- rubygems_version: 1.8.6
123
+ rubygems_version: 1.8.10
173
124
  signing_key:
174
125
  specification_version: 3
175
126
  summary: Turtle reader/writer for Ruby.
176
127
  test_files: []
177
-