lightrdf 0.1.6 → 0.1.7
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 +4 -5
- data/lib/lightrdf/repository.rb +2 -2
- data/lib/lightrdf.rb +1 -1
- data/lightrdf.gemspec +2 -2
- data/test/test_lightrdf.rb +2 -0
- metadata +3 -3
data/History.txt
CHANGED
data/lib/lightrdf/parser.rb
CHANGED
@@ -36,10 +36,9 @@ module RDF
|
|
36
36
|
when :rdf
|
37
37
|
serialize(:rdfxml)
|
38
38
|
else
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
stdout.read
|
39
|
+
tmpfile = File.join(Dir.tmpdir, "rapper#{$$}#{Thread.current.object_id}")
|
40
|
+
File.open(tmpfile, 'w') { |f| f.write(serialize(:ntriples)) }
|
41
|
+
%x[rapper -q -i ntriples -o #{format} #{tmpfile} 2> /dev/null]
|
43
42
|
end
|
44
43
|
end
|
45
44
|
|
@@ -77,9 +76,9 @@ module RDF
|
|
77
76
|
stdin, stdout, stderr = Open3.popen3("rapper -q -i #{format} -o ntriples /dev/stdin")
|
78
77
|
stdin.puts text
|
79
78
|
stdin.close
|
79
|
+
parse :ntriples, stdout.read
|
80
80
|
rescue
|
81
81
|
end
|
82
|
-
parse :ntriples, stdout.read
|
83
82
|
end
|
84
83
|
end
|
85
84
|
|
data/lib/lightrdf/repository.rb
CHANGED
@@ -13,10 +13,10 @@ module RDF
|
|
13
13
|
# Extracts the data in sesame from the indicated repositories
|
14
14
|
def data *contexts
|
15
15
|
synchronize do
|
16
|
-
params = ("?" + contexts.map{|context| "context=%3C#{CGI::escape(context)}%3E"}*"&&" if contexts.empty?)
|
16
|
+
params = ("?" + contexts.flatten.map{|context| "context=%3C#{CGI::escape(context)}%3E"}*"&&" if !contexts.empty?)
|
17
17
|
|
18
18
|
# Prepares the URL to request the data
|
19
|
-
url = "#{repository_statements_url(@options[:repository])}
|
19
|
+
url = "#{repository_statements_url(@options[:repository])}#{params}"
|
20
20
|
|
21
21
|
# Asks for the data
|
22
22
|
ntriples = RestClient.get url, :content_type=>content_type
|
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.1.
|
5
|
+
s.version = "0.1.7"
|
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-01-
|
9
|
+
s.date = %q{2011-01-29}
|
10
10
|
s.default_executable = %q{yarfp}
|
11
11
|
s.description = %q{RDF library}
|
12
12
|
s.email = %q{joseignacio.fernandez@gmail.com}
|
data/test/test_lightrdf.rb
CHANGED
@@ -132,6 +132,8 @@ foaf: http://xmlns.com/foaf/0.1/
|
|
132
132
|
|
133
133
|
# Check if the added data is there
|
134
134
|
assert_equal graph, repository.data(context)
|
135
|
+
assert_equal graph, repository.data(context, context)
|
136
|
+
assert_equal graph, repository.data([context, context])
|
135
137
|
|
136
138
|
# Check if the triple is there when not filtering by context
|
137
139
|
assert repository.data.triples.include?(triple)
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 7
|
9
|
+
version: 0.1.7
|
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-01-
|
17
|
+
date: 2011-01-29 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|