rdf-rdfxml 1.1.0p0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +32 -23
- data/VERSION +1 -1
- data/lib/rdf/rdfxml/format.rb +5 -0
- data/lib/rdf/rdfxml/reader/nokogiri.rb +1 -0
- data/lib/rdf/rdfxml/reader.rb +7 -10
- data/lib/rdf/rdfxml/writer/haml_templates.rb +86 -0
- data/lib/rdf/rdfxml/writer.rb +256 -455
- data/lib/rdf/rdfxml.rb +0 -1
- metadata +47 -60
- data/lib/rdf/rdfxml/patches/array_hacks.rb +0 -53
- data/lib/rdf/rdfxml/patches/graph_properties.rb +0 -34
data/lib/rdf/rdfxml.rb
CHANGED
metadata
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdf-rdfxml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
5
|
-
prerelease: 5
|
4
|
+
version: 1.1.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Gregg
|
@@ -10,92 +9,95 @@ authors:
|
|
10
9
|
autorequire:
|
11
10
|
bindir: bin
|
12
11
|
cert_chain: []
|
13
|
-
date: 2013-
|
12
|
+
date: 2013-11-13 00:00:00.000000000 Z
|
14
13
|
dependencies:
|
15
14
|
- !ruby/object:Gem::Dependency
|
16
15
|
name: rdf
|
17
16
|
requirement: !ruby/object:Gem::Requirement
|
18
|
-
none: false
|
19
17
|
requirements:
|
20
|
-
- -
|
18
|
+
- - '>='
|
21
19
|
- !ruby/object:Gem::Version
|
22
20
|
version: '1.1'
|
23
21
|
type: :runtime
|
24
22
|
prerelease: false
|
25
23
|
version_requirements: !ruby/object:Gem::Requirement
|
26
|
-
none: false
|
27
24
|
requirements:
|
28
|
-
- -
|
25
|
+
- - '>='
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '1.1'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: rdf-rdfa
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '1.1'
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - '>='
|
29
40
|
- !ruby/object:Gem::Version
|
30
41
|
version: '1.1'
|
31
42
|
- !ruby/object:Gem::Dependency
|
32
43
|
name: rdf-xsd
|
33
44
|
requirement: !ruby/object:Gem::Requirement
|
34
|
-
none: false
|
35
45
|
requirements:
|
36
|
-
- -
|
46
|
+
- - '>='
|
37
47
|
- !ruby/object:Gem::Version
|
38
48
|
version: '1.1'
|
39
49
|
type: :runtime
|
40
50
|
prerelease: false
|
41
51
|
version_requirements: !ruby/object:Gem::Requirement
|
42
|
-
none: false
|
43
52
|
requirements:
|
44
|
-
- -
|
53
|
+
- - '>='
|
45
54
|
- !ruby/object:Gem::Version
|
46
55
|
version: '1.1'
|
47
56
|
- !ruby/object:Gem::Dependency
|
48
57
|
name: nokogiri
|
49
58
|
requirement: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
59
|
requirements:
|
52
|
-
- -
|
60
|
+
- - '>='
|
53
61
|
- !ruby/object:Gem::Version
|
54
|
-
version: 1.
|
62
|
+
version: 1.6.0
|
55
63
|
type: :development
|
56
64
|
prerelease: false
|
57
65
|
version_requirements: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
66
|
requirements:
|
60
|
-
- -
|
67
|
+
- - '>='
|
61
68
|
- !ruby/object:Gem::Version
|
62
|
-
version: 1.
|
69
|
+
version: 1.6.0
|
63
70
|
- !ruby/object:Gem::Dependency
|
64
71
|
name: equivalent-xml
|
65
72
|
requirement: !ruby/object:Gem::Requirement
|
66
|
-
none: false
|
67
73
|
requirements:
|
68
|
-
- -
|
74
|
+
- - '>='
|
69
75
|
- !ruby/object:Gem::Version
|
70
76
|
version: 0.2.8
|
71
77
|
type: :development
|
72
78
|
prerelease: false
|
73
79
|
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
none: false
|
75
80
|
requirements:
|
76
|
-
- -
|
81
|
+
- - '>='
|
77
82
|
- !ruby/object:Gem::Version
|
78
83
|
version: 0.2.8
|
79
84
|
- !ruby/object:Gem::Dependency
|
80
85
|
name: open-uri-cached
|
81
86
|
requirement: !ruby/object:Gem::Requirement
|
82
|
-
none: false
|
83
87
|
requirements:
|
84
|
-
- -
|
88
|
+
- - '>='
|
85
89
|
- !ruby/object:Gem::Version
|
86
90
|
version: 0.0.5
|
87
91
|
type: :development
|
88
92
|
prerelease: false
|
89
93
|
version_requirements: !ruby/object:Gem::Requirement
|
90
|
-
none: false
|
91
94
|
requirements:
|
92
|
-
- -
|
95
|
+
- - '>='
|
93
96
|
- !ruby/object:Gem::Version
|
94
97
|
version: 0.0.5
|
95
98
|
- !ruby/object:Gem::Dependency
|
96
99
|
name: spira
|
97
100
|
requirement: !ruby/object:Gem::Requirement
|
98
|
-
none: false
|
99
101
|
requirements:
|
100
102
|
- - '='
|
101
103
|
- !ruby/object:Gem::Version
|
@@ -103,7 +105,6 @@ dependencies:
|
|
103
105
|
type: :development
|
104
106
|
prerelease: false
|
105
107
|
version_requirements: !ruby/object:Gem::Requirement
|
106
|
-
none: false
|
107
108
|
requirements:
|
108
109
|
- - '='
|
109
110
|
- !ruby/object:Gem::Version
|
@@ -111,97 +112,85 @@ dependencies:
|
|
111
112
|
- !ruby/object:Gem::Dependency
|
112
113
|
name: json-ld
|
113
114
|
requirement: !ruby/object:Gem::Requirement
|
114
|
-
none: false
|
115
115
|
requirements:
|
116
|
-
- -
|
116
|
+
- - '>='
|
117
117
|
- !ruby/object:Gem::Version
|
118
118
|
version: '0'
|
119
119
|
type: :development
|
120
120
|
prerelease: false
|
121
121
|
version_requirements: !ruby/object:Gem::Requirement
|
122
|
-
none: false
|
123
122
|
requirements:
|
124
|
-
- -
|
123
|
+
- - '>='
|
125
124
|
- !ruby/object:Gem::Version
|
126
125
|
version: '0'
|
127
126
|
- !ruby/object:Gem::Dependency
|
128
127
|
name: rspec
|
129
128
|
requirement: !ruby/object:Gem::Requirement
|
130
|
-
none: false
|
131
129
|
requirements:
|
132
|
-
- -
|
130
|
+
- - '>='
|
133
131
|
- !ruby/object:Gem::Version
|
134
132
|
version: 2.12.0
|
135
133
|
type: :development
|
136
134
|
prerelease: false
|
137
135
|
version_requirements: !ruby/object:Gem::Requirement
|
138
|
-
none: false
|
139
136
|
requirements:
|
140
|
-
- -
|
137
|
+
- - '>='
|
141
138
|
- !ruby/object:Gem::Version
|
142
139
|
version: 2.12.0
|
143
140
|
- !ruby/object:Gem::Dependency
|
144
141
|
name: rdf-isomorphic
|
145
142
|
requirement: !ruby/object:Gem::Requirement
|
146
|
-
none: false
|
147
143
|
requirements:
|
148
|
-
- -
|
144
|
+
- - '>='
|
149
145
|
- !ruby/object:Gem::Version
|
150
146
|
version: '0'
|
151
147
|
type: :development
|
152
148
|
prerelease: false
|
153
149
|
version_requirements: !ruby/object:Gem::Requirement
|
154
|
-
none: false
|
155
150
|
requirements:
|
156
|
-
- -
|
151
|
+
- - '>='
|
157
152
|
- !ruby/object:Gem::Version
|
158
153
|
version: '0'
|
159
154
|
- !ruby/object:Gem::Dependency
|
160
155
|
name: rdf-turtle
|
161
156
|
requirement: !ruby/object:Gem::Requirement
|
162
|
-
none: false
|
163
157
|
requirements:
|
164
|
-
- -
|
158
|
+
- - '>='
|
165
159
|
- !ruby/object:Gem::Version
|
166
160
|
version: '1.1'
|
167
161
|
type: :development
|
168
162
|
prerelease: false
|
169
163
|
version_requirements: !ruby/object:Gem::Requirement
|
170
|
-
none: false
|
171
164
|
requirements:
|
172
|
-
- -
|
165
|
+
- - '>='
|
173
166
|
- !ruby/object:Gem::Version
|
174
167
|
version: '1.1'
|
175
168
|
- !ruby/object:Gem::Dependency
|
176
169
|
name: rdf-spec
|
177
170
|
requirement: !ruby/object:Gem::Requirement
|
178
|
-
none: false
|
179
171
|
requirements:
|
180
|
-
- -
|
172
|
+
- - '>='
|
181
173
|
- !ruby/object:Gem::Version
|
182
174
|
version: '1.1'
|
183
175
|
type: :development
|
184
176
|
prerelease: false
|
185
177
|
version_requirements: !ruby/object:Gem::Requirement
|
186
|
-
none: false
|
187
178
|
requirements:
|
188
|
-
- -
|
179
|
+
- - '>='
|
189
180
|
- !ruby/object:Gem::Version
|
190
181
|
version: '1.1'
|
191
182
|
- !ruby/object:Gem::Dependency
|
192
183
|
name: yard
|
193
184
|
requirement: !ruby/object:Gem::Requirement
|
194
|
-
none: false
|
195
185
|
requirements:
|
196
|
-
- -
|
186
|
+
- - '>='
|
197
187
|
- !ruby/object:Gem::Version
|
198
188
|
version: 0.8.5
|
199
189
|
type: :development
|
200
190
|
prerelease: false
|
201
191
|
version_requirements: !ruby/object:Gem::Requirement
|
202
|
-
none: false
|
203
192
|
requirements:
|
204
|
-
- -
|
193
|
+
- - '>='
|
205
194
|
- !ruby/object:Gem::Version
|
206
195
|
version: 0.8.5
|
207
196
|
description: RDF::RDFXML is an RDF/XML reader and writer for the RDF.rb library suite.
|
@@ -217,40 +206,38 @@ files:
|
|
217
206
|
- VERSION
|
218
207
|
- UNLICENSE
|
219
208
|
- lib/rdf/rdfxml/format.rb
|
220
|
-
- lib/rdf/rdfxml/patches/array_hacks.rb
|
221
|
-
- lib/rdf/rdfxml/patches/graph_properties.rb
|
222
209
|
- lib/rdf/rdfxml/patches/nokogiri_hacks.rb
|
223
210
|
- lib/rdf/rdfxml/reader/nokogiri.rb
|
224
211
|
- lib/rdf/rdfxml/reader/rexml.rb
|
225
212
|
- lib/rdf/rdfxml/reader.rb
|
226
213
|
- lib/rdf/rdfxml/version.rb
|
227
214
|
- lib/rdf/rdfxml/vocab.rb
|
215
|
+
- lib/rdf/rdfxml/writer/haml_templates.rb
|
228
216
|
- lib/rdf/rdfxml/writer.rb
|
229
217
|
- lib/rdf/rdfxml.rb
|
230
218
|
homepage: http://ruby-rdf.github.com/rdf-rdfxml
|
231
219
|
licenses:
|
232
220
|
- Public Domain
|
221
|
+
metadata: {}
|
233
222
|
post_install_message:
|
234
223
|
rdoc_options: []
|
235
224
|
require_paths:
|
236
225
|
- lib
|
237
226
|
required_ruby_version: !ruby/object:Gem::Requirement
|
238
|
-
none: false
|
239
227
|
requirements:
|
240
|
-
- -
|
228
|
+
- - '>='
|
241
229
|
- !ruby/object:Gem::Version
|
242
230
|
version: 1.9.3
|
243
231
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
244
|
-
none: false
|
245
232
|
requirements:
|
246
|
-
- -
|
233
|
+
- - '>='
|
247
234
|
- !ruby/object:Gem::Version
|
248
|
-
version:
|
235
|
+
version: '0'
|
249
236
|
requirements: []
|
250
237
|
rubyforge_project: rdf-rdfxml
|
251
|
-
rubygems_version: 1.
|
238
|
+
rubygems_version: 2.1.11
|
252
239
|
signing_key:
|
253
|
-
specification_version:
|
240
|
+
specification_version: 4
|
254
241
|
summary: RDF/XML reader/writer for RDF.rb.
|
255
242
|
test_files: []
|
256
243
|
has_rdoc: false
|
@@ -1,53 +0,0 @@
|
|
1
|
-
class Array
|
2
|
-
# http://wiki.rubygarden.org/Ruby/page/show/ArrayPermute
|
3
|
-
# Permute an array, and call a block for each permutation
|
4
|
-
# Author: Paul Battley
|
5
|
-
def permute(prefixed=[])
|
6
|
-
if (length < 2)
|
7
|
-
# there are no elements left to permute
|
8
|
-
yield(prefixed + self)
|
9
|
-
else
|
10
|
-
# recursively permute the remaining elements
|
11
|
-
each_with_index do |e, i|
|
12
|
-
(self[0,i]+self[(i+1)..-1]).permute(prefixed+[e]) { |a| yield a }
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end unless Array.method_defined?(:permute)
|
16
|
-
|
17
|
-
# Converts the array to a comma-separated sentence where the last element is joined by the connector word. Options:
|
18
|
-
# * <tt>:words_connector</tt> - The sign or word used to join the elements in arrays with two or more elements (default: ", ")
|
19
|
-
# * <tt>:two_words_connector</tt> - The sign or word used to join the elements in arrays with two elements (default: " and ")
|
20
|
-
# * <tt>:last_word_connector</tt> - The sign or word used to join the last element in arrays with three or more elements (default: ", and ")
|
21
|
-
def to_sentence(options = {})
|
22
|
-
default_words_connector = ", "
|
23
|
-
default_two_words_connector = " and "
|
24
|
-
default_last_word_connector = ", and "
|
25
|
-
|
26
|
-
# Try to emulate to_senteces previous to 2.3
|
27
|
-
if options.has_key?(:connector) || options.has_key?(:skip_last_comma)
|
28
|
-
::ActiveSupport::Deprecation.warn(":connector has been deprecated. Use :words_connector instead", caller) if options.has_key? :connector
|
29
|
-
::ActiveSupport::Deprecation.warn(":skip_last_comma has been deprecated. Use :last_word_connector instead", caller) if options.has_key? :skip_last_comma
|
30
|
-
|
31
|
-
skip_last_comma = options.delete :skip_last_comma
|
32
|
-
if connector = options.delete(:connector)
|
33
|
-
options[:last_word_connector] ||= skip_last_comma ? connector : ", #{connector}"
|
34
|
-
else
|
35
|
-
options[:last_word_connector] ||= skip_last_comma ? default_two_words_connector : default_last_word_connector
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
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)
|
41
|
-
|
42
|
-
case length
|
43
|
-
when 0
|
44
|
-
""
|
45
|
-
when 1
|
46
|
-
self[0].to_s
|
47
|
-
when 2
|
48
|
-
"#{self[0]}#{options[:two_words_connector]}#{self[1]}"
|
49
|
-
else
|
50
|
-
"#{self[0...-1].join(options[:words_connector])}#{options[:last_word_connector]}#{self[-1]}"
|
51
|
-
end
|
52
|
-
end unless Array.method_defined?(:to_sentence)
|
53
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
module RDF
|
2
|
-
module Queryable
|
3
|
-
# Resource properties
|
4
|
-
#
|
5
|
-
# Properties arranged as a hash with the predicate Term as index to an array of resources or literals
|
6
|
-
#
|
7
|
-
# Example:
|
8
|
-
# graph.load(':foo a :bar; rdfs:label "An example" .', "http://example.com/")
|
9
|
-
# graph.resources(URI.new("http://example.com/subject")) =>
|
10
|
-
# {
|
11
|
-
# "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" => \[<http://example.com/#bar>\],
|
12
|
-
# "http://example.com/#label" => \["An example"\]
|
13
|
-
# }
|
14
|
-
def properties(subject, recalc = false)
|
15
|
-
@properties ||= {}
|
16
|
-
@properties.delete(subject.to_s) if recalc
|
17
|
-
@properties[subject.to_s] ||= begin
|
18
|
-
hash = Hash.new
|
19
|
-
self.query(:subject => subject) do |statement|
|
20
|
-
pred = statement.predicate.to_s
|
21
|
-
|
22
|
-
hash[pred] ||= []
|
23
|
-
hash[pred] << statement.object
|
24
|
-
end
|
25
|
-
hash
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
# Get type(s) of subject, returns a list of symbols
|
30
|
-
def type_of(subject)
|
31
|
-
query(:subject => subject, :predicate => RDF.type).map {|st| st.object}
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|