rdf-n3 1.1.3.1 → 1.99.0

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: f90a40d1295cdc1e4de034f134f2388e6640d51f
4
- data.tar.gz: 973bc08de4dd4400a2c096bd31c8a82909ff2257
3
+ metadata.gz: b9b52d4f54d09368875b654dad895204b3fe645c
4
+ data.tar.gz: ab49163f1b25a7deb4982273c7ef698504624d4f
5
5
  SHA512:
6
- metadata.gz: f58d2803df2299a01e2b6ae942442be7f017fd990b0d200bd99d5e21077c306725b2381bd25be8647f7508af4ecbdcc0c4b20ee72767ab580ff4b04075c82f2d
7
- data.tar.gz: 5b5aa33dbe098af88cffd4495a5be3138325b3f8a6442179d55c4707e7469ac91d5132badb8a9d260eeaa5e836359587a144a57192b36ba645dcf57fb6ea951c
6
+ metadata.gz: 8308ad1b87c6905d0e6ab9551adc67f851c689d0a21713e22da310fddf66c241ca46752c0468de1778fe5a27235d8dc826c6172894db21a149155451c3842a7a
7
+ data.tar.gz: bed77496be0b312dbaa8ac1a63a2647bfefbd4c0e542ff64fe3389a84eb15d31be45c4e8653626a6ce129a43f2129319809e4addd492216dd4825aabb139729f
data/README.md CHANGED
@@ -41,7 +41,7 @@ Write a graph to a file:
41
41
  end
42
42
 
43
43
  ### Formulae
44
- N3 Formulae are introduced with the { statement-list } syntax. A given formula is assigned an RDF::Node instance, which is also used as the context for RDF::Statement instances provided to RDF::N3::Reader#each_statement. For example, the following N3 generates the associated statements:
44
+ N3 Formulae are introduced with the { statement-list } syntax. A given formula is assigned an RDF::Node instance, which is also used as the graph_name for RDF::Statement instances provided to RDF::N3::Reader#each_statement. For example, the following N3 generates the associated statements:
45
45
 
46
46
  { [ x:firstname "Ora" ] dc:wrote [ dc:title "Moby Dick" ] } a n3:falsehood .
47
47
 
@@ -51,9 +51,9 @@ results in
51
51
  s = RDF::Node.new
52
52
  o = RDF::Node.new
53
53
  RDF::Statement(f, rdf:type n3:falsehood)
54
- RDF::Statement(s, x:firstname, "Ora", :context => f)
55
- RDF::Statement(s, dc:wrote, o, :context => f)
56
- RDF::Statement(o, dc:title, "Moby Dick", :context => f)
54
+ RDF::Statement(s, x:firstname, "Ora", graph_name: f)
55
+ RDF::Statement(s, dc:wrote, o, graph_name: f)
56
+ RDF::Statement(o, dc:title, "Moby Dick", graph_name: f)
57
57
 
58
58
  ### Variables
59
59
  N3 Variables are introduced with @forAll, @forEach, or ?x. Variables reference URIs described in formulae, typically defined in the default vocabulary (e.g., ":x"). Existential variables are replaced with an allocated RDF::Node instance. Universal variables are replaced with a RDF::Query::Variable instance. For example, the following N3 generates the associated statements:
@@ -100,8 +100,8 @@ Full documentation available on [RubyDoc.info](http://rubydoc.info/github/ruby-r
100
100
  * {RDF::REI}
101
101
 
102
102
  ### Patches
103
- * {Array}
104
- * {RDF::List}
103
+ * `Array`
104
+ * `RDF::List`
105
105
 
106
106
  ## Resources
107
107
  * [RDF.rb][RDF.rb]
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.3.1
1
+ 1.99.0
data/lib/rdf/n3/format.rb CHANGED
@@ -5,19 +5,19 @@ module RDF::N3
5
5
  # @example Obtaining an Notation3 format class
6
6
  # RDF::Format.for(:n3) #=> RDF::N3::Format
7
7
  # RDF::Format.for("etc/foaf.n3")
8
- # RDF::Format.for(:file_name => "etc/foaf.n3")
9
- # RDF::Format.for(:file_extension => "n3")
10
- # RDF::Format.for(:content_type => "text/n3")
8
+ # RDF::Format.for(file_name: "etc/foaf.n3")
9
+ # RDF::Format.for(file_extension: "n3")
10
+ # RDF::Format.for(content_type: "text/n3")
11
11
  #
12
12
  # @example Obtaining serialization format MIME types
13
13
  # RDF::Format.content_types #=> {"text/n3")" => [RDF::N3::Format]}
14
14
  #
15
15
  # @example Obtaining serialization format file extension mappings
16
- # RDF::Format.file_extensions #=> {:n3 => "text/n3"}
16
+ # RDF::Format.file_extensions #=> {n3: "text/n3"}
17
17
  #
18
18
  # @see http://www.w3.org/TR/rdf-testcases/#ntriples
19
19
  class Format < RDF::Format
20
- content_type 'text/n3', :extension => :n3, :aliases => %w(text/rdf+n3 application/rdf+n3)
20
+ content_type 'text/n3', extension: :n3, aliases: %w(text/rdf+n3 application/rdf+n3)
21
21
  content_encoding 'utf-8'
22
22
 
23
23
  reader { RDF::N3::Reader }
@@ -33,7 +33,7 @@ module RDF::N3
33
33
  # RDF::Format.for(:ttl).reader #=> RDF::N3::Reader
34
34
  # RDF::Format.for(:ttl).writer #=> RDF::N3::Writer
35
35
  class Notation3 < RDF::Format
36
- content_type 'text/n3', :extension => :n3
36
+ content_type 'text/n3', extension: :n3
37
37
  content_encoding 'utf-8'
38
38
 
39
39
  reader { RDF::N3::Reader }
@@ -37,7 +37,7 @@ class Array
37
37
  end
38
38
 
39
39
  # options.assert_valid_keys(:words_connector, :two_words_connector, :last_word_connector, :locale)
40
- options = {:words_connector => default_words_connector, :two_words_connector => default_two_words_connector, :last_word_connector => default_last_word_connector}.merge(options)
40
+ options = {words_connector: default_words_connector, two_words_connector: default_two_words_connector, last_word_connector: default_last_word_connector}.merge(options)
41
41
 
42
42
  case length
43
43
  when 0
data/lib/rdf/n3/reader.rb CHANGED
@@ -147,7 +147,7 @@ module RDF::N3
147
147
  end
148
148
 
149
149
  def booleanToken(prod, tok)
150
- lit = RDF::Literal.new(tok.delete("@"), :datatype => RDF::XSD.boolean, :validate => validate?, :canonicalize => canonicalize?)
150
+ lit = RDF::Literal.new(tok.delete("@"), datatype: RDF::XSD.boolean, validate: validate?, canonicalize: canonicalize?)
151
151
  add_prod_data(:literal, lit)
152
152
  end
153
153
 
@@ -223,7 +223,7 @@ module RDF::N3
223
223
  pd = @prod_data.pop
224
224
  forSome = Array(pd[:symbol])
225
225
  forSome.each do |term|
226
- @variables[term.to_s] = {:formula => @formulae.last, :var => RDF::Node.new(term.to_s.split(/[\/#]/).last)}
226
+ @variables[term.to_s] = {formula: @formulae.last, var: RDF::Node.new(term.to_s.split(/[\/#]/).last)}
227
227
  end
228
228
  end
229
229
 
@@ -269,7 +269,7 @@ module RDF::N3
269
269
  language = language.downcase if language && canonicalize?
270
270
  datatype = lit[:symbol]
271
271
 
272
- lit = RDF::Literal.new(content, :language => language, :datatype => datatype, :validate => validate?, :canonicalize => canonicalize?)
272
+ lit = RDF::Literal.new(content, language: language, datatype: datatype, validate: validate?, canonicalize: canonicalize?)
273
273
  add_prod_data(:literal, lit)
274
274
  end
275
275
 
@@ -300,16 +300,16 @@ module RDF::N3
300
300
  else RDF::XSD.integer
301
301
  end
302
302
 
303
- lit = RDF::Literal.new(nl, :datatype => datatype, :validate => validate?, :canonicalize => canonicalize?)
303
+ lit = RDF::Literal.new(nl, datatype: datatype, validate: validate?, canonicalize: canonicalize?)
304
304
  add_prod_data(:literal, lit)
305
305
  when "quickvariable"
306
306
  # There is a also a shorthand syntax ?x which is the same as :x except that it implies that x is
307
307
  # universally quantified not in the formula but in its parent formula
308
308
  uri = process_qname(tok.sub('?', ':'))
309
- @variables[uri.to_s] = { :formula => @formulae[-2], :var => univar(uri) }
309
+ @variables[uri.to_s] = { formula: @formulae[-2], var: univar(uri) }
310
310
  add_prod_data(:symbol, uri)
311
311
  when "boolean"
312
- lit = RDF::Literal.new(tok.delete("@"), :datatype => RDF::XSD.boolean, :validate => validate?, :canonicalize => canonicalize?)
312
+ lit = RDF::Literal.new(tok.delete("@"), datatype: RDF::XSD.boolean, validate: validate?, canonicalize: canonicalize?)
313
313
  add_prod_data(:literal, lit)
314
314
  when "[", "("
315
315
  # Push on state for content of blank node
@@ -347,7 +347,7 @@ module RDF::N3
347
347
  end
348
348
 
349
349
  def pathlistStart(prod)
350
- @prod_data << {:pathlist => []}
350
+ @prod_data << {pathlist: []}
351
351
  end
352
352
 
353
353
  def pathlistFinish
@@ -359,7 +359,7 @@ module RDF::N3
359
359
  end
360
360
 
361
361
  def pathtailStart(prod)
362
- @prod_data << {:pathtail => []}
362
+ @prod_data << {pathtail: []}
363
363
  end
364
364
 
365
365
  def pathtailToken(prod, tok)
@@ -456,7 +456,7 @@ module RDF::N3
456
456
  pd = @prod_data.pop
457
457
  forAll = Array(pd[:symbol])
458
458
  forAll.each do |term|
459
- @variables[term.to_s] = { :formula => @formulae.last, :var => univar(term) }
459
+ @variables[term.to_s] = { formula: @formulae.last, var: univar(term) }
460
460
  end
461
461
  end
462
462
 
@@ -573,7 +573,7 @@ module RDF::N3
573
573
  # Access Working Group. Note that no existing documents will have used a naked true or false word, without a
574
574
  # @keyword statement which would make it clear that they were not to be treated as keywords. Furthermore any
575
575
  # old parser encountering true or false naked or in a @keywords
576
- return RDF::Literal.new(tok, :datatype => RDF::XSD.boolean)
576
+ return RDF::Literal.new(tok, datatype: RDF::XSD.boolean)
577
577
  else
578
578
  error("Set user @keywords to use barenames.")
579
579
  end
@@ -621,7 +621,7 @@ module RDF::N3
621
621
 
622
622
  # Add debug event to debug array, if specified
623
623
  #
624
- # @param [any] node string for showing context
624
+ # @param [any] node string for showing graph_name
625
625
  # @param [String] message
626
626
  # @yieldreturn [String] appended to message, to allow for lazy-evaulation of message
627
627
  def add_debug(node, message = "")
@@ -633,16 +633,16 @@ module RDF::N3
633
633
 
634
634
  # add a statement, object can be literal or URI or bnode
635
635
  #
636
- # @param [any] node string for showing context
636
+ # @param [any] node string for showing graph_name
637
637
  # @param [URI, Node] subject the subject of the statement
638
638
  # @param [URI] predicate the predicate of the statement
639
639
  # @param [URI, Node, Literal] object the object of the statement
640
640
  # @return [Statement] Added statement
641
641
  # @raise [RDF::ReaderError] Checks parameter types and raises if they are incorrect if parsing mode is _validate_.
642
642
  def add_triple(node, subject, predicate, object)
643
- context_opts = @formulae.last ? {:context => @formulae.last} : {}
643
+ graph_name_opts = @formulae.last ? {graph_name: @formulae.last} : {}
644
644
 
645
- statement = RDF::Statement.new(subject, predicate, object, context_opts)
645
+ statement = RDF::Statement.new(subject, predicate, object, graph_name_opts)
646
646
  add_debug(node) {statement.to_s}
647
647
  @callback.call(statement)
648
648
  end
@@ -13,7 +13,7 @@ module RDF::N3
13
13
  end
14
14
 
15
15
  def parse(prod)
16
- todo_stack = [{:prod => prod, :terms => nil}]
16
+ todo_stack = [{prod: prod, terms: nil}]
17
17
  while !todo_stack.empty?
18
18
  pushed = false
19
19
  if todo_stack.last[:terms].nil?
@@ -81,7 +81,7 @@ module RDF::N3
81
81
  end
82
82
  else
83
83
  puts "parse term(push): #{term}" if $verbose
84
- todo_stack << {:prod => term, :terms => nil}
84
+ todo_stack << {prod: term, terms: nil}
85
85
  pushed = true
86
86
  break
87
87
  end
data/lib/rdf/n3/writer.rb CHANGED
@@ -10,11 +10,11 @@ module RDF::N3
10
10
  # RDF::Writer.for(:n3) #=> RDF::N3::Writer
11
11
  # RDF::Writer.for("etc/test.n3")
12
12
  # RDF::Writer.for("etc/test.ttl")
13
- # RDF::Writer.for(:file_name => "etc/test.n3")
14
- # RDF::Writer.for(:file_name => "etc/test.ttl")
15
- # RDF::Writer.for(:file_extension => "n3")
16
- # RDF::Writer.for(:file_extension => "ttl")
17
- # RDF::Writer.for(:content_type => "text/n3")
13
+ # RDF::Writer.for(file_name: "etc/test.n3")
14
+ # RDF::Writer.for(file_name: "etc/test.ttl")
15
+ # RDF::Writer.for(file_extension: "n3")
16
+ # RDF::Writer.for(file_extension: "ttl")
17
+ # RDF::Writer.for(content_type: "text/n3")
18
18
  #
19
19
  # @example Serializing RDF graph into an Turtle file
20
20
  # RDF::N3::Writer.open("etc/test.n3") do |writer|
@@ -38,9 +38,9 @@ module RDF::N3
38
38
  # The writer will add prefix definitions, and use them for creating @prefix definitions, and minting QNames
39
39
  #
40
40
  # @example Creating @base and @prefix definitions in output
41
- # RDF::N3::Writer.buffer(:base_uri => "http://example.com/", :prefixes => {
41
+ # RDF::N3::Writer.buffer(base_uri: "http://example.com/", prefixes: {
42
42
  # nil => "http://example.com/ns#",
43
- # :foaf => "http://xmlns.com/foaf/0.1/"}
43
+ # foaf: "http://xmlns.com/foaf/0.1/"}
44
44
  # ) do |writer|
45
45
  # graph.each_statement do |statement|
46
46
  # writer << statement
@@ -294,7 +294,7 @@ module RDF::N3
294
294
  # Defines order of predicates to to emit at begninning of a resource description. Defaults to
295
295
  # [rdf:type, rdfs:label, dc:title]
296
296
  # @return [Array<URI>]
297
- def predicate_order; [RDF.type, RDF::RDFS.label, RDF::DC.title]; end
297
+ def predicate_order; [RDF.type, RDF::RDFS.label, RDF::URI("http://purl.org/dc/terms/title")]; end
298
298
 
299
299
  # Order subjects for output. Override this to output subjects in another order.
300
300
  #
@@ -313,7 +313,7 @@ module RDF::N3
313
313
 
314
314
  # Add distinguished classes
315
315
  top_classes.each do |class_uri|
316
- graph.query(:predicate => RDF.type, :object => class_uri).map {|st| st.subject}.sort.uniq.each do |subject|
316
+ graph.query(predicate: RDF.type, object: class_uri).map {|st| st.subject}.sort.uniq.each do |subject|
317
317
  add_debug {"order_subjects: #{subject.inspect}"}
318
318
  subjects << subject
319
319
  seen[subject] = true
@@ -468,7 +468,7 @@ module RDF::N3
468
468
 
469
469
  def p_default(node, position)
470
470
  #add_debug {"p_default: #{node.inspect}, #{position}"}
471
- l = (position == :subject ? "" : " ") + format_value(node, options)
471
+ l = (position == :subject ? "" : " ") + format_term(node, options)
472
472
  @output.write(l)
473
473
  end
474
474
 
@@ -504,7 +504,7 @@ module RDF::N3
504
504
 
505
505
  def predicate_list(subject)
506
506
  properties = {}
507
- @graph.query(:subject => subject) do |st|
507
+ @graph.query(subject: subject) do |st|
508
508
  properties[st.predicate.to_s] ||= []
509
509
  properties[st.predicate.to_s] << st.object
510
510
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf-n3
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3.1
4
+ version: 1.99.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregg
@@ -9,19 +9,13 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-11-09 00:00:00.000000000 Z
12
+ date: 2015-10-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdf
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
18
  - - "~>"
19
- - !ruby/object:Gem::Version
20
- version: '1.1'
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: 1.1.17
24
- - - "<"
25
19
  - !ruby/object:Gem::Version
26
20
  version: '1.99'
27
21
  type: :runtime
@@ -29,12 +23,6 @@ dependencies:
29
23
  version_requirements: !ruby/object:Gem::Requirement
30
24
  requirements:
31
25
  - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1.1'
34
- - - ">="
35
- - !ruby/object:Gem::Version
36
- version: 1.1.17
37
- - - "<"
38
26
  - !ruby/object:Gem::Version
39
27
  version: '1.99'
40
28
  - !ruby/object:Gem::Dependency
@@ -62,9 +50,6 @@ dependencies:
62
50
  requirement: !ruby/object:Gem::Requirement
63
51
  requirements:
64
52
  - - "~>"
65
- - !ruby/object:Gem::Version
66
- version: '1.1'
67
- - - "<"
68
53
  - !ruby/object:Gem::Version
69
54
  version: '1.99'
70
55
  type: :development
@@ -72,9 +57,6 @@ dependencies:
72
57
  version_requirements: !ruby/object:Gem::Requirement
73
58
  requirements:
74
59
  - - "~>"
75
- - !ruby/object:Gem::Version
76
- version: '1.1'
77
- - - "<"
78
60
  - !ruby/object:Gem::Version
79
61
  version: '1.99'
80
62
  - !ruby/object:Gem::Dependency
@@ -83,14 +65,14 @@ dependencies:
83
65
  requirements:
84
66
  - - "~>"
85
67
  - !ruby/object:Gem::Version
86
- version: '3.0'
68
+ version: '3.2'
87
69
  type: :development
88
70
  prerelease: false
89
71
  version_requirements: !ruby/object:Gem::Requirement
90
72
  requirements:
91
73
  - - "~>"
92
74
  - !ruby/object:Gem::Version
93
- version: '3.0'
75
+ version: '3.2'
94
76
  - !ruby/object:Gem::Dependency
95
77
  name: rspec-its
96
78
  requirement: !ruby/object:Gem::Requirement
@@ -110,9 +92,6 @@ dependencies:
110
92
  requirement: !ruby/object:Gem::Requirement
111
93
  requirements:
112
94
  - - "~>"
113
- - !ruby/object:Gem::Version
114
- version: '1.1'
115
- - - "<"
116
95
  - !ruby/object:Gem::Version
117
96
  version: '1.99'
118
97
  type: :development
@@ -120,9 +99,6 @@ dependencies:
120
99
  version_requirements: !ruby/object:Gem::Requirement
121
100
  requirements:
122
101
  - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '1.1'
125
- - - "<"
126
102
  - !ruby/object:Gem::Version
127
103
  version: '1.99'
128
104
  - !ruby/object:Gem::Dependency
@@ -132,9 +108,6 @@ dependencies:
132
108
  - - "~>"
133
109
  - !ruby/object:Gem::Version
134
110
  version: '1.1'
135
- - - "<"
136
- - !ruby/object:Gem::Version
137
- version: '1.99'
138
111
  type: :development
139
112
  prerelease: false
140
113
  version_requirements: !ruby/object:Gem::Requirement
@@ -142,9 +115,6 @@ dependencies:
142
115
  - - "~>"
143
116
  - !ruby/object:Gem::Version
144
117
  version: '1.1'
145
- - - "<"
146
- - !ruby/object:Gem::Version
147
- version: '1.99'
148
118
  - !ruby/object:Gem::Dependency
149
119
  name: rdf-isomorphic
150
120
  requirement: !ruby/object:Gem::Requirement
@@ -152,9 +122,6 @@ dependencies:
152
122
  - - "~>"
153
123
  - !ruby/object:Gem::Version
154
124
  version: '1.1'
155
- - - "<"
156
- - !ruby/object:Gem::Version
157
- version: '1.99'
158
125
  type: :development
159
126
  prerelease: false
160
127
  version_requirements: !ruby/object:Gem::Requirement
@@ -162,9 +129,6 @@ dependencies:
162
129
  - - "~>"
163
130
  - !ruby/object:Gem::Version
164
131
  version: '1.1'
165
- - - "<"
166
- - !ruby/object:Gem::Version
167
- version: '1.99'
168
132
  - !ruby/object:Gem::Dependency
169
133
  name: yard
170
134
  requirement: !ruby/object:Gem::Requirement
@@ -211,7 +175,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
211
175
  requirements:
212
176
  - - ">="
213
177
  - !ruby/object:Gem::Version
214
- version: 1.9.2
178
+ version: 1.9.3
215
179
  required_rubygems_version: !ruby/object:Gem::Requirement
216
180
  requirements:
217
181
  - - ">="