iq_rdf 0.0.14 → 0.0.15
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.
- data/README.rdoc +1 -1
- data/Rakefile +1 -1
- data/iq_rdf.gemspec +2 -2
- data/lib/iq_rdf.rb +1 -1
- data/lib/iq_rdf/blank_node.rb +1 -1
- data/lib/iq_rdf/collection.rb +4 -2
- data/lib/iq_rdf/document.rb +1 -1
- data/lib/iq_rdf/literal.rb +1 -1
- data/lib/iq_rdf/namespace.rb +1 -1
- data/lib/iq_rdf/node.rb +1 -1
- data/lib/iq_rdf/plain_turtle_literal.rb +1 -1
- data/lib/iq_rdf/predicate.rb +4 -2
- data/lib/iq_rdf/predicate_namespace.rb +2 -2
- data/lib/iq_rdf/rails/iq_rdf.rb +1 -1
- data/lib/iq_rdf/uri.rb +1 -1
- data/lib/iq_rdf/version.rb +2 -2
- data/rails/init.rb +1 -1
- data/test/iq_rdf_test.rb +4 -2
- data/test/test_helper.rb +3 -1
- data/test/turtle_test.rb +6 -4
- data/test/xml_test.rb +36 -4
- metadata +7 -7
data/README.rdoc
CHANGED
@@ -74,4 +74,4 @@ same effect as specifing the default namespace in IqRdf::Document.new.
|
|
74
74
|
=== Complex RDF definitions
|
75
75
|
...
|
76
76
|
|
77
|
-
Copyright (c) 2011
|
77
|
+
Copyright (c) 2011 innoQ Deutschland GmbH, released under the Apache License 2.0
|
data/Rakefile
CHANGED
data/iq_rdf.gemspec
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2011
|
1
|
+
# Copyright 2011 innoQ Deutschland GmbH
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -22,7 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
s.platform = Gem::Platform::RUBY
|
23
23
|
s.authors = ["Till Schulte-Coerne"]
|
24
24
|
s.email = ["till.schulte-coerne@innoq.com"]
|
25
|
-
s.homepage = "http://
|
25
|
+
s.homepage = "http://github.com/innoq/iq_rdf"
|
26
26
|
s.summary = "IqRdf - A builder like rdf library for ruby and rails"
|
27
27
|
s.description = s.summary
|
28
28
|
s.extra_rdoc_files = ['README.rdoc', 'LICENSE']
|
data/lib/iq_rdf.rb
CHANGED
data/lib/iq_rdf/blank_node.rb
CHANGED
data/lib/iq_rdf/collection.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2011
|
1
|
+
# Copyright 2011 innoQ Deutschland GmbH
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -39,7 +39,9 @@ module IqRdf
|
|
39
39
|
end
|
40
40
|
if elements.size > 0
|
41
41
|
build_xml(xml, elements) do |opts, block|
|
42
|
-
xml.rdf :rest
|
42
|
+
xml.rdf :rest do
|
43
|
+
block.call
|
44
|
+
end
|
43
45
|
end
|
44
46
|
else
|
45
47
|
xml.rdf :rest, "rdf:resource" => Rdf.nil.full_uri
|
data/lib/iq_rdf/document.rb
CHANGED
data/lib/iq_rdf/literal.rb
CHANGED
data/lib/iq_rdf/namespace.rb
CHANGED
data/lib/iq_rdf/node.rb
CHANGED
data/lib/iq_rdf/predicate.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2011
|
1
|
+
# Copyright 2011 innoQ Deutschland GmbH
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -31,7 +31,9 @@ module IqRdf
|
|
31
31
|
params += args
|
32
32
|
params << {"xml:lang" => xml_lang} if xml_lang
|
33
33
|
if block
|
34
|
-
xml.tag!(*params
|
34
|
+
xml.tag!(*params) do
|
35
|
+
block.call
|
36
|
+
end
|
35
37
|
else
|
36
38
|
xml.tag!(*params)
|
37
39
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2011
|
1
|
+
# Copyright 2011 innoQ Deutschland GmbH
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -25,7 +25,7 @@ module IqRdf
|
|
25
25
|
objects = args
|
26
26
|
predicate = IqRdf::Predicate.new(@predicate_namespace, postfix, @subject, options[:lang])
|
27
27
|
if (block)
|
28
|
-
raise ArgumentError, "A predicate may either have agruments or a block,
|
28
|
+
raise ArgumentError, "A predicate may either have agruments or a block, or both." if objects.size > 0
|
29
29
|
blank_node = IqRdf::BlankNode.new
|
30
30
|
yield blank_node
|
31
31
|
predicate << blank_node
|
data/lib/iq_rdf/rails/iq_rdf.rb
CHANGED
data/lib/iq_rdf/uri.rb
CHANGED
data/lib/iq_rdf/version.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2011
|
1
|
+
# Copyright 2011 innoQ Deutschland GmbH
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -13,5 +13,5 @@
|
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
15
|
module IqRdf
|
16
|
-
VERSION = "0.0.
|
16
|
+
VERSION = "0.0.15"
|
17
17
|
end
|
data/rails/init.rb
CHANGED
data/test/iq_rdf_test.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2011
|
1
|
+
# Copyright 2011 innoQ Deutschland GmbH
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -12,7 +12,9 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
|
15
|
+
$LOAD_PATH << File.dirname(__FILE__)
|
16
|
+
|
17
|
+
require 'test_helper'
|
16
18
|
|
17
19
|
class IqRdfTest < Test::Unit::TestCase
|
18
20
|
|
data/test/test_helper.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2011
|
1
|
+
# Copyright 2011 innoQ Deutschland GmbH
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -15,4 +15,6 @@
|
|
15
15
|
require 'rubygems'
|
16
16
|
require 'test/unit'
|
17
17
|
|
18
|
+
$LOAD_PATH << File.join(File.dirname(__FILE__), "../lib")
|
19
|
+
|
18
20
|
require 'iq_rdf'
|
data/test/turtle_test.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2011
|
1
|
+
# Copyright 2011 innoQ Deutschland GmbH
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -12,7 +12,9 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
|
15
|
+
$LOAD_PATH << File.dirname(__FILE__)
|
16
|
+
|
17
|
+
require 'test_helper'
|
16
18
|
|
17
19
|
class TurtleTest < Test::Unit::TestCase
|
18
20
|
|
@@ -45,7 +47,7 @@ rdf
|
|
45
47
|
end
|
46
48
|
|
47
49
|
document << IqRdf::build_full_uri_subject(URI.parse('http://www.xyz.de/#test'), IqRdf::build_uri('SomeType')) do |t|
|
48
|
-
t.
|
50
|
+
t.sometest("testvalue")
|
49
51
|
end
|
50
52
|
|
51
53
|
assert_equal(<<rdf, document.to_turtle)
|
@@ -53,7 +55,7 @@ rdf
|
|
53
55
|
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
|
54
56
|
|
55
57
|
<http://www.xyz.de/#test> a :SomeType;
|
56
|
-
:
|
58
|
+
:sometest "testvalue".
|
57
59
|
rdf
|
58
60
|
end
|
59
61
|
|
data/test/xml_test.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright 2011
|
1
|
+
# Copyright 2011 innoQ Deutschland GmbH
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -12,7 +12,9 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
-
|
15
|
+
$LOAD_PATH << File.dirname(__FILE__)
|
16
|
+
|
17
|
+
require 'test_helper'
|
16
18
|
|
17
19
|
class XmlTest < Test::Unit::TestCase
|
18
20
|
|
@@ -46,7 +48,7 @@ rdf
|
|
46
48
|
end
|
47
49
|
|
48
50
|
document << IqRdf::build_full_uri_subject(URI.parse('http://www.xyz.de/#test'), IqRdf::build_uri('SomeType')) do |t|
|
49
|
-
t.
|
51
|
+
t.sometest("testvalue")
|
50
52
|
end
|
51
53
|
|
52
54
|
assert_equal(<<rdf, document.to_xml)
|
@@ -54,7 +56,7 @@ rdf
|
|
54
56
|
<rdf:RDF xmlns="http://www.test.de/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
55
57
|
<rdf:Description rdf:about="http://www.xyz.de/#test">
|
56
58
|
<rdf:type rdf:resource="http://www.test.de/SomeType"/>
|
57
|
-
<
|
59
|
+
<sometest>testvalue</sometest>
|
58
60
|
</rdf:Description>
|
59
61
|
</rdf:RDF>
|
60
62
|
rdf
|
@@ -200,4 +202,34 @@ over two lines</line_breaks>
|
|
200
202
|
rdf
|
201
203
|
end
|
202
204
|
|
205
|
+
def test_blank_nodes
|
206
|
+
document = IqRdf::Document.new('http://www.test.de/')
|
207
|
+
|
208
|
+
document << IqRdf::testnode.test32 do |blank_node| # Blank nodes # :testnode :test32 [
|
209
|
+
blank_node.title("dies ist ein test") # :title "dies ist ein test";
|
210
|
+
blank_node.build_predicate(:test, "Another test") # :test "Another test";
|
211
|
+
blank_node.sub do |subnode| # sub [
|
212
|
+
subnode.title("blubb") # title "blubb"
|
213
|
+
end # ]
|
214
|
+
end # ]
|
215
|
+
assert_equal(<<rdf, document.to_xml)
|
216
|
+
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
|
217
|
+
<rdf:RDF xmlns=\"http://www.test.de/\" xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\">
|
218
|
+
<rdf:Description rdf:about=\"http://www.test.de/testnode\">
|
219
|
+
<test32>
|
220
|
+
<rdf:Description>
|
221
|
+
<title>dies ist ein test</title>
|
222
|
+
<test>Another test</test>
|
223
|
+
<sub>
|
224
|
+
<rdf:Description>
|
225
|
+
<title>blubb</title>
|
226
|
+
</rdf:Description>
|
227
|
+
</sub>
|
228
|
+
</rdf:Description>
|
229
|
+
</test32>
|
230
|
+
</rdf:Description>
|
231
|
+
</rdf:RDF>
|
232
|
+
rdf
|
233
|
+
end
|
234
|
+
|
203
235
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iq_rdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 1
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 15
|
10
|
+
version: 0.0.15
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Till Schulte-Coerne
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-05-26 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -80,7 +80,7 @@ files:
|
|
80
80
|
- test/turtle_test.rb
|
81
81
|
- test/xml_test.rb
|
82
82
|
has_rdoc: true
|
83
|
-
homepage: http://
|
83
|
+
homepage: http://github.com/innoq/iq_rdf
|
84
84
|
licenses: []
|
85
85
|
|
86
86
|
post_install_message:
|
@@ -109,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
109
|
requirements: []
|
110
110
|
|
111
111
|
rubyforge_project:
|
112
|
-
rubygems_version: 1.
|
112
|
+
rubygems_version: 1.5.2
|
113
113
|
signing_key:
|
114
114
|
specification_version: 3
|
115
115
|
summary: IqRdf - A builder like rdf library for ruby and rails
|