lightrdf 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -1
- data/README.rdoc +10 -9
- data/lib/lightrdf/parser.rb +8 -9
- data/lib/lightrdf.rb +1 -1
- data/lightrdf.gemspec +2 -2
- metadata +3 -3
data/History.txt
CHANGED
data/README.rdoc
CHANGED
@@ -151,21 +151,22 @@ If any of the values is missing, the values above will be used by default.
|
|
151
151
|
You have three ways of comunicating with Sesame:
|
152
152
|
- You can ask Sesame for the list of all the contexts in the repository:
|
153
153
|
|
154
|
-
|
155
|
-
|
154
|
+
repository = RDF::Repository.new
|
155
|
+
repository.contexts
|
156
156
|
|
157
157
|
- You can ask Sesame for all the data in several contexts, using the data method, which returns an RDF Graph:
|
158
158
|
|
159
|
-
|
160
|
-
|
161
|
-
|
159
|
+
repository = RDF::Repository.new
|
160
|
+
repository = repository.data "test:context1", "test:context2"
|
161
|
+
repository = repository.data "test:context3"
|
162
|
+
repository = repository.data # Return all data in the repository
|
162
163
|
|
163
164
|
- You can ask Sesame for including data in a certain context, using the data= method, passing an RDF Graph as a parameter.
|
164
165
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
166
|
+
repository = RDF::Repository.new
|
167
|
+
context = "test:context4"
|
168
|
+
repository.data = graph, context # Associate graph to "test:context4"
|
169
|
+
repository.data = graph # In this case, data has no associated context
|
169
170
|
|
170
171
|
== CONTRIBUTORS:
|
171
172
|
|
data/lib/lightrdf/parser.rb
CHANGED
@@ -34,11 +34,14 @@ module RDF
|
|
34
34
|
stdin.close
|
35
35
|
stdout.read
|
36
36
|
when :rdf
|
37
|
-
serialize(:rdfxml)
|
37
|
+
serialize(:'rdfxml-abbrev')
|
38
38
|
else
|
39
|
+
namespaces = if [:rdfxml, :'rdfxml-abbrev'].include?(format)
|
40
|
+
QURI.ns.map {|k,v| "-f 'xmlns:#{k}=#{v.inspect}'" } * " "
|
41
|
+
end
|
39
42
|
tmpfile = File.join(Dir.tmpdir, "rapper#{$$}#{Thread.current.object_id}")
|
40
43
|
File.open(tmpfile, 'w') { |f| f.write(serialize(:ntriples)) }
|
41
|
-
%x[rapper -q -i ntriples -o #{format} #{tmpfile} 2> /dev/null]
|
44
|
+
%x[rapper -q -i ntriples #{namespaces} -o #{format} #{tmpfile} 2> /dev/null]
|
42
45
|
end
|
43
46
|
end
|
44
47
|
|
@@ -72,13 +75,9 @@ module RDF
|
|
72
75
|
when :ejson
|
73
76
|
raise Exception, "eJSON format cannot be parsed (yet)"
|
74
77
|
else
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
stdin.close
|
79
|
-
parse :ntriples, stdout.read
|
80
|
-
rescue
|
81
|
-
end
|
78
|
+
tmpfile = File.join(Dir.tmpdir, "rapper#{$$}#{Thread.current.object_id}")
|
79
|
+
File.open(tmpfile, 'w') { |f| f.write text }
|
80
|
+
parse :ntriples, %x[rapper -q -i #{format} -o ntriples #{tmpfile} 2> /dev/null]
|
82
81
|
end
|
83
82
|
end
|
84
83
|
|
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.8"
|
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-
|
9
|
+
s.date = %q{2011-02-09}
|
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
|
- 1
|
8
|
-
-
|
9
|
-
version: 0.1.
|
8
|
+
- 8
|
9
|
+
version: 0.1.8
|
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-
|
17
|
+
date: 2011-02-09 00:00:00 +01:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|