rdf-trix 1.1.0.1 → 1.99.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 147cdb2e02fe4edfcd27d30489737d24a515c5dc
4
- data.tar.gz: d0afbd93a45315a1e631bfd911591dc90284b7c5
3
+ metadata.gz: da8741a141629c95c4a59c8bc20199b72e2e76dd
4
+ data.tar.gz: 6b042b85dacae9bc0b0b11e80678113ca274b504
5
5
  SHA512:
6
- metadata.gz: 1d78b6f700492b541bf56a115a6336179e5341be90b719199a1bb402278793038f458b012c6ba16970b6680d1c5caf7af5e9de68bdd5f980632c68863b521a49
7
- data.tar.gz: 6bf0255b66b73755b8e0f30395afa3b6983edd3c0005f27bb2e43e9bcd1a3d133d6216488c9c7a9840c001ad5cfbd0ccedbe11cecb366743371e8d2be433a8a6
6
+ metadata.gz: af098f72570473df003bd2596d5c6ed4bf396c3bfac325d80c0b69592ae6b38115a086a0b2b4e31447ef9bbb97d4d4afef975b3abf37b38f3cea704dbe163630
7
+ data.tar.gz: 24213449a5a9883db54aade7ec03a3cfe78de923b8a84c6765d3000b26edd8f22edbe19c0b682854ec5cbcd0daefe2f2e3ea1299935ed6518e6f89ede71d3300
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0.1
1
+ 1.99.0
@@ -23,8 +23,8 @@ module RDF::TriX
23
23
  def initialize_xml(options = {})
24
24
  require 'libxml' unless defined?(::LibXML)
25
25
  @xml = case @input
26
- when File then ::LibXML::XML::Document.file(@input.path)
27
- when IO then ::LibXML::XML::Document.io(@input)
26
+ when File then ::LibXML::XML::Document.file(@input.path)
27
+ when IO, StringIO then ::LibXML::XML::Document.io(@input)
28
28
  else ::LibXML::XML::Document.string(@input.to_s)
29
29
  end
30
30
  end
@@ -35,7 +35,7 @@ module RDF::TriX
35
35
  def each_graph(&block)
36
36
  if block_given?
37
37
  @xml.find('//trix:graph', OPTIONS).each do |graph_element|
38
- graph = RDF::Graph.new(read_context(graph_element))
38
+ graph = RDF::Graph.new(read_graph(graph_element))
39
39
  read_statements(graph_element) { |statement| graph << statement }
40
40
  block.call(graph)
41
41
  end
@@ -59,7 +59,7 @@ module RDF::TriX
59
59
 
60
60
  ##
61
61
  # @private
62
- def read_context(graph_element)
62
+ def read_graph(graph_element)
63
63
  name = graph_element.children.select { |node| node.element? && node.name.to_s == 'uri' }.first.content.strip rescue nil
64
64
  name ? RDF::URI.intern(name) : nil
65
65
  end
@@ -67,7 +67,7 @@ module RDF::TriX
67
67
  ##
68
68
  # @private
69
69
  def read_statements(graph_element, &block)
70
- context = read_context(graph_element)
70
+ context = read_graph(graph_element)
71
71
  graph_element.find('./trix:triple', OPTIONS).each do |triple_element|
72
72
  triple = triple_element.children.select { |node| node.element? }[0..2]
73
73
  triple = triple.map { |element| parse_element(element.name, element.attributes, element.content) }
@@ -31,7 +31,7 @@ module RDF::TriX
31
31
  def each_graph(&block)
32
32
  if block_given?
33
33
  @xml.xpath('//trix:graph', OPTIONS).each do |graph_element|
34
- graph = RDF::Graph.new(read_context(graph_element))
34
+ graph = RDF::Graph.new(read_graph(graph_element))
35
35
  read_statements(graph_element) { |statement| graph << statement }
36
36
  block.call(graph)
37
37
  end
@@ -55,7 +55,7 @@ module RDF::TriX
55
55
 
56
56
  ##
57
57
  # @private
58
- def read_context(graph_element)
58
+ def read_graph(graph_element)
59
59
  name = graph_element.children.select { |node| node.element? && node.name.to_s == 'uri' }.first.content.strip rescue nil
60
60
  name ? RDF::URI.intern(name) : nil
61
61
  end
@@ -63,7 +63,7 @@ module RDF::TriX
63
63
  ##
64
64
  # @private
65
65
  def read_statements(graph_element, &block)
66
- context = read_context(graph_element)
66
+ context = read_graph(graph_element)
67
67
  graph_element.xpath('./trix:triple', OPTIONS).each do |triple_element|
68
68
  triple = triple_element.children.select { |node| node.element? }[0..2]
69
69
  triple = triple.map { |element| parse_element(element.name, element, element.content) }
@@ -31,7 +31,7 @@ module RDF::TriX
31
31
  def each_graph(&block)
32
32
  if block_given?
33
33
  @xml.elements.each('TriX/graph') do |graph_element|
34
- graph = RDF::Graph.new(read_context(graph_element))
34
+ graph = RDF::Graph.new(read_graph(graph_element))
35
35
  read_statements(graph_element) { |statement| graph << statement }
36
36
  block.call(graph)
37
37
  end
@@ -55,7 +55,7 @@ module RDF::TriX
55
55
 
56
56
  ##
57
57
  # @private
58
- def read_context(graph_element)
58
+ def read_graph(graph_element)
59
59
  name = graph_element.elements.select { |element| element.name.to_s == 'uri' }.first.text.strip rescue nil
60
60
  name ? RDF::URI.intern(name) : nil
61
61
  end
@@ -63,7 +63,7 @@ module RDF::TriX
63
63
  ##
64
64
  # @private
65
65
  def read_statements(graph_element, &block)
66
- context = read_context(graph_element)
66
+ context = read_graph(graph_element)
67
67
  graph_element.elements.each('triple') do |triple_element|
68
68
  triple = triple_element.elements.to_a[0..2]
69
69
  triple = triple.map { |element| parse_element(element.name, element.attributes, element.text) }
@@ -53,10 +53,10 @@ module RDF::TriX
53
53
  attr_reader :implementation
54
54
 
55
55
  ##
56
- # Returns the current named graph context, if any.
56
+ # Returns the current graph_name, if any.
57
57
  #
58
58
  # @return [RDF::Resource]
59
- attr_reader :context
59
+ attr_reader :graph_name
60
60
 
61
61
  ##
62
62
  # Initializes the TriX writer instance.
@@ -71,7 +71,7 @@ module RDF::TriX
71
71
  # @yieldparam [RDF::Writer] writer
72
72
  # @yieldreturn [void] ignored
73
73
  def initialize(output = $stdout, options = {}, &block)
74
- @context = nil
74
+ @graph_name = nil
75
75
  @nesting = 0
76
76
 
77
77
  @library = case options[:library]
@@ -109,7 +109,7 @@ module RDF::TriX
109
109
  end
110
110
 
111
111
  ##
112
- # Defines a named graph context.
112
+ # Defines a named graph.
113
113
  #
114
114
  # @param [RDF::Resource] name
115
115
  # @yield [writer]
@@ -117,7 +117,7 @@ module RDF::TriX
117
117
  # @return [void]
118
118
  def graph(name = nil, &block)
119
119
  @nesting += 1
120
- @graph = create_graph(@context = name)
120
+ @graph = create_graph(@graph_name = name)
121
121
  if block_given?
122
122
  case block.arity
123
123
  when 1 then block.call(self)
@@ -148,23 +148,14 @@ module RDF::TriX
148
148
  (@graph || @trix) << create_comment(text)
149
149
  end
150
150
 
151
- ##
152
- # @private
153
- # @see RDF::Writer#write_graph
154
- # @since 0.2.0
155
- def write_graph(graph)
156
- @graph = create_graph(@context = graph.context)
157
- graph.each_triple { |*triple| write_triple(*triple) }
158
- end
159
-
160
151
  ##
161
152
  # Generates the TriX representation of an RDF statement.
162
153
  #
163
154
  # @param [RDF::Statement] statement
164
155
  # @return [void]
165
156
  def write_statement(statement)
166
- unless nested? || statement.context.to_s == @context.to_s
167
- @graph = create_graph(@context = statement.context)
157
+ unless nested? || statement.graph_name.to_s == @graph_name.to_s
158
+ @graph = create_graph(@graph_name = statement.graph_name)
168
159
  end
169
160
  write_triple(*statement.to_triple)
170
161
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf-trix
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0.1
4
+ version: 1.99.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arto Bendiken
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-09 00:00:00.000000000 Z
11
+ date: 2015-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdf
@@ -17,9 +17,6 @@ dependencies:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.1'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '1.99'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,9 +24,6 @@ dependencies:
27
24
  - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '1.1'
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '1.99'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: rdf-spec
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -37,9 +31,6 @@ dependencies:
37
31
  - - "~>"
38
32
  - !ruby/object:Gem::Version
39
33
  version: '1.1'
40
- - - "<"
41
- - !ruby/object:Gem::Version
42
- version: '1.99'
43
34
  type: :development
44
35
  prerelease: false
45
36
  version_requirements: !ruby/object:Gem::Requirement
@@ -47,9 +38,6 @@ dependencies:
47
38
  - - "~>"
48
39
  - !ruby/object:Gem::Version
49
40
  version: '1.1'
50
- - - "<"
51
- - !ruby/object:Gem::Version
52
- version: '1.99'
53
41
  - !ruby/object:Gem::Dependency
54
42
  name: rspec
55
43
  requirement: !ruby/object:Gem::Requirement
@@ -106,6 +94,20 @@ dependencies:
106
94
  - - "~>"
107
95
  - !ruby/object:Gem::Version
108
96
  version: '1.6'
97
+ - !ruby/object:Gem::Dependency
98
+ name: libxml-ruby
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '2.8'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '2.8'
109
111
  description: RDF.rb extension for parsing/serializing TriX data.
110
112
  email: public-rdf-ruby@w3.org
111
113
  executables: []