iq_rdf 0.2.3 → 0.3.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 +4 -4
- data/CHANGELOG.md +37 -0
- data/iq_rdf.gemspec +2 -2
- data/lib/iq_rdf/collection.rb +3 -1
- data/lib/iq_rdf/document.rb +3 -1
- data/lib/iq_rdf/version.rb +1 -1
- data/test/ntriples_test.rb +0 -3
- data/test/xml_test.rb +4 -4
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 86d24605dfac28de70ab6dc47bbd296adb42c4e855697b137a226a2a92e19f45
|
|
4
|
+
data.tar.gz: 6d23a834fffa345374df50eac0fbb8c0671a92799adff48ad077cad61df81677
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e9816318bac2c2959053a30e6ec9c5ec531bc37089bb797d289887fc365524c83c02c460b93a25ba74a6287134ee4181d3002acab00627ec5a02d839b0494cb6
|
|
7
|
+
data.tar.gz: 5ca38d366409dea8d0cf6c3e0ee099a828223d00650c1068bb7986dc3087b3f77158037a0efcaf324ed232d00e8b53dc36f53feb8a0d28a0f4d1720345020774
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.3.0] - 2026-09-10
|
|
4
|
+
|
|
5
|
+
* omit `rdf:type rdf:List` from RDF collections. The list structure is fully
|
|
6
|
+
defined by `rdf:first`/`rdf:rest`/`rdf:nil`, and Turtle's `( ... )` form
|
|
7
|
+
cannot express the type at all, so emitting it made the same data count
|
|
8
|
+
differently per format. **Documents containing collections now serialize to
|
|
9
|
+
fewer triples**, and N-Triples, Turtle and RDF/XML agree on the count. In
|
|
10
|
+
RDF/XML, list nodes are now `rdf:Description` rather than `rdf:List`.
|
|
11
|
+
|
|
12
|
+
## [0.2.3] - 2026-09-10
|
|
13
|
+
|
|
14
|
+
* fix Turtle serialization of literals containing a carriage return. A long
|
|
15
|
+
string (`"""..."""`) was only used for newlines, so a lone carriage return
|
|
16
|
+
ended up raw inside a short string - invalid Turtle, which made parsers drop
|
|
17
|
+
the statement without warning. Quotes are now escaped inside long strings as
|
|
18
|
+
well, so a value ending in a quote or containing three of them no longer
|
|
19
|
+
breaks the output.
|
|
20
|
+
* serialize Turtle in linear rather than quadratic time. Building the output
|
|
21
|
+
with `+=` copied the whole string on every append, which made large documents
|
|
22
|
+
effectively impossible to serialize.
|
|
23
|
+
* serialize N-Triples faster by not counting a Hash with `Enumerable#count`,
|
|
24
|
+
which walks and allocates per entry. On a document with many blank nodes this
|
|
25
|
+
dominated the runtime.
|
|
26
|
+
* add `rdf-turtle` as a development dependency, so that tests can parse
|
|
27
|
+
generated output back instead of only comparing it to an expected string.
|
|
28
|
+
|
|
29
|
+
## [0.2.2] - 2026-07-31
|
|
30
|
+
|
|
31
|
+
* fix N-Triples serialization of literals containing newlines, tabs or
|
|
32
|
+
carriage returns
|
|
33
|
+
* drop support for end-of-life rubies
|
|
34
|
+
|
|
35
|
+
## [0.2.1]
|
|
36
|
+
|
|
37
|
+
* fix a frozen string literal warning
|
data/iq_rdf.gemspec
CHANGED
|
@@ -25,7 +25,7 @@ Gem::Specification.new do |s|
|
|
|
25
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
|
-
s.extra_rdoc_files = ['README.md', 'LICENSE']
|
|
28
|
+
s.extra_rdoc_files = ['README.md', 'CHANGELOG.md', 'LICENSE']
|
|
29
29
|
|
|
30
30
|
s.add_dependency "bundler"
|
|
31
31
|
s.add_dependency "builder"
|
|
@@ -35,7 +35,7 @@ Gem::Specification.new do |s|
|
|
|
35
35
|
# parses generated output back, so that tests catch invalid serializations
|
|
36
36
|
s.add_development_dependency "rdf-turtle"
|
|
37
37
|
|
|
38
|
-
s.files = %w(LICENSE README.md Rakefile iq_rdf.gemspec) + Dir.glob("{lib,rails,test}/**/*")
|
|
38
|
+
s.files = %w(LICENSE README.md CHANGELOG.md Rakefile iq_rdf.gemspec) + Dir.glob("{lib,rails,test}/**/*")
|
|
39
39
|
s.test_files = Dir.glob("{test}/**/*")
|
|
40
40
|
s.executables = Dir.glob("{bin}/**/*")
|
|
41
41
|
s.require_paths = ["lib"]
|
data/lib/iq_rdf/collection.rb
CHANGED
|
@@ -33,7 +33,9 @@ module IqRdf
|
|
|
33
33
|
elements ||= @elements.dup
|
|
34
34
|
block.call({},
|
|
35
35
|
lambda {
|
|
36
|
-
|
|
36
|
+
# rdf:Description, not rdf:List: a typed element would assert
|
|
37
|
+
# rdf:type rdf:List, which Turtle's ( ... ) form cannot express
|
|
38
|
+
xml.rdf :Description do
|
|
37
39
|
elements.shift.build_xml(xml) do |*args|
|
|
38
40
|
xml.rdf(:first, *args)
|
|
39
41
|
end
|
data/lib/iq_rdf/document.rb
CHANGED
|
@@ -77,7 +77,9 @@ module IqRdf
|
|
|
77
77
|
sublist = list
|
|
78
78
|
total = res.elements.length
|
|
79
79
|
res.elements.each_with_index do |current_element, i|
|
|
80
|
-
|
|
80
|
+
# No a rdf:List here: rdf:first/rdf:rest/rdf:nil already define the
|
|
81
|
+
# collection, and Turtle's ( ... ) form cannot express the type at
|
|
82
|
+
# all - emitting it made the same data count differently per format.
|
|
81
83
|
sublist::rdf.first(current_element) # _:b* rdf:first <...>
|
|
82
84
|
last = i + 1 == total
|
|
83
85
|
if last
|
data/lib/iq_rdf/version.rb
CHANGED
data/test/ntriples_test.rb
CHANGED
|
@@ -101,13 +101,10 @@ _:b2 <http://www.test.de/title> "blubb" .
|
|
|
101
101
|
document << IqRdf::testemann.testIt([IqRdf::hello, IqRdf::goodbye, "bla"])
|
|
102
102
|
|
|
103
103
|
assert_equal(<<-rdf.strip, document.to_ntriples.strip)
|
|
104
|
-
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#List> .
|
|
105
104
|
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://test.de/hello> .
|
|
106
105
|
_:b2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b3 .
|
|
107
|
-
_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#List> .
|
|
108
106
|
_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <http://test.de/goodbye> .
|
|
109
107
|
_:b3 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:b4 .
|
|
110
|
-
_:b4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/1999/02/22-rdf-syntax-ns#List> .
|
|
111
108
|
_:b4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> "bla" .
|
|
112
109
|
_:b4 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> .
|
|
113
110
|
<http://test.de/testemann> <http://test.de/testIt> _:b2 .
|
data/test/xml_test.rb
CHANGED
|
@@ -103,15 +103,15 @@ rdf
|
|
|
103
103
|
</rdf:Description>
|
|
104
104
|
<rdf:Description rdf:about="http://www.umweltprobenbank.de/testemann">
|
|
105
105
|
<testIt>
|
|
106
|
-
<rdf:
|
|
106
|
+
<rdf:Description>
|
|
107
107
|
<rdf:first rdf:resource="http://www.umweltprobenbank.de/hello"/>
|
|
108
108
|
<rdf:rest>
|
|
109
|
-
<rdf:
|
|
109
|
+
<rdf:Description>
|
|
110
110
|
<rdf:first>bla</rdf:first>
|
|
111
111
|
<rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
|
|
112
|
-
</rdf:
|
|
112
|
+
</rdf:Description>
|
|
113
113
|
</rdf:rest>
|
|
114
|
-
</rdf:
|
|
114
|
+
</rdf:Description>
|
|
115
115
|
</testIt>
|
|
116
116
|
</rdf:Description>
|
|
117
117
|
<rdf:Description rdf:about="http://www.upb.de/u1023">
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: iq_rdf
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Till Schulte-Coerne
|
|
@@ -85,9 +85,11 @@ email:
|
|
|
85
85
|
executables: []
|
|
86
86
|
extensions: []
|
|
87
87
|
extra_rdoc_files:
|
|
88
|
+
- CHANGELOG.md
|
|
88
89
|
- LICENSE
|
|
89
90
|
- README.md
|
|
90
91
|
files:
|
|
92
|
+
- CHANGELOG.md
|
|
91
93
|
- LICENSE
|
|
92
94
|
- README.md
|
|
93
95
|
- Rakefile
|