rdfobjects 0.11.0 → 0.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/rdf_objects/parsers.rb +8 -5
- data/lib/rdf_objects/rdf_resource.rb +2 -2
- metadata +3 -3
data/lib/rdf_objects/parsers.rb
CHANGED
@@ -347,7 +347,7 @@ module RDFObject
|
|
347
347
|
def add_layer name, attributes, prefix, uri, ns
|
348
348
|
layer = {:name=>"#{uri}#{name}"}
|
349
349
|
if attributes['http://www.w3.org/1999/02/22-rdf-syntax-ns#about'] or
|
350
|
-
attributes['http://www.w3.org/1999/02/22-rdf-syntax-ns#nodeID']
|
350
|
+
(attributes['http://www.w3.org/1999/02/22-rdf-syntax-ns#nodeID'] && (@hierarchy.length == 1 || @hierarchy.last[:predicate]))
|
351
351
|
id = attributes['http://www.w3.org/1999/02/22-rdf-syntax-ns#about'] ||
|
352
352
|
attributes['http://www.w3.org/1999/02/22-rdf-syntax-ns#nodeID']
|
353
353
|
id = sanitize_uri(id) if attributes['http://www.w3.org/1999/02/22-rdf-syntax-ns#about']
|
@@ -358,8 +358,10 @@ module RDFObject
|
|
358
358
|
if !@hierarchy.empty? && @hierarchy.last[:predicate]
|
359
359
|
self.current_resource.relate(self.current_predicate, layer[:resource])
|
360
360
|
end
|
361
|
-
elsif attributes["http://www.w3.org/1999/02/22-rdf-syntax-ns#resource"]
|
362
|
-
|
361
|
+
elsif attributes["http://www.w3.org/1999/02/22-rdf-syntax-ns#resource"] or
|
362
|
+
(attributes['http://www.w3.org/1999/02/22-rdf-syntax-ns#nodeID'] && @hierarchy.length > 1 && @hierarchy.last[:predicate].nil?)
|
363
|
+
res = attributes['http://www.w3.org/1999/02/22-rdf-syntax-ns#resource'] || attributes['http://www.w3.org/1999/02/22-rdf-syntax-ns#nodeID']
|
364
|
+
self.current_resource.assert("#{uri}#{name}", @collection.find_or_create(sanitize_uri(res)))
|
363
365
|
layer[:predicate] = layer[:name]
|
364
366
|
else
|
365
367
|
unless layer[:name] == "http://www.w3.org/1999/02/22-rdf-syntax-ns#RDF"
|
@@ -371,7 +373,7 @@ module RDFObject
|
|
371
373
|
layer[:language] = attributes["http://www.w3.org/XML/1998/namespace/lang"].to_sym if attributes["http://www.w3.org/XML/1998/namespace/lang"]
|
372
374
|
end
|
373
375
|
layer[:base_uri] = Addressable::URI.parse(attributes["http://www.w3.org/XML/1998/namespace/base"]).normalize if attributes["http://www.w3.org/XML/1998/namespace/base"]
|
374
|
-
@hierarchy << layer
|
376
|
+
@hierarchy << layer
|
375
377
|
attributes_as_assertions(attributes)
|
376
378
|
end
|
377
379
|
|
@@ -420,6 +422,7 @@ module RDFObject
|
|
420
422
|
def start_element_namespace name, attributes = [], prefix = nil, uri = nil, ns = {}
|
421
423
|
check_for_default_ns(ns)
|
422
424
|
attributes = attributes_to_hash(attributes, ns, name, prefix)
|
425
|
+
|
423
426
|
add_layer(name, attributes, prefix, uri, ns)
|
424
427
|
end
|
425
428
|
|
@@ -439,7 +442,7 @@ module RDFObject
|
|
439
442
|
end
|
440
443
|
|
441
444
|
def end_element_namespace name, prefix = nil, uri = nil
|
442
|
-
remove_layer("#{uri}#{name}")
|
445
|
+
remove_layer("#{uri}#{name}")
|
443
446
|
end
|
444
447
|
end
|
445
448
|
|
@@ -196,8 +196,8 @@ module RDFObject
|
|
196
196
|
if depth == 0
|
197
197
|
rdf << " #{object.xml_object_attribute} />"
|
198
198
|
else
|
199
|
-
rdf << ">"
|
200
|
-
ns, rdf_data = object.
|
199
|
+
rdf << ">"
|
200
|
+
ns, rdf_data = object.rdf_description_block(depth-1)
|
201
201
|
namespaces.merge!(ns)
|
202
202
|
rdf << rdf_data
|
203
203
|
rdf << "</#{key}:#{predicate}>"
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 11
|
8
|
-
-
|
9
|
-
version: 0.11.
|
8
|
+
- 1
|
9
|
+
version: 0.11.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Ross Singer
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-06-
|
17
|
+
date: 2010-06-09 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|