lightrdf 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -0
- data/lib/lightrdf/parser.rb +13 -2
- data/lib/lightrdf.rb +1 -1
- data/lightrdf.gemspec +2 -2
- metadata +3 -3
data/History.txt
CHANGED
data/lib/lightrdf/parser.rb
CHANGED
@@ -15,7 +15,12 @@ module RDF
|
|
15
15
|
when :yarf
|
16
16
|
ns = respond_to?(:ns) ? ID.ns.merge(self.ns) : ID.ns
|
17
17
|
if header
|
18
|
-
|
18
|
+
used_ns = {}
|
19
|
+
triples.flatten.select { |node| node.is_a?(Symbol) and ID.uri?(node) }.each do |uri|
|
20
|
+
prefix = ID.compress(uri).split(':').first.to_sym
|
21
|
+
used_ns[prefix] = ns[prefix] if ns[prefix]
|
22
|
+
end
|
23
|
+
(used_ns.map{|k,v| "#{k}: #{v}\n"} * '') + serialize_yarf(nodes, ns)
|
19
24
|
else
|
20
25
|
serialize_yarf(nodes, ns)
|
21
26
|
end
|
@@ -32,7 +37,13 @@ module RDF
|
|
32
37
|
serialize(:'rdfxml-abbrev')
|
33
38
|
else
|
34
39
|
namespaces = if [:rdfxml, :'rdfxml-abbrev'].include?(format)
|
35
|
-
ID.ns.
|
40
|
+
ns = respond_to?(:ns) ? ID.ns.merge(self.ns) : ID.ns
|
41
|
+
used_ns = {}
|
42
|
+
triples.flatten.select { |node| node.is_a?(Symbol) and ID.uri?(node) }.each do |uri|
|
43
|
+
prefix = ID.compress(uri).split(':').first.to_sym
|
44
|
+
used_ns[prefix] = ns[prefix] if ns[prefix]
|
45
|
+
end
|
46
|
+
used_ns.map {|k,v| "-f 'xmlns:#{k}=#{v.inspect}'" } * " "
|
36
47
|
end
|
37
48
|
tempfile = RDF::Parser.new_tempfile
|
38
49
|
File.open(tempfile, 'w') { |f| f.write(serialize(:ntriples)) }
|
data/lib/lightrdf.rb
CHANGED
data/lightrdf.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{lightrdf}
|
5
|
-
s.version = "0.2.
|
5
|
+
s.version = "0.2.4"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Jose Ignacio"]
|
9
|
-
s.date = %q{2011-03-
|
9
|
+
s.date = %q{2011-03-16}
|
10
10
|
s.default_executable = %q{yarfp}
|
11
11
|
s.description = %q{RDF library}
|
12
12
|
s.email = %q{joseignacio.fernandez@gmail.com}
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 2
|
8
|
-
-
|
9
|
-
version: 0.2.
|
8
|
+
- 4
|
9
|
+
version: 0.2.4
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Jose Ignacio
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-03-
|
17
|
+
date: 2011-03-16 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|