rdf-trix 1.99.0 → 2.0.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/{README → README.md} +1 -1
- data/VERSION +1 -1
- data/lib/rdf/trix/reader.rb +7 -2
- data/lib/rdf/trix/reader/libxml.rb +1 -1
- data/lib/rdf/trix/reader/nokogiri.rb +3 -1
- data/lib/rdf/trix/reader/rexml.rb +1 -1
- data/lib/rdf/trix/writer.rb +11 -6
- data/lib/rdf/trix/writer/nokogiri.rb +1 -0
- data/lib/rdf/trix/writer/rexml.rb +1 -0
- metadata +32 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d7c42646bb226196e34424a8a78e48bdd982f71
|
4
|
+
data.tar.gz: 57cb0bef6641edf06f0a44c99f9ba54e121d5115
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d2b1c94581bb2188d0ab68f50c658f9665dd2fc3339afd219e6848dcf9044393294b01050e71447985d63bcbff79512347387b9c5160ca81f10c5515b37b8b2
|
7
|
+
data.tar.gz: 9a8d0781b3cb057333c3a3ee550a00f31d8d36ed6353183f8236e4c9348bb6ba0c4dcdfedb46e752865816ac8ed5128613b0bfa10c9063c73efd611b950c18ce
|
data/{README → README.md}
RENAMED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
2.0.0.beta
|
data/lib/rdf/trix/reader.rb
CHANGED
@@ -96,7 +96,12 @@ module RDF::TriX
|
|
96
96
|
end
|
97
97
|
self.extend(@implementation)
|
98
98
|
|
99
|
-
|
99
|
+
begin
|
100
|
+
initialize_xml(options)
|
101
|
+
rescue
|
102
|
+
log_error("Malformed document: #{$!.message}")
|
103
|
+
end
|
104
|
+
|
100
105
|
if block_given?
|
101
106
|
case block.arity
|
102
107
|
when 0 then instance_eval(&block)
|
@@ -162,7 +167,7 @@ module RDF::TriX
|
|
162
167
|
literal.canonicalize! if canonicalize?
|
163
168
|
literal
|
164
169
|
else
|
165
|
-
|
170
|
+
log_error "expected element name to be 'id', 'uri', 'typedLiteral', or 'plainLiteral', but got #{name.inspect}"
|
166
171
|
end
|
167
172
|
end
|
168
173
|
end # Reader
|
@@ -72,7 +72,7 @@ module RDF::TriX
|
|
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) }
|
74
74
|
triple << {:context => context} if context
|
75
|
-
block.call(RDF::Statement
|
75
|
+
block.call(RDF::Statement(*triple))
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end # LibXML
|
@@ -23,6 +23,8 @@ module RDF::TriX
|
|
23
23
|
def initialize_xml(options = {})
|
24
24
|
require 'nokogiri' unless defined?(::Nokogiri)
|
25
25
|
@xml = ::Nokogiri::XML(@input)
|
26
|
+
log_error("Errors: #{@xml.errors.join('\n')}") unless @xml.errors.empty?
|
27
|
+
@xml
|
26
28
|
end
|
27
29
|
|
28
30
|
##
|
@@ -68,7 +70,7 @@ module RDF::TriX
|
|
68
70
|
triple = triple_element.children.select { |node| node.element? }[0..2]
|
69
71
|
triple = triple.map { |element| parse_element(element.name, element, element.content) }
|
70
72
|
triple << {:context => context} if context
|
71
|
-
block.call(RDF::Statement
|
73
|
+
block.call(RDF::Statement(*triple))
|
72
74
|
end
|
73
75
|
end
|
74
76
|
end # Nokogiri
|
@@ -68,7 +68,7 @@ module RDF::TriX
|
|
68
68
|
triple = triple_element.elements.to_a[0..2]
|
69
69
|
triple = triple.map { |element| parse_element(element.name, element.attributes, element.text) }
|
70
70
|
triple << {:context => context} if context
|
71
|
-
block.call(RDF::Statement
|
71
|
+
block.call(RDF::Statement(*triple))
|
72
72
|
end
|
73
73
|
end
|
74
74
|
end # REXML
|
data/lib/rdf/trix/writer.rb
CHANGED
@@ -149,15 +149,18 @@ module RDF::TriX
|
|
149
149
|
end
|
150
150
|
|
151
151
|
##
|
152
|
-
# Generates the TriX representation of
|
152
|
+
# Generates the TriX representation of a quad.
|
153
153
|
#
|
154
|
-
# @param [RDF::
|
154
|
+
# @param [RDF::Resource] subject
|
155
|
+
# @param [RDF::URI] predicate
|
156
|
+
# @param [RDF::Value] object
|
157
|
+
# @param [RDF::Resource] graph_name
|
155
158
|
# @return [void]
|
156
|
-
def
|
157
|
-
unless nested? ||
|
158
|
-
@graph = create_graph(@graph_name =
|
159
|
+
def write_quad(subject, predicate, object, graph_name)
|
160
|
+
unless nested? || graph_name.to_s == @graph_name.to_s
|
161
|
+
@graph = create_graph(@graph_name = graph_name)
|
159
162
|
end
|
160
|
-
write_triple(
|
163
|
+
write_triple(subject, predicate, object)
|
161
164
|
end
|
162
165
|
|
163
166
|
##
|
@@ -170,6 +173,8 @@ module RDF::TriX
|
|
170
173
|
def write_triple(subject, predicate, object)
|
171
174
|
@graph = create_graph unless @graph
|
172
175
|
@graph << format_triple(subject, predicate, object)
|
176
|
+
rescue ArgumentError => e
|
177
|
+
log_error(subject, predicate, object, e.message)
|
173
178
|
end
|
174
179
|
|
175
180
|
##
|
metadata
CHANGED
@@ -1,71 +1,83 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdf-trix
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0.beta
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arto Bendiken
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rdf
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.0.0.beta
|
20
|
+
- - "<"
|
18
21
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
22
|
+
version: '3'
|
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: 2.0.0.beta
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: rdf-spec
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
|
-
- - "
|
37
|
+
- - ">="
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
39
|
+
version: 2.0.0.beta
|
40
|
+
- - "<"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '3'
|
34
43
|
type: :development
|
35
44
|
prerelease: false
|
36
45
|
version_requirements: !ruby/object:Gem::Requirement
|
37
46
|
requirements:
|
38
|
-
- - "
|
47
|
+
- - ">="
|
39
48
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
49
|
+
version: 2.0.0.beta
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '3'
|
41
53
|
- !ruby/object:Gem::Dependency
|
42
54
|
name: rspec
|
43
55
|
requirement: !ruby/object:Gem::Requirement
|
44
56
|
requirements:
|
45
57
|
- - "~>"
|
46
58
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3.
|
59
|
+
version: '3.4'
|
48
60
|
type: :development
|
49
61
|
prerelease: false
|
50
62
|
version_requirements: !ruby/object:Gem::Requirement
|
51
63
|
requirements:
|
52
64
|
- - "~>"
|
53
65
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3.
|
66
|
+
version: '3.4'
|
55
67
|
- !ruby/object:Gem::Dependency
|
56
68
|
name: rspec-its
|
57
69
|
requirement: !ruby/object:Gem::Requirement
|
58
70
|
requirements:
|
59
71
|
- - "~>"
|
60
72
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1.
|
73
|
+
version: '1.2'
|
62
74
|
type: :development
|
63
75
|
prerelease: false
|
64
76
|
version_requirements: !ruby/object:Gem::Requirement
|
65
77
|
requirements:
|
66
78
|
- - "~>"
|
67
79
|
- !ruby/object:Gem::Version
|
68
|
-
version: '1.
|
80
|
+
version: '1.2'
|
69
81
|
- !ruby/object:Gem::Dependency
|
70
82
|
name: yard
|
71
83
|
requirement: !ruby/object:Gem::Requirement
|
@@ -116,7 +128,7 @@ extra_rdoc_files: []
|
|
116
128
|
files:
|
117
129
|
- AUTHORS
|
118
130
|
- CREDITS
|
119
|
-
- README
|
131
|
+
- README.md
|
120
132
|
- UNLICENSE
|
121
133
|
- VERSION
|
122
134
|
- etc/doap.xml
|
@@ -132,7 +144,7 @@ files:
|
|
132
144
|
- lib/rdf/trix/writer/rexml.rb
|
133
145
|
homepage: http://ruby-rdf.github.com/rdf-trix
|
134
146
|
licenses:
|
135
|
-
-
|
147
|
+
- Unlicense
|
136
148
|
metadata: {}
|
137
149
|
post_install_message:
|
138
150
|
rdoc_options: []
|
@@ -142,15 +154,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
142
154
|
requirements:
|
143
155
|
- - ">="
|
144
156
|
- !ruby/object:Gem::Version
|
145
|
-
version:
|
157
|
+
version: '2.0'
|
146
158
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
147
159
|
requirements:
|
148
|
-
- - "
|
160
|
+
- - ">"
|
149
161
|
- !ruby/object:Gem::Version
|
150
|
-
version:
|
162
|
+
version: 1.3.1
|
151
163
|
requirements: []
|
152
164
|
rubyforge_project: rdf
|
153
|
-
rubygems_version: 2.
|
165
|
+
rubygems_version: 2.5.1
|
154
166
|
signing_key:
|
155
167
|
specification_version: 4
|
156
168
|
summary: TriX support for RDF.rb.
|