rdf-n3 0.3.4 → 0.3.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.md +20 -30
- data/README +4 -8
- data/README.md +4 -8
- data/VERSION +1 -1
- data/example-files/recipe.ttl +33 -0
- data/lib/rdf/n3/reader.rb +3 -3
- data/lib/rdf/n3/writer.rb +2 -2
- data/rdf-n3.gemspec +3 -2
- data/script/parse +1 -1
- metadata +5 -3
data/History.md
CHANGED
@@ -1,16 +1,17 @@
|
|
1
|
-
0.3.4
|
2
|
-
|
1
|
+
## 0.3.4.1
|
2
|
+
* In Reader, if no base\_uri is used, make sure that @prefix : <#> is generated, not @prefix : <>.
|
3
|
+
* In Writer, fix bug when trying to use `:standard\_prefixes` option.
|
4
|
+
|
5
|
+
## 0.3.4
|
3
6
|
* Reader accepts 1.0E1 in addition to 1.0e1 (case-insensitive match on exponent).
|
4
7
|
* Writer was not outputting xsd prefix if it was only used in a literal datatype.
|
5
8
|
* Use bare representations of xsd:integer, xsd:boolean, xsd:double, and xsd:decimal.
|
6
9
|
* Implement literal canonicalization (on option) in writer.
|
7
10
|
|
8
|
-
0.3.3.1
|
9
|
-
-------
|
11
|
+
## 0.3.3.1
|
10
12
|
* Fixed bug in writer when given a base URI.
|
11
13
|
|
12
|
-
0.3.3
|
13
|
-
-----
|
14
|
+
## 0.3.3
|
14
15
|
* Update dependencies to RDF.rb 0.3.3
|
15
16
|
* Update specs to use open-uri-cached and Spira; no longer directly include W3C test cases.
|
16
17
|
* Use Bundler when running specs.
|
@@ -18,29 +19,24 @@
|
|
18
19
|
* Fixed stack overflow in regular expression when matching long multi-line literals.
|
19
20
|
* Fixed bug (issue 14) where illegal QNames were generated in writer.
|
20
21
|
|
21
|
-
0.3.2
|
22
|
-
-----
|
22
|
+
## 0.3.2
|
23
23
|
* Skipped
|
24
|
-
|
25
|
-
|
24
|
+
|
25
|
+
## 0.3.1.3
|
26
26
|
* Normalize language tags to lower case (only when canonicalizing). SPARQL specs expect the reader
|
27
27
|
to not screw with the language case for equivalence tests.
|
28
28
|
|
29
|
-
0.3.1.2
|
30
|
-
-----
|
29
|
+
## 0.3.1.2
|
31
30
|
* Normalize language tags to lower case.
|
32
31
|
|
33
|
-
0.3.1.1
|
34
|
-
-----
|
32
|
+
## 0.3.1.1
|
35
33
|
* Assert formats for :ttl, :turtle, and :notation3 in addition to :n3
|
36
34
|
|
37
|
-
0.3.1
|
38
|
-
-----
|
35
|
+
## 0.3.1
|
39
36
|
* Add application/turtle, application/x-turtle, text/rdf+n3 and application/rdf+n3 as mime types
|
40
37
|
matching this format, even though only text/turtle and text/n3 are valid.
|
41
38
|
|
42
|
-
0.3.0
|
43
|
-
-----
|
39
|
+
## 0.3.0
|
44
40
|
* New Predictive-Parser based N3 Reader, substantially faster than previous Treetop-based parser
|
45
41
|
* RDF.rb 0.3.0 compatibility updates
|
46
42
|
* Remove literal_normalization and qname_hacks, add back uri_hacks (until 0.3.0)
|
@@ -57,16 +53,14 @@
|
|
57
53
|
* Add check to ensure that predicates are not literals, it's not legal in any RDF variant.
|
58
54
|
* RSpec 2 compatibility
|
59
55
|
|
60
|
-
0.2.3
|
61
|
-
-----
|
56
|
+
## 0.2.3
|
62
57
|
* In Writer, set @base_uri not @base, as :base_uri is an attribute.
|
63
58
|
* Relativize URLs without matching as regexp.
|
64
59
|
* Allow mixed case literal languages.
|
65
60
|
* Improve N3 Unicode support for Ruby 1.9
|
66
61
|
* Improve Turtle/N3 Writer to use unescaped and qname'd values
|
67
62
|
|
68
|
-
0.2.2
|
69
|
-
-----
|
63
|
+
## 0.2.2
|
70
64
|
* Ruby 1.9.2 compatibility
|
71
65
|
* Added script/tc to run test cases
|
72
66
|
* Fixed RDF.to_s != RDF.to_uri.to_s in writer, it worke for every other vocabulary
|
@@ -76,16 +70,13 @@
|
|
76
70
|
* URI normalization isn't required for N3, so removed.
|
77
71
|
* Added Reader#rewind and #close as stubs because document is parsed on initialize and input is closed.
|
78
72
|
|
79
|
-
0.2.1
|
80
|
-
-----
|
73
|
+
## 0.2.1
|
81
74
|
* Compatible with RDF.rb 0.2.1
|
82
75
|
|
83
|
-
0.0.3
|
84
|
-
-----
|
76
|
+
## 0.0.3
|
85
77
|
* Replace require against rdf/rdfxml/patches/* with rdf/n3/patches/*
|
86
78
|
|
87
|
-
0.0.2
|
88
|
-
-----
|
79
|
+
## 0.0.2
|
89
80
|
* N3 parsing and Turtle serialization substantially complete.
|
90
81
|
* A little more work needed on some tests and some lingering issues in RDF.rb to be resolved.
|
91
82
|
* Added script/console and script/parse
|
@@ -94,6 +85,5 @@
|
|
94
85
|
* rdf_escape Literals when serializing via to_s
|
95
86
|
* Remove trailing "#" from URIs when normalizing.
|
96
87
|
|
97
|
-
0.0.1
|
98
|
-
-----
|
88
|
+
## 0.0.1
|
99
89
|
* First port from RdfContext version 0.5.4
|
data/README
CHANGED
@@ -1,15 +1,12 @@
|
|
1
|
-
RDF::N3 reader/writer
|
2
|
-
=====================
|
1
|
+
# RDF::N3 reader/writer
|
3
2
|
Notation-3 and Turtle reader/writer for [RDF.rb][RDF.rb] .
|
4
3
|
|
5
|
-
Description
|
6
|
-
-----------
|
4
|
+
## Description
|
7
5
|
RDF::N3 is an Notation-3 parser for Ruby using the [RDF.rb][RDF.rb] library suite.
|
8
6
|
|
9
7
|
Reader inspired from TimBL predictiveParser and Python librdf implementation.
|
10
8
|
|
11
|
-
Features
|
12
|
-
--------
|
9
|
+
## Features
|
13
10
|
RDF::N3 parses [Notation-3][N3], [Turtle][Turtle] and [N-Triples][N-Triples] into statements or triples. It also serializes to Turtle.
|
14
11
|
|
15
12
|
Install with `gem install rdf-n3`
|
@@ -137,8 +134,7 @@ Full documentation available on [RubyForge](http://rdf.rubyforge.org/n3)
|
|
137
134
|
This is free and unencumbered public domain software. For more information,
|
138
135
|
see <http://unlicense.org/> or the accompanying {file:UNLICENSE} file.
|
139
136
|
|
140
|
-
Feedback
|
141
|
-
--------
|
137
|
+
## Feedback
|
142
138
|
* <gregg@kellogg-assoc.com>
|
143
139
|
* <http://rubygems.org/gem/rdf-n3>
|
144
140
|
* <http://github.com/gkellogg/rdf-n3>
|
data/README.md
CHANGED
@@ -1,15 +1,12 @@
|
|
1
|
-
RDF::N3 reader/writer
|
2
|
-
=====================
|
1
|
+
# RDF::N3 reader/writer
|
3
2
|
Notation-3 and Turtle reader/writer for [RDF.rb][RDF.rb] .
|
4
3
|
|
5
|
-
Description
|
6
|
-
-----------
|
4
|
+
## Description
|
7
5
|
RDF::N3 is an Notation-3 parser for Ruby using the [RDF.rb][RDF.rb] library suite.
|
8
6
|
|
9
7
|
Reader inspired from TimBL predictiveParser and Python librdf implementation.
|
10
8
|
|
11
|
-
Features
|
12
|
-
--------
|
9
|
+
## Features
|
13
10
|
RDF::N3 parses [Notation-3][N3], [Turtle][Turtle] and [N-Triples][N-Triples] into statements or triples. It also serializes to Turtle.
|
14
11
|
|
15
12
|
Install with `gem install rdf-n3`
|
@@ -137,8 +134,7 @@ Full documentation available on [RubyForge](http://rdf.rubyforge.org/n3)
|
|
137
134
|
This is free and unencumbered public domain software. For more information,
|
138
135
|
see <http://unlicense.org/> or the accompanying {file:UNLICENSE} file.
|
139
136
|
|
140
|
-
Feedback
|
141
|
-
--------
|
137
|
+
## Feedback
|
142
138
|
* <gregg@kellogg-assoc.com>
|
143
139
|
* <http://rubygems.org/gem/rdf-n3>
|
144
140
|
* <http://github.com/gkellogg/rdf-n3>
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.4
|
1
|
+
0.3.4.1
|
@@ -0,0 +1,33 @@
|
|
1
|
+
@prefix v: <http://rdf.data-vocabulary.org/#> .
|
2
|
+
|
3
|
+
_:c14n0
|
4
|
+
<http://rdf.data-vocabulary.org/#description> "Crush lime juice, mint and sugar together in glass.";
|
5
|
+
<http://rdf.data-vocabulary.org/#step> "1"^^<http://www.w3.org/2001/XMLSchema#integer>.
|
6
|
+
_:c14n1
|
7
|
+
<http://rdf.data-vocabulary.org/#description> "Fill glass to top with ice cubes.";
|
8
|
+
<http://rdf.data-vocabulary.org/#step> "2"^^<http://www.w3.org/2001/XMLSchema#integer>.
|
9
|
+
_:c14n2
|
10
|
+
<http://rdf.data-vocabulary.org/#description> "Fill the rest of glass with club soda, stir.";
|
11
|
+
<http://rdf.data-vocabulary.org/#step> "4"^^<http://www.w3.org/2001/XMLSchema#integer>.
|
12
|
+
_:c14n3
|
13
|
+
<http://rdf.data-vocabulary.org/#description> "Garnish with a lime wedge.";
|
14
|
+
<http://rdf.data-vocabulary.org/#step> "5"^^<http://www.w3.org/2001/XMLSchema#integer>.
|
15
|
+
_:c14n4
|
16
|
+
<http://rdf.data-vocabulary.org/#description> "Pour white rum over ice.";
|
17
|
+
<http://rdf.data-vocabulary.org/#step> "3"^^<http://www.w3.org/2001/XMLSchema#integer>.
|
18
|
+
_:c14n5
|
19
|
+
<http://rdf.data-vocabulary.org/#ingredients>
|
20
|
+
"1 cup ice cubes",
|
21
|
+
"1 tablespoons white sugar",
|
22
|
+
"1/2 cup club soda",
|
23
|
+
"1/2 lime, juiced with pulp",
|
24
|
+
"12 fresh mint leaves",
|
25
|
+
"2 fluid ounces white rum";
|
26
|
+
<http://rdf.data-vocabulary.org/#instructions>
|
27
|
+
_:c14n0,
|
28
|
+
_:c14n1,
|
29
|
+
_:c14n2,
|
30
|
+
_:c14n3,
|
31
|
+
_:c14n4;
|
32
|
+
<http://rdf.data-vocabulary.org/#name> "Mojito";
|
33
|
+
<http://rdf.data-vocabulary.org/#yield> "1 cocktail".
|
data/lib/rdf/n3/reader.rb
CHANGED
@@ -666,10 +666,10 @@ module RDF::N3
|
|
666
666
|
|
667
667
|
def namespace(prefix, uri)
|
668
668
|
uri = uri.to_s
|
669
|
-
if uri ==
|
670
|
-
uri = prefix(nil)
|
669
|
+
if uri == '#'
|
670
|
+
uri = prefix(nil).to_s + '#'
|
671
671
|
end
|
672
|
-
add_debug("
|
672
|
+
add_debug("namespace", "'#{prefix}' <#{uri}>")
|
673
673
|
prefix(prefix, uri(uri))
|
674
674
|
end
|
675
675
|
|
data/lib/rdf/n3/writer.rb
CHANGED
@@ -166,7 +166,7 @@ module RDF::N3
|
|
166
166
|
return nil
|
167
167
|
end
|
168
168
|
|
169
|
-
add_debug "get_qname(#{resource})"
|
169
|
+
add_debug "get_qname(#{resource}), std? #{RDF::Vocabulary.each.to_a.detect {|v| uri.index(v.to_uri.to_s) == 0}}"
|
170
170
|
qname = case
|
171
171
|
when @uri_to_qname.has_key?(uri)
|
172
172
|
return @uri_to_qname[uri]
|
@@ -176,7 +176,7 @@ module RDF::N3
|
|
176
176
|
prefix(prefix, u) unless u.to_s.empty? # Define for output
|
177
177
|
add_debug "get_qname: add prefix #{prefix.inspect} => #{u}"
|
178
178
|
uri.sub(u.to_s, "#{prefix}:")
|
179
|
-
when @options[:standard_prefixes] && vocab = RDF::Vocabulary.detect {|v| uri.index(v.to_uri.to_s) == 0}
|
179
|
+
when @options[:standard_prefixes] && vocab = RDF::Vocabulary.each.to_a.detect {|v| uri.index(v.to_uri.to_s) == 0}
|
180
180
|
prefix = vocab.__name__.to_s.split('::').last.downcase
|
181
181
|
@uri_to_prefix[vocab.to_uri.to_s] = prefix
|
182
182
|
prefix(prefix, vocab.to_uri) # Define for output
|
data/rdf-n3.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rdf-n3}
|
8
|
-
s.version = "0.3.4"
|
8
|
+
s.version = "0.3.4.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Gregg Kellogg"]
|
12
|
-
s.date = %q{2011-07-
|
12
|
+
s.date = %q{2011-07-11}
|
13
13
|
s.description = %q{RDF::N3 is an Notation-3 and Turtle reader/writer for the RDF.rb library suite.}
|
14
14
|
s.email = %q{gregg@kellogg-assoc.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -34,6 +34,7 @@ Gem::Specification.new do |s|
|
|
34
34
|
"example-files/dwbutler-mj.n3",
|
35
35
|
"example-files/dwbutler-mj.ttl",
|
36
36
|
"example-files/lee-reilly-list.rb",
|
37
|
+
"example-files/recipe.ttl",
|
37
38
|
"example-files/sp2b.n3",
|
38
39
|
"example.rb",
|
39
40
|
"lib/rdf/n3.rb",
|
data/script/parse
CHANGED
@@ -46,7 +46,7 @@ def run(input, options)
|
|
46
46
|
r = reader_class.new(input, :base_uri => options[:base_uri], :strict => true)
|
47
47
|
g = RDF::Graph.new << r
|
48
48
|
num = g.count
|
49
|
-
options[:output].puts g.dump(options[:output_format], :base_uri => options[:base_uri], :prefixes => r.prefixes)
|
49
|
+
options[:output].puts g.dump(options[:output_format], :base_uri => options[:base_uri], :prefixes => r.prefixes, :standard_prefixes => true)
|
50
50
|
end
|
51
51
|
puts
|
52
52
|
secs = Time.new - start
|
metadata
CHANGED
@@ -1,13 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdf-n3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 69
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
9
|
- 4
|
10
|
-
|
10
|
+
- 1
|
11
|
+
version: 0.3.4.1
|
11
12
|
platform: ruby
|
12
13
|
authors:
|
13
14
|
- Gregg Kellogg
|
@@ -15,7 +16,7 @@ autorequire:
|
|
15
16
|
bindir: bin
|
16
17
|
cert_chain: []
|
17
18
|
|
18
|
-
date: 2011-07-
|
19
|
+
date: 2011-07-11 00:00:00 -07:00
|
19
20
|
default_executable:
|
20
21
|
dependencies:
|
21
22
|
- !ruby/object:Gem::Dependency
|
@@ -169,6 +170,7 @@ files:
|
|
169
170
|
- example-files/dwbutler-mj.n3
|
170
171
|
- example-files/dwbutler-mj.ttl
|
171
172
|
- example-files/lee-reilly-list.rb
|
173
|
+
- example-files/recipe.ttl
|
172
174
|
- example-files/sp2b.n3
|
173
175
|
- example.rb
|
174
176
|
- lib/rdf/n3.rb
|