activerdf_rdflite 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/activerdf_rdflite/fetching.rb +1 -1
- data/lib/activerdf_rdflite/rdflite.rb +9 -3
- metadata +2 -2
data/Rakefile
CHANGED
@@ -25,7 +25,7 @@ class FetchingAdapter < RDFLite
|
|
25
25
|
#parser.parse_into_model(model, url)
|
26
26
|
#triples = Redland::Serializer.ntriples.model_to_string(nil, model)
|
27
27
|
|
28
|
-
triples = `rapper --scan "#{url}"`
|
28
|
+
triples = `rapper --scan --quiet "#{url}"`
|
29
29
|
lines = triples.split($/)
|
30
30
|
$activerdflog.debug "found #{lines.size} triples"
|
31
31
|
|
@@ -127,8 +127,8 @@ class RDFLite < ActiveRdfAdapter
|
|
127
127
|
# s,p must be resources, o can be primitive data or resource
|
128
128
|
def add(s,p,o,c=nil)
|
129
129
|
# check illegal input
|
130
|
-
raise(ActiveRdfError, "adding non-resource #{s}") unless s.respond_to?(:uri)
|
131
|
-
raise(ActiveRdfError, "adding non-resource #{p}") unless p.respond_to?(:uri)
|
130
|
+
raise(ActiveRdfError, "adding non-resource #{s} while adding (#{s},#{p},#{o},#{c})") unless s.respond_to?(:uri)
|
131
|
+
raise(ActiveRdfError, "adding non-resource #{p} while adding (#{s},#{p},#{o},#{c})") unless p.respond_to?(:uri)
|
132
132
|
|
133
133
|
# get internal representation (array)
|
134
134
|
quad = [s,p,o,c].collect {|r| internalise(r) }
|
@@ -155,6 +155,12 @@ class RDFLite < ActiveRdfAdapter
|
|
155
155
|
# use filename as context
|
156
156
|
context = internalise(RDFS::Resource.new("file:#{file}"))
|
157
157
|
|
158
|
+
add_ntriples(ntriples, context)
|
159
|
+
end
|
160
|
+
|
161
|
+
# adds ntriples from given context into datastore
|
162
|
+
def add_ntriples(ntriples, context)
|
163
|
+
|
158
164
|
# need unique identifier for this batch of triples (to detect occurence of
|
159
165
|
# same bnodes _:#1
|
160
166
|
uuid = UUID.random_create.to_s
|
@@ -179,7 +185,7 @@ class RDFLite < ActiveRdfAdapter
|
|
179
185
|
# handle bnodes and literals if necessary (literals need unicode fixing)
|
180
186
|
object = case nodes[2]
|
181
187
|
when BNode
|
182
|
-
"<http://www.activerdf.org/bnode
|
188
|
+
"<http://www.activerdf.org/bnode/#{uuid}/#$1>"
|
183
189
|
when Literal
|
184
190
|
fix_unicode(nodes[2])
|
185
191
|
else
|
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
|
|
3
3
|
specification_version: 1
|
4
4
|
name: activerdf_rdflite
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 1.2.
|
7
|
-
date:
|
6
|
+
version: 1.2.2
|
7
|
+
date: 2007-01-30 00:00:00 +00:00
|
8
8
|
summary: an RDF database for usage in ActiveRDF (based on sqlite3)
|
9
9
|
require_paths:
|
10
10
|
- lib
|