rdfobjects 0.6.4 → 0.6.5
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/rdf_resource.rb +18 -2
- metadata +1 -1
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'uri'
|
2
2
|
require 'date'
|
3
3
|
require 'curies'
|
4
|
-
require 'weakref'
|
5
4
|
|
6
5
|
module RDFObject
|
7
6
|
class Resource < OpenStruct
|
@@ -76,7 +75,24 @@ module RDFObject
|
|
76
75
|
|
77
76
|
def describe
|
78
77
|
rdf = HTTPClient.fetch(self.uri)
|
79
|
-
Parser.parse(rdf)
|
78
|
+
local_collection = Parser.parse(rdf)
|
79
|
+
local_collection[self.uri].assertions.each do | predicate, object |
|
80
|
+
[*object].each do | obj |
|
81
|
+
self.assert(predicate, object) unless self.assertion_exists?(predicate, object)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
def assertions
|
87
|
+
assertions = {}
|
88
|
+
Curie.get_mappings.each do | prefix, uri |
|
89
|
+
if self[uri]
|
90
|
+
self[uri].keys.each do | pred |
|
91
|
+
assertions["#{uri}#{pred}"] = self[uri][pred]
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
assertions
|
80
96
|
end
|
81
97
|
|
82
98
|
def empty_graph?
|