rdfobjects 0.6.4 → 0.6.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/rdf_objects/rdf_resource.rb +18 -2
  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?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdfobjects
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ross Singer